routing question (almost there!)

Mike Klinke lsomike at futzin.com
Tue Feb 8 22:07:29 UTC 2005


On Tuesday 08 February 2005 15:21, Douglas Frank wrote:
> Oops yes it is.  Anyway I'm past that (see earlier post)-- the
> box I *thought* was the router, isn't.
>
> I'm almost all set-- I just need to know how to make the routing
> table permanent.  Looking at /etc/rc.d/rc5.d/S10network, it reads
> a static- routes file (if present) and adds routes found there. 
> Looks like all I have to do is gin up a file for it to read. 
> Unfortunately the rc script dosn't allow the arguments I think I
> need:
>
> the rc script invokes route sort of like this:
>
>    cat static_routes | while read ignore args ; do
>  /sbin/route add -$args
>    done
>

Which OS are you using?  The FC3 network intialization stanza looks 
like:

# 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 

which searches for any line beginning with the word "any".  Anyway, 
try it without the "-" on "-net". For example:

# route -n
 
192.168.1.0  0.0.0.0      255.255.255.0   U  0  0  0 eth0
0.0.0.0      192.168.1.6  0.0.0.0         UG 0  0  0 eth0

# vi static-routes
# cat static-routes 
any net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1
any net 192.168.3.0 netmask 255.255.255.0 gw 192.168.1.1
any net 192.168.4.0 netmask 255.255.255.0 gw 192.168.1.1

16:01:45 # /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Setting network parameters:                                [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
16:02:04 # route -n
Kernel IP routing table
 
192.168.4.0  192.168.1.1 255.255.255.0   UG  0  0  0 eth0
192.168.3.0  192.168.1.1 255.255.255.0   UG  0  0  0 eth0
192.168.2.0  192.168.1.1 255.255.255.0   UG  0  0  0 eth0
192.168.1.0  0.0.0.0     255.255.255.0   U   0  0  0 eth0
0.0.0.0      192.168.1.6 0.0.0.0         UG  0  0  0 eth0




More information about the fedora-list mailing list