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

Tue Aug 19 13:48:45 UTC 2008
Tom Diehl <tdiehl at rogueind.com>

On Tue, 19 Aug 2008, ABBAS KHAN wrote:

> I'm adding the default gateway to the route through "route add default gw
>" 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?

There are several ways, actually.

System-config-network is one way, or if like me you prefer to edit the config
files by hand you can edit the files in /etc/sysconfig/network-scripts/ifcfg-eth*
or the file /etc/sysconfig/network. There needs to be a GATEWAY= line in one of
those files. If you have an existing GATEWAY line modify it to taste. If you
have no default gateway I would suggest putting it in /etc/sysconfig/ifcfg-eth?.
Where the ? corresponds to the interface that points to the gateway.

Hope this helps.


Tom Diehl		tdiehl at rogueind.com		Spamtrap address mtd123 at rogueind.com