centos7上开启路由转发
CentOS7 开启路由转发
2018-03-27 09:18:14
1.临时开启,(写入内存,在内存中开启)
echo "1" > /proc/sys/net/ipv4/ip_forward
2.永久开启,(写入内核)
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p ----加载,使得配置文件立即生效
检查:
sysctl -a |grep "ip_forward"
------->
net.ipv4.ip_forward = 1
net.ipv4.ip_forward_use_pmtu = 0