#!/bin/sh # # This script will be executed *after* all the other init scripts. # You can put your own initialization stuff in here if you don't # want to do the full Sys V style init stuff. touch /var/lock/subsys/local route add -net 192.168.3.0/24 dev eth0 route add -net 192.168.2.0/24 gw 192.168.3.254 route add -net 172.16.0.0 netmask 255.255.0.0 gw 192.168.1.100 dev eth0
# Add non interface-specific static-routes. if [ -f /etc/sysconfig/static-routes ]; then if [ -x /sbin/route ]; then grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do /sbin/route add -$args done else net_log $"Legacy static-route support not available: /sbin/route not found" fi fi
添加操作如下:
1 2 3 4 5
vi /etc/sysconfig/static-routes any net 192.168.1.0/24 gw 192.168.1.1 any net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1 any host 10.19.190.11/32 gw 10.19.177.10 any host 10.19.190.12 gw 10.19.177.10