复制代码代码如下: default via 192.168.3.1 dev eth0#192.168.3.1为eth0网卡的网关地址 10.211.6.0/24 via 192.168.3.1 dev eth0 10.0.0.0/8 via 10.212.52.1 dev eth1#10.212.52.1为eth1网卡的网关地址
复制代码代码如下: # cat /etc/sysconfig/network-scripts/route-eth0 0.0.0.0/0 via 192.168.3.1 dev eth0 10.211.6.0/24 via 192.168.3.1 dev eth0 # cat /etc/sysconfig/network-scripts/route-eth1 10.0.0.0/8 via 10.212.52.1 dev eth1
复制代码代码如下: # cat /etc/sysconfig/static-route any net any gw 192.168.3.1 any net 10.211.6.0/24 gw 192.168.3.1 any net 10.0.0.0 netmask 255.0.0.0 gw 10.212.52.1
复制代码代码如下: # Add non interface-specific static-routes. if [ -f /etc/sysconfig/static-routes ]; then grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do /sbin/route add -$args done fi
复制代码代码如下: define an additional configuration file: /etc/sysconfig/network/ifroute-*. Replace * with the name of the interface. The entries in the routing configuration files look like this: DESTINATION GATEWAY NETMASK INTERFACE [ TYPE ] [ OPTIONS ] DESTINATION GATEWAY PREFIXLEN INTERFACE [ TYPE ] [ OPTIONS ] DESTINATION/PREFIXLEN GATEWAY - INTERFACE [ TYPE ] [ OPTIONS ]