[CentOS] Is there a way to save the routing table permanently?

Fri Aug 22 17:44:08 UTC 2008
Les Mikesell <lesmikesell at gmail.com>

Florin Andrei wrote:
> ABBAS KHAN wrote:
>> I'm adding the default gateway to the route through "route add default 
>> gw 10.10.10.10 <http://10.10.10.10>" which is also shown in "route -n" 
>> but the problem is that as soon as I restart the network through 
>> /etc/init.d/network restart; the route sets to default one...!
>> SO, my question is there any way to save the modified route 
>> permanently by hardcoding the changes?
> 
> It would be very nice if the init.d script would allow the sysadmin to 
> do something like "service network saveroutes". I always thought that 
> would be a neat feature.

Routes only work when you can reach the next hop.  That is,  if you try 
to add a route through an interface that is not up, the command will 
fail and the route will not be added.  If you want a route to be added 
when an interface comes up, there is already a place to do that. 
However, as others have pointed out you shouldn't expect multiple 
concurrent default routes to do something useful - but if you have 
multiple interfaces you can configure them both to add default routes 
and bring only one up at a time.

-- 
   Les Mikesell
    lesmikesell at gmail.com