Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

two etherports with two gateways

Posted on 2006-06-20
6
Medium Priority
?
210 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 2000 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

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

688 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