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 05-23-2014, 10:15 AM   #1
HuMan-BiEnG
Member
 
Registered: Jun 2010
Posts: 92

Rep: Reputation: 15
Question linux router static route configuration help


Hello there,

i have a virtual VM oracle centos 6 server with two NICs :

1) eth0
- have the following characteristics :
IP : 10.0.2.15
network : 10.0.2.0/24
gateway : 10.0.2.2

2) eth1
- have the following characteristics :
IP : 192.168.3.1
network : 192.168.3.0/24
gateway : 10.0.2.15

the server is used to act as a router
i have setup nat within firewall

now i want to set a static route which will do the following :
1) make default gateway 10.0.2.2 (connected to internet)
2) route traffic for 192.168.3.0/24 on eth1 within eth0 using the gateway 10.0.2.2

which files that could be configured ("route-eth0" or "route-eth1") ? & how it should be configured ?

should i have to configure "route-eth1" to be :
192.168.3.0/24 via 10.0.2.15 dev eth1
or i should edit it to be :
192.168.3.0/24 via 10.0.2.2 dev eth1

any help will be apreatiated,,
thanks

Last edited by HuMan-BiEnG; 05-23-2014 at 10:32 AM.
 
Old 05-23-2014, 01:10 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You set the default gateway by adding it to /etc/sysconfig/network (and remove for /etc/sysconfig/network-scripts/ifcfg-* files).
GATEWAY=10.0.2.2

In /etc/sysconfig/network-scripts create route-eth1 and input the following line:
192.168.3.0/24 via 192.168.3. dev eth1

Run "service network restart" to bounce networking.

Run "netstat -rn" before and after to see your routing table.
 
Old 05-24-2014, 05:30 AM   #3
HuMan-BiEnG
Member
 
Registered: Jun 2010
Posts: 92

Original Poster
Rep: Reputation: 15
Lightbulb

Quote:
Originally Posted by MensaWater View Post
You set the default gateway by adding it to /etc/sysconfig/network (and remove for /etc/sysconfig/network-scripts/ifcfg-* files).
GATEWAY=10.0.2.2

In /etc/sysconfig/network-scripts create route-eth1 and input the following line:
192.168.3.0/24 via 192.168.3. dev eth1

Run "service network restart" to bounce networking.

Run "netstat -rn" before and after to see your routing table.
Hello MensaWater
thanks man for your kind cooperation
sorry i forget to say that i have already set "GATEWAY=10.0.2.2" in "/etc/sysconfig/network" file
also i have add a route in "route-eth0" with the following :
192.168.3.0/24 via 10.0.2.15 dev eth0
then "Reboot" for the microwave meaning the server then it works very good

below is a simple diagram for the required server network :
Code:
Internet ==> Eth0 (10.0.2.0/24) <====> Eth1 (192.168.3.0/24)
where : 10.0.2.2 is the default gateway for server, while default gateway for 192.168.3.0/24 is 10.0.2.15 (IP address of eth0)
i have tried to configure "route-eth1" but i always get error messages when restarting network service, while it was configured to :
192.168.3.0/24 via 10.0.2.15 dev eth1
i think (but not sure yet) that the file refuse to save/use an ip address which doesnt belongs to the interface or subnetwork

anyway its working now as expected
please accept my best regards,,

Last edited by HuMan-BiEnG; 05-24-2014 at 09:26 AM.
 
  


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
[SOLVED] How to add a static route to wired router without dropping wifi internet. captdavid1949 Linux - Networking 1 04-18-2013 07:53 PM
seeking help with "static route" configuration (Ubuntu) SaintDanBert Linux - Networking 4 06-25-2010 08:58 PM
Static Route - Linksys WRT54GL to Ubuntu Set up as a router mossy464 Linux - Networking 2 05-19-2010 02:03 PM
static route configuration guide bholler Linux - Networking 4 05-20-2005 12:21 PM
Static route to a router? Milkman00 Linux - Networking 9 02-09-2003 11:11 AM

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

All times are GMT -5. The time now is 10:04 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