Operating System - Linux
1827855 Members
2096 Online
109969 Solutions
New Discussion

Permamanently Add a route to the kernels IP routing table

 
SOLVED
Go to solution

Permamanently Add a route to the kernels IP routing table

I (a newbie) can add a default route to the kernels IP routing table by issuing:
route add default eth0

The change only lasts up until the next boot. How can I permanently add the route to kernels IP routing table?

ANy help would be appreciated.
4 REPLIES 4
Stuart Browne
Honored Contributor

Re: Permamanently Add a route to the kernels IP routing table

There are a number of ways to do it, and some of them depend on the distribution you are using.

As you are wanting to change the default route, there's always a nice way to do it.

On a RedHat system, you modify the 'GATEWAY=' line in '/etc/sysconfig/network' for instance.

On all distributions, you'll have some sort of network manager which will give you a GUI to do it as well.

If all else fails, you can add your 'route add' line to '/etc/rc.d/rc.local'. This is the least maintainable method however, as no system utilities know of it.
One long-haired git at your service...

Re: Permamanently Add a route to the kernels IP routing table

Hi Stuart,
I'm trying to add a default route. The Route command lists no default route. I'm using REd Hat Linux.

Thanks,
Alex
skt_skt
Honored Contributor

Re: Permamanently Add a route to the kernels IP routing table


did u try ading some thing similar to this and restart the network service.
# cat network
NETWORKING=yes
HOSTNAME=xxx.com
GATEWAY=132.226.184.254

Alexander Chuzhoy
Honored Contributor
Solution

Re: Permamanently Add a route to the kernels IP routing table