LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-29-2013, 01:26 PM   #1
compix
LQ Newbie
 
Registered: Jan 2013
Distribution: CentOS
Posts: 17

Rep: Reputation: Disabled
Two NIC Setup - Unable to route via one of them.


Hi Folks,

I am not a network expert but not a newbie either, I am having an interesting issue.

I have just setup a machine which got two NICs, one for private network and the other one for public network which has a real IP assigned to it.

Configuration of eth0 for private network as follows;

Code:
DEVICE=eth0
HWADDR=XXX
TYPE=Ethernet
UUID=XXX
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=172.26.111.131
NETMASK=255.255.255.128
GATEWAY=172.26.111.129
Configuration of eth1 for public network as follows;

Code:
DEVICE=eth1
HWADDR=XXX
TYPE=Ethernet
UUID=XXX
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=none
IPADDR=PUBLIC_IP
NETMASK=255.255.255.248
GATEWAY=PUBLIC_GATEWAY
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         PUBLIC_GATEWAY   0.0.0.0         UG    0      0        0 eth1
PUBLIC_NETWORK_ID   *               255.255.255.248 U     0      0        0 eth1
link-local      *               255.255.0.0     U     1002   0        0 eth0
link-local      *               255.255.0.0     U     1004   0        0 eth1
172.26.111.128  *               255.255.255.128 U     0      0        0 eth0
I am sure this is quite easy to achieve. I have searched about this, tried lots of ways(tried using route file, command) but somehow could not get this working. The machine still tries to route private IPs via public gateway.

I would appreaciate any ideas on this. Where I am wrong at?

TIA.
 
Old 04-29-2013, 09:11 PM   #2
KinnowGrower
Member
 
Registered: May 2008
Location: Toronto
Distribution: Centos && Debian
Posts: 341

Rep: Reputation: 34
It is not clear what you want to achieve?. Can you clarify?
 
Old 04-30-2013, 03:43 AM   #3
compix
LQ Newbie
 
Registered: Jan 2013
Distribution: CentOS
Posts: 17

Original Poster
Rep: Reputation: Disabled
Hi KinnowGrower,

I just want to be able to access 172.26.111.128/25 via eth0. At this time, with this setup, I even cannot ping gateway.

Thanks.
 
Old 04-30-2013, 03:16 PM   #4
coal-fire-ice
Member
 
Registered: Nov 2004
Location: SE England
Distribution: Debian, SUSE, Ubuntu, Slackware
Posts: 147

Rep: Reputation: 15
The private network has a gateway between your system and the other hosts on the private segment? If you're sure it does perhaps we need more info. Otherwise:

I'm not 100% familiar with the centos method of configuring networks, but in debian based systems to achieve what you describe i would omit the gateway entry of the private network config as it will confuse the routing, especially if that gateway doesn't lead out onto the wider internet. Assuming your system's private nic is on the same subnet (172.26.111.129-254 i assume) as the systems you are trying to talk to there is no requirement for a gateway because all hosts should be able to talk directly to each other via a switch or such (unless your actual situation is more complex than that you describe).


If there really is a gateway - well - normally gateways are used to bridge networks, i.e. a gateway would be between your internal network and the external network (internet) - To quote wikipedia:
Quote:
On an IP network, clients should automatically send IP packets with a destination outside a given subnet mask to a network gateway. A subnet mask defines the IP range of a private network. For example, if a private network has a base IP address of 192.168.0.0 and has a subnet mask of 255.255.255.0, then any data going to an IP address outside of 192.168.0.X will be sent to that network's gateway. While forwarding an IP packet to another network, the gateway might or might not perform Network Address Translation.
Anyway, hope the info helps. If you want to discuss, pm me and we can sort something out.

Last edited by coal-fire-ice; 04-30-2013 at 03:24 PM. Reason: more info to add
 
Old 04-30-2013, 05:19 PM   #5
compix
LQ Newbie
 
Registered: Jan 2013
Distribution: CentOS
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by coal-fire-ice View Post
The private network has a gateway between your system and the other hosts on the private segment? If you're sure it does perhaps we need more info. Otherwise:

I'm not 100% familiar with the centos method of configuring networks, but in debian based systems to achieve what you describe i would omit the gateway entry of the private network config as it will confuse the routing, especially if that gateway doesn't lead out onto the wider internet. Assuming your system's private nic is on the same subnet (172.26.111.129-254 i assume) as the systems you are trying to talk to there is no requirement for a gateway because all hosts should be able to talk directly to each other via a switch or such (unless your actual situation is more complex than that you describe).


If there really is a gateway - well - normally gateways are used to bridge networks, i.e. a gateway would be between your internal network and the external network (internet) - To quote wikipedia:


Anyway, hope the info helps. If you want to discuss, pm me and we can sort something out.
Thanks very much for the thoughts!

LOL, this all was my fault. I was trying to ping/trace a host that indeed does not exist at all. No IP was assigned to router's interface and I was trying to ping that IP which supposed to be the IP of router and was thinking as if the machine was not routing the packets properly.

Here's some personal explanation;

I was trying to get this internal gateway working because I was trying to get this machine communicating with other internal subnets(different) inside a large internal network. However, after all these I now understand this better. Static routes are what we need in such situations. No need for a second gateway for the second interface - instead, a static route can be defined to route specific subnets via a specific router as long as the machine itself has an IP inside that subnet(the subnet where router resides).

But I think it would be better to have an option to have a second gateway with a higher metric for redundancy? I am sure this can be achieved with some work arounds but not sure if Linux supports this natively?

Lessons learned.

Thanks everyone!

Last edited by compix; 04-30-2013 at 05:32 PM. Reason: typo.
 
  


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 config route from nic B>C so A can talk to D borgy95 Linux - Networking 13 09-28-2012 07:24 AM
2 NIC's - one gateway, setup Static route to Host baba_jaga Linux - Newbie 1 04-14-2009 02:05 PM
Adding a route for use with 2 NIC Roverius Linux - Networking 3 02-18-2008 06:43 AM
unable to route with ip alias using one NIC simayi Linux - Networking 0 10-27-2004 04:45 AM
Route a private LAN with 1 NIC freelinuxcpp Linux - Networking 4 11-01-2003 05:05 AM


All times are GMT -5. The time now is 10:08 AM.

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