转载请注明出处:http://blog.csdn.net/l1028386804/article/details/52629591
vi /etc/sysctl.conf
把
net.ipv4.ip_forward = 0
改成
net.ipv4.ip_forward = 1
如果此文件中没有这个选项则将其添加上就行。
然后执行命令:#sysctl -p
使其生效。
[root@liuyazhuang145 ~]# sysctl -p net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 2 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 vm.min_free_kbytes = 65536 kernel.panic_on_oops = 1 kernel.panic = 60再一次的查看
[root@liuyazhuang145 ~]# cat /proc/sys/net/ipv4/ip_forward
1
原来的0就变为1了。
原文链接:https://www.f2er.com/centos/380613.html