问题描述:

When I setup a network with docker create network test1 and then start a few containers, for example

docker run -d --net=test1 --name=t1 elasticsearch

docker run -d --net=test1 elasticsearch

docker run -d --net=test1 elasticsearch

I can't broadcast ping any of these containers with docker exec -ti t1 ping 255.255.255.255.

Any idea how I can change this?

网友答案:

This is currently followed in issue 17814

UDP broadcasts don't work in multi-host network between hosts.
UDP broadcasts only work if both containers run on the same host.

Playing with icmp broadcast by pinging on 255.255.255.255, I receive replies only from the local host:

# ping -b 255.255.255.255
WARNING: pinging broadcast address
PING 255.255.255.255 (255.255.255.255) 56(84) bytes of data.
64 bytes from 172.18.0.1: icmp_req=1 ttl=64 time=0.601 ms
64 bytes from 172.18.0.1: icmp_req=2 ttl=64 time=0.424 ms
64 bytes from 172.18.0.1: icmp_req=3 ttl=64 time=0.420 ms
64 bytes from 172.18.0.1: icmp_req=4 ttl=64 time=0.427 ms

(I made sure /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts is set to 0 on both hosts.)

It also seems impossible to set a broadcast address on the interface connected to the shared network:

# ifconfig eth0 broadcast 10.0.0.255
SIOCSIFBRDADDR: Operation not permitted
SIOCSIFFLAGS: Operation not permitted

This ability to multicast in overlay driver is discussed in docker/libnetwork issue 552.
(help wanted)

相关阅读:
Top