Host machine have next network interface:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:b5:1e:5a:50 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
docker_gwbridge: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255
inet6 fe80::42:36ff:feae:7b45 prefixlen 64 scopeid 0x20<link>
ether 02:42:36:ae:7b:45 txqueuelen 0 (Ethernet)
RX packets 226939106 bytes 46241924181 (43.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 166 bytes 8300 (8.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 1.1.1.1 netmask 255.255.255.0 broadcast 1.1.1.255
inet6 fe80::21a:ff:fe00:43f prefixlen 64 scopeid 0x20<link>
ether 00:1a:00:00:04:3f txqueuelen 1000 (Ethernet)
RX packets 3852423 bytes 1206323488 (1.1 GiB)
RX errors 0 dropped 11 overruns 0 frame 0
TX packets 380930 bytes 85160453 (81.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 2.2.2.2 netmask 255.255.255.0 broadcast 2.2.2.255
inet6 fe80::21a:ff:fe00:b1a prefixlen 64 scopeid 0x20<link>
ether 00:1a:00:00:0b:1a txqueuelen 1000 (Ethernet)
RX packets 226939106 bytes 46241924181 (43.0 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 166 bytes 8300 (8.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
In swarm docker compose config i bind 162 port from all interface to 162 in container:
ports:
- target: 162
published: 162
protocol: udp
mode: host
networks:
- default
All ports binds look good: docker ps -a
80/tcp, 0.0.0.0:162->162/udp, :::162->162/udp
When i send udp packet to eth0 ( 1.1.1.1 ) i catch via tcpdump this packet in container.
When i send udp packet to eth1 ( 2.2.2.2 ) i dont catch the packet in container.
How i can catch packet in container from eth1?