How to add the permanent route in linux fedora core 6
Can any body tell me how to add the permanent route in linux fc6. I add the route by using the route command but after the server restart all the route table gone. This is very troublesome for me. Which file i should go to add the permanent route?
1. are you using DHCP
2. where in the table are you adding the hop
3. did you try changing the config files.
1st thx for reply. I not using DHCP. I add the static route by directly type the route command for example:
[root@localhost ~]# route add -net 10.1.40.0 netmask 255.255.254.0 gw 192.168.102.40
[root@localhost ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
220.127.116.11 * 255.255.255.192 U 0 0 0 eth0
192.168.102.0 * 255.255.255.0 U 0 0 0 eth1
192.168.10.0 192.168.102.40 255.255.255.0 UG 0 0 0 eth1
10.1.40.0 192.168.102.40 255.255.254.0 UG 0 0 0 eth1
169.254.0.0 * 255.255.0.0 U 0 0 0 eth1
default 18.104.22.168 0.0.0.0 UG 0 0 0 eth0
My question is which file should I go to add the permanent route to prevent the route table gone after the server reboot? This route table will gone after I restart the server. I am still new in using Linux so I don't know which file should I refer to add permanent route.
there is not config file (i.e something in /etc/???) for route
there are several options however to embed your route command in a startup file.
perhaps the best is in /etc/init.d/rc.local which is run at each system startup.
just add your route command to the end of the file
other files that could be modified are /etc/sysconfig/network-scripts/* , /etc/login /etc/bash_rc and so on and alike however linux etiquette kind of discourages this, rc.local is the "defacto" system startup tweak.
Hi. Thx for help. Its working fine now. One more question after I add the route in etc/rc.local, can I run the rc.local without reboot the machine?
hang on , I'm talking SHITE
the file for static routing is in:
where <interface> is your net physical device, e.g. eth0 , so
a sample static route where:
a) default gateway is 192.168.0.1 via interface eth0
b) static route for 10.10.10.0/24 subnet via the default gateway
would look like
Warning! If you use the Network Manager GUI then it *may* overwrite the above, thats why I suggested rc.local
To run any of the startup scripts just "use" it , i.e. issue the command /etc/init.d/rc.local to run rc.local without rebooting) !!! Easy
Thx a lot.
Example for route
|All times are GMT -5. The time now is 10:51 AM.|