Solved

two etherports with two gateways

Posted on 2006-06-20
6
197 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
Comment Utility
> 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
Comment Utility
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
Comment Utility
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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

What is IRC? IRC (Internet Relay Chat) is a form of communication between multiple users. It is available freely to anyone with inernet access. IRC is a great way to communicate with others e.g. There is an IRC channel for Ubuntu Linux, which is fo…
Lets look at the default installation and configuration of FreeProxy 4.10 REQUIREMENTS 1. FreeProxy 4.10 Application - Can be downloaded here (http://www.handcraftedsoftware.org/index.php?page=download) 2. Ensure that you disable the windows fi…
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…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now