Score:0

Docker swarm bind port to all host interface

cn flag

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?

pt flag
From where are you sending packets? If you capture on all interfaces (`tcpdump -i any -nn udp and port 162`), do you see the traffic?
Unknown.Vagrant avatar
cn flag
17:02:23.907623 IP (tos 0x88, ttl 27, id 8310, offset 0, flags [none], proto UDP (17), length 165) 2.33.44.5.161 > 2.2.2.2.162: [udp sum ok] { SNMPv2c C="jhJaQ49bN6hKuYe" { V2Trap(109) R=2096538^C
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.