1827791 Members
2618 Online
109969 Solutions
New Discussion

routing table

 
Cheung_2
Frequent Advisor

routing table

I would like to set the routing table , what file should be modify ? Thx.
Andy
2 REPLIES 2
Stuart Browne
Honored Contributor

Re: routing table

Depends whether you want to do it the simple way, or the distribution-specific-way (which isn't always so simple).

Simple Way: using rc.local:

add your 'route add -...' entries to /etc/rc.d/rc.local. They will get executed upon startup.

Dist-specific way:

As you've not mentioned what distribution you're using, I'll tell you the redhat way (other distributions do differ slightly).

Modify the file '/etc/sysconfig/static-routes'

Add entries in there to the format:



i.e.

eth0 net 192.168.27.0 netmask 255.255.255.0 gw 192.168.18.3

For RedHat, you can read /usr/share/doc/initscript-*/sysconfig.txt for more details.

For other distributions, I'm unsure how you'd do it, as I've only used modern versions of RedHat in the past 2-3 years.
One long-haired git at your service...
Mangus Määttä
Occasional Advisor

Re: routing table

or you could make a shell script with your route commands make it run the shell script on startup.

That works on all distributions.

Most of the times the service scripts are in /etc/init.d or /etc/rc.d/init.d. You can take a look at the others also, but you only need a simple script which just runs a bunch of route commands for you.

Then ln -s /etc/init.d/yourscript /etc/rc3.d/S99yourscript

Change rc3.d to your default runlevel. You can get your default runlevel by boting up your system and running runlevel. That will print something like: N 2

PHP5 QA | magnus@php.net | If I tell you that I don't know, I either don't know or I am to lazy to answer.