我正在使用UDP中的Docker进行非常基本的测试。 我在端口8000 / UDP上启动一个容器:
docker run -p 8000:8000/udp jgkamat/netcat -l -u -p 8000
我看到来到这个港口的流量:
ngrep -W byline -d any portrange 8000
我发送UDP数据包:
nc -u <ip-address> 8000
这是ngrep的结果:
filter: (ip or ip6) and ( portrange 8000 )
#
U <my-public-ip>:37704 -> 192.168.0.4:8000
hello.............
#
U <my-public-ip>:37704 -> 172.17.0.2:8000
hello.
#
U <my-public-ip>:37704 -> 172.17.0.2:8000
hello.
有人可以解释为什么数据包重复吗?
答案 0 :(得分:-1)
您正在看到正在转发的相同udp包的传输:
netcat -(hello)-> host-interface -(hello)-> container-interface
每个容器都有自己的网络接口。 ngrep
正在观看两个主机接口:通常为eth0
的接口和停靠网络中的接口,通常为docker0
。