docker容器跨主机互通:
主机1:
# apt-get install bridge-utils
# brctl addbr br0
# ifconfig br0 10.0.1.50 netmask 255.255.255.0
# brctl addif br0 eno1
后2步需要到ilo上操作(因为此时网络已经不通了,没法ssh连接)
# ip addr del 10.0.1.50 dev eno1
# ip route del default
# ip route add default via 10.0.1.1 dev br0
# vi /etc/docker/daemon.json
"bridge": "br0"
:wq
# systemctl restart docker
# git clone https://github.com/jpetazzo/pipework
# cp pipework/pipework /usr/bin/
# pipework br0 aa 10.0.1.100/24@10.0.1.1
此时从外面ping 10.0.1.100(docker容器ip)就是通的
主机2同主机1操作,这时不同主机里的2个容器就是通的了