LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 06-28-2012, 09:37 AM   #1
karim.wallani
LQ Newbie
 
Registered: Jun 2012
Posts: 8

Rep: Reputation: Disabled
CentOS 6 - Persistent Static Route


I am using CentOS 6, and I have two network cards on my machine. After asking friends, I have figured out that I need to make my routing table look like this:

Code:
Destination      Gateway       Genmask            Flags   MSS    Window   irtt   Iface
111.68.222.48    0.0.0.0       255.255.255.240    U       0      0        0      eth1
10.1.8.0         0.0.0.0       255.255.255.0      U       0      0        0      eth0
10.0.0.0         10.1.8.1      255.0.0.0          UG      0      0        0      eth0
0.0.0.0          111.68.222.49 0.0.0.0            UG      0      0        0      eth1
In order to make this routing table persistent, I know I need to create the following two files:

1. /etc/sysconfig/network-scripts/route-eth0
2. /etc/sysconfig/network-scripts/route-eth1

But what goes in each of these two files? Please help.
 
Old 06-28-2012, 09:42 AM   #2
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
Why not just add the commands you need to rc.local, or a crontab that uses @boot?
 
Old 06-28-2012, 09:49 AM   #3
karim.wallani
LQ Newbie
 
Registered: Jun 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Well, CentOS documentation (http://www.centos.org/docs/5/html/5....ic-routes.html) says to use /etc/sysconfig/network-scripts/route-ethX files, where X is the interface #.
 
Old 06-28-2012, 09:51 AM   #4
karim.wallani
LQ Newbie
 
Registered: Jun 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
I was thinking about putting the following:

In route-eth0:

ADDRESS0=10.1.8.0
GATEWAY0=0.0.0.0
NETMASK0=255.255.255.240
ADDRESS1=10.0.0.0
GATEWAY1=10.1.8.1
NETMASK1=255.0.0.0

In route-eth1:

ADDRESS0=111.68.222.48
GATEWAY0=0.0.0.0
NETMASK0=255.255.255.240
ADDRESS1=0.0.0.0
GATEWAY1=111.68.222.49
NETMASK1=0.0.0.0

Am I on the right track, or have I totally missed the mark???
 
Old 06-29-2012, 08:09 AM   #5
grim76
Member
 
Registered: Jun 2007
Distribution: Debian, SLES, Ubuntu
Posts: 308

Rep: Reputation: 50
Ok unless I am missing something:

Code:
ADDRESS0=10.1.8.0
GATEWAY0=0.0.0.0
NETMASK0=255.255.255.240
Doesn't make sense to add when you have:

Code:
ADDRESS1=10.0.0.0
GATEWAY1=10.1.8.1
NETMASK1=255.0.0.0
Your route-eth1 to me does not make any sense. I would think it would be something like this

Code:
ADDRESS0=111.68.222.48
GATEWAY0=111.68.222.49 (if that is the actual GW provided by your ISP/Provider)
NETMASK0=255.255.255.240
I may be missing something, but that is what I am seeing here.
 
Old 06-29-2012, 04:42 PM   #6
karim.wallani
LQ Newbie
 
Registered: Jun 2012
Posts: 8

Original Poster
Rep: Reputation: Disabled
Grim76, you're right, of course. It doesn't make sense to have this:

Code:
ADDRESS0=10.1.8.0
GATEWAY0=0.0.0.0
NETMASK0=255.255.255.240
when I have this:

Code:
ADDRESS1=10.0.0.0
GATEWAY1=10.1.8.1
NETMASK1=255.0.0.0
That's a typo on my part. route-eth0 is supposed to be this:

Code:
ADDRESS0=10.1.8.0
GATEWAY0=0.0.0.0
NETMASK0=255.255.255.0
ADDRESS1=10.0.0.0
GATEWAY1=10.1.8.1
NETMASK1=255.0.0.0
As to the second comment, 111.68.222.49 is the gateway provided to me. I want to make this my default gateway. How can I do it?
 
  


Reply



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
CentOS 6 - Persistent Static Route karim.wallani Linux - Newbie 4 05-24-2013 08:52 AM
persistent static route ANU Linux - Networking 5 04-01-2012 07:23 PM
persistent static routes, not so persistent Hewson Linux - Networking 4 04-27-2007 05:09 PM
How does one make a static route persistent in AIX? artasse AIX 2 11-22-2006 02:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:13 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration