Solved

two etherports with two gateways

Posted on 2006-06-20
6
207 Views
Last Modified: 2013-12-23
I need some help here. I have a box running RH EP WS and I have two ethernet ports each connected to a different switch with different subnets.

eth1 - 192.168.1.62/24 gateway 192.168.1.1
eth0 - 192.168.2.10/24 gateway 192.168.2.254

I need requests on each port to use its own gateway when reponding, but they both seem to be using the same broadcast IP (the .1 network). I can hit out side addresses from the box--and then I bring down eth1--I cannot hit an outside address. In /etc/sysconfig/network-scripts I have a file for each address ifcfg-eth0 which looks like this:

DEVICE="eth1"
BOOTPROTO="none"
IPADDR=192.168.1.62
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
ONBOOT="yes"

DEVICE="eth0"
BOOTPROTO="none"
IPADDR=192.168.2.10
NETMASK=255.255.255.0
BROADCAST=192.168.2.254
ONBOOT="yes"

[]# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.2.0     *               255.255.255.0   U         0 0          0 eth0
192.168.1.0     *               255.255.255.0   U         0 0          0 eth1
169.254.0.0     *               255.255.0.0     U         0 0          0 eth1
default         192.168.1.1     0.0.0.0         UG        0 0          0 eth1

Can someone tell me how to get each to use it's own gateway? Please let me know if you need me to do any tests to see what is happening.

Thanks in advance.
Thom
0
Comment
Question by:td234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 1

Expert Comment

by:TomWu
ID: 16950509
An interface doesn't have a "gateway". What you have is a routing table which where to send data to.

A default gateway is just a route to all possible IP addresses for which you don't have a more specific route.

If you want to have two gateways, you can set them manually by doing the following:

route add default gw 192.168.1.1 metric 1
route add default gw 192.168.2.254 metric 10

I would recommend setting different metrics. This setting means that he will send all traffic except the connected to 192.168.1.1.

If he is unable to reach 192.168.1.1 because that interface is down, he will switch over to the second default gateway.



0
 
LVL 2

Author Comment

by:td234
ID: 16952235
Thanks for correcting my naming. I have deduced that I and trying to set my "persistent static routes".  I do not believe your example will set them on a per interface level unless I am missing somthing. I need eth1 to use 192.168.1.1 and eth0 to use 192.168.2.254.

I found this: http://kbase.redhat.com/faq/FAQ_79_2561.shtm
Which tells me to set up "route-ethX" files for each interface. I have tried that, but still get this:

# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
169.254.0.0     *               255.255.0.0     U     0      0        0 eth1
default         192.168.1.1     0.0.0.0         UG    0      0        0 eth1

Any other ideas?

Thanks Thom
0
 
LVL 1

Expert Comment

by:TomWu
ID: 16968406
No, my setup will not set them on a "per interface level". But that is not possible.

Suppose you have a package you want to send to 10.10.10.10.

What your system does is look into the routing table:
 1- Is there a directed connected network which has this IP adress. No.
 2- What is the MOST specific route (10.10.10.0/24 has presedence over 0.0.0.0/0 (the default route)) in my routing table to this IP address. If you have only specified a default route, he will take that one.
 3- If there is more than one route which are equally specific, take the one with the lowest metric.

Once you got a route he will send the traffic to the next hop. It is only at that stage that the computer decides to send traffic to a specific interface: he'll send it to the interface where the gateway he wants to use is located.


Can you explain the reason why you want two default gateways ? If it is because you want to build in redundancy, my suggestion will work.  If it is because you want to send some data one direction, the other the other way, you need to make a different routing table. But maybe there is another reason ?

Tom










0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 17026173
> I need eth1 to use 192.168.1.1 and eth0 to use 192.168.2.254.
that's already done by the netroute for each subnet, just the default route gows to 192.168.1.1
So what exactly is your problem?
0
 
LVL 16

Expert Comment

by:Hanno P.S.
ID: 17249296
As stated before: You cannot connect specific routers to specific interfaces.
Routing always tries to find the best suited path and therefore which interface to send packets out.
If you want to be able communicating still when any one interface is down, you will have to add two default gateways. Usually, when taking an interface down, the corresponding route(s) should get removed with it. (Linux doesn't do this?)
0
 
LVL 5

Expert Comment

by:jeffkell
ID: 17257779
If there are "intelligent" routers on the subnets, you might have them advertise routes and use the 'gated' or 'routed' daemons to load your routing tables dynamically.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
When it comes to security, there are always trade-offs between security and convenience/ease of administration. This article examines some of the main pros and cons of using key authentication vs password authentication for hosting an SFTP server.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question