docker主机更改IP后网络不通

确保docker容器正常
查看ipv4转发是否开启

cat /proc/sys/net/ipv4/ip_forward

0 #表示没开启ipv4转发

临时修改:

echo 1 > /proc/sys/net/ipv4/ip_forward

永久修改:

vi /etc/sysctl.conf

net.ipv4.ip_forward=1

sysctl -p

重启docker

systemctl restart docker

验证容器是否可访问

# docker 

评论

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×