LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 08-22-2008, 03:13 AM   #1
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Rep: Reputation: 15
How to add the permanent route in linux fedora core 6


Hi All

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?

Thx.
 
Old 08-22-2008, 07:58 PM   #2
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
1. are you using DHCP
2. where in the table are you adding the hop
3. did you try changing the config files.
 
Old 08-23-2008, 05:17 AM   #3
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Original Poster
Rep: Reputation: 15
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
203.188.239.0 * 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 203.188.239.1 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.

Thx.

Last edited by cmx08; 08-23-2008 at 05:18 AM.
 
Old 08-23-2008, 01:31 PM   #4
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
hi pal

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.
 
Old 08-27-2008, 08:11 AM   #5
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Original Poster
Rep: Reputation: 15
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?

Last edited by cmx08; 08-27-2008 at 08:34 AM.
 
Old 08-27-2008, 01:04 PM   #6
keratos
Member
 
Registered: May 2007
Location: London, UK.
Distribution: Major:FC8. Others:Debian;Zenwalk; Arch; Slack; RHEL.
Posts: 544

Rep: Reputation: 30
hang on , I'm talking SHITE

the file for static routing is in:

/etc/sysconfig/network-scripts/route-<interface>

where <interface> is your net physical device, e.g. eth0 , so

/etc/sysconfig/network-scripts/route-eth0

a sample static route where:
a) default gateway is 192.168.0.1 via interface eth0
and
b) static route for 10.10.10.0/24 subnet via the default gateway

would look like
Code:
default 192.168.0.1 dev eth0
10.10.10.0/24 via 192.168.0.1 dev eth0
( you may have to restart networking , i.e. /etc/init.d/network restart )

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

Last edited by keratos; 08-27-2008 at 01:06 PM.
 
Old 08-27-2008, 11:29 PM   #7
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Original Poster
Rep: Reputation: 15
Thx a lot.
 
Old 09-01-2010, 12:00 PM   #8
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Original Poster
Rep: Reputation: 15
Smile

Example for route

Quote:
[root@mahkamah ~]# cd /etc/sysconfig/network-scripts/
[root@mahkamah network-scripts]#
[root@mahkamah network-scripts]# less route-eth1
[root@mahkamah network-scripts]#
Quote:
0.0.0.0/0 via 192.168.100.235
192.168.100.24/30 via 192.168.100.235
192.168.100.28/30 via 192.168.100.235
192.168.100.32/30 via 192.168.100.235
192.168.100.36/30 via 192.168.100.235
192.168.100.40/30 via 192.168.100.235
192.168.100.44/30 via 192.168.100.235
192.168.100.48/30 via 192.168.100.235
192.168.100.52/30 via 192.168.100.235
192.168.100.56/30 via 192.168.100.235
192.168.100.60/30 via 192.168.100.235
192.168.100.64/30 via 192.168.100.235
192.168.100.68/30 via 192.168.100.235
192.168.100.72/30 via 192.168.100.235
10.254.100.0/24 via 192.168.100.235
10.254.21.0/24 via 192.168.100.235
10.254.23.0/24 via 192.168.100.235
10.254.31.0/24 via 192.168.100.235
10.254.32.0/24 via 192.168.100.235
10.254.22.0/24 via 192.168.100.235
10.254.13.0/24 via 192.168.100.235
10.254.12.0/24 via 192.168.100.235
10.254.11.0/24 via 192.168.100.235
10.254.10.0/24 via 192.168.100.235
10.254.9.0/24 via 192.168.100.235
10.254.8.0/24 via 192.168.100.235
10.254.6.0/24 via 192.168.100.235
10.254.5.0/24 via 192.168.100.235
10.254.4.0/24 via 192.168.100.235
10.254.3.0/24 via 192.168.100.235
10.254.2.0/24 via 192.168.100.235
10.254.1.0/24 via 192.168.100.235
10.254.7.0/24 via 192.168.100.235
10.254.50.0/24 via 192.168.100.235
#192.168.100.52/30 via 192.168.100.249
#192.168.100.24/30 via 192.168.100.249
#192.168.100.72 via 192.168.100.249




route-eth1 (END)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make route permanent rust8y Solaris / OpenSolaris 9 12-10-2007 04:10 AM
Permanent static Route on fedora cora 5 niurkin69 Linux - Networking 2 09-22-2006 03:56 PM
I am not able to add a new route to my route table using route command prashanth s j Linux - Networking 2 09-03-2005 04:34 AM
Adding persistent(permanent) route entries on Red hat Linux 7.1 sram Linux - Networking 1 02-08-2002 10:07 AM


All times are GMT -5. The time now is 08:41 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration