在linux下设置永久路由的方法:1.在/etc/rc.local里添加
2.在/etc/sysconfig/network里添加到末尾
3./etc/sysconfig/static-router :
any net x.x.x.x/24 gw y.y.y.y
开启 IP 转发:
>/proc/sys/net/ipv4/ip_forward (临时)
# vi /etc/sysctl.conf --> net.ipv4.ip_forward=1 (永久开启)
在/etc/sysconfig/static-routes中设置,格式如下,
any net 192.168.34.0 netmask 255.255.255.0 gw 192.168.1.3
any net 192.168.96.0 netmask 255.255.255.0 gw 192.168.1.3
设置完以后,service /restart 重启网络服务才能生效,