Solved

two etherports with two gateways

Posted on 2006-06-20
6
205 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
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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 Schröder
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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Martian Packets Unix 5 54
Expanding Subnet Mask 20 112
VPS for routing recomendations 3 51
paypal ipn status 4 47
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.
I had an issue with InstallShield not being able to use Computer Browser service on Windows Server 2012. Here is the solution I found.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

831 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