docker提示没有开启转发解决方法

 vim  /usr/lib/sysctl.d/00-system.conf

[root@t1 ~]# vim /usr/lib/sysctl.d/00-system.conf
# Kernel sysctl configuration file
#
# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
# sysctl.conf(5) for more details.

# Disable netfilter on bridges.
net.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
net.ipv4.ip_forward=1
~
~
~


或者:

临时生效:

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

永久生效的话,需要修改sysctl.conf:

net.ipv4.ip_forward = 1

执行sysctl -p马上生效

原文地址:https://www.cnblogs.com/qiangyuzhou/p/11231520.html