Question

Two NICs and two Gateways in parallel possible?

Asked by: spriebe

Hi!

I've a server with two NICs each connected to a seperate LAN.

For example:
eth0: 192.168.0.0/24
eth1: 10.0.0.0/24

At the moment i've only set up ONE default getway like this:
0.0.0.0         10.0.0.1    0.0.0.0         UG    0      0        0 eth1

But when now a paket comes in on eth0 from for example 192.168.10.5 it tries to route it back through the default getway of eth1. But i want to archieve, that it routes it through another defaultgateway for eth0.

So traffic from eth0 should go to the defaultgw for eth0 and traffic from eth1 should go through the default gateway of eth1. Is this possible? Any other ideas? I don't want to setup an ip for each LAN on eth0.

Thanks!

Stefan

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2009-11-05 at 00:17:42ID24873694
Tags

linux

,

kernel

,

network

,

debian

Topics

Linux Networking

,

Miscellaneous Networking

,

Debian Linux

Participating Experts
4
Points
0
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. No eth0 && eth1 at boot???
    Yesterday, I installed RH 7.2, and configured the adsl-modem. I shutdown the system, and when I rebootted it this morning ther were no network interfaces available(eth0 / eth1). While trying to find out the problem I noticed that both IRQ's where set to 11 (I set them to 11 ...
  2. smoothwall red=eth1 green=eth0 switch around
    I have smoothwall up and running. I authinticate my computer on my ISP's network by my NIC card's MAC address. Unfortunatly the red interface is assigned to the wrong nic. red=eth1 green=eth0 S/B red=eth0 green=eth1 How can I change these around. Thanks for any help, AD
  3. Route and Mirroring : 2 servers with 2 ethernet cards on…
    Hello, I have 2 Identical servers (HP Proliant DL 140) with two integrated NIC card each (broadcom 5700), the network is as follow : - eth0 goes to a router wich is connected to the net. - eth1 is DIRECTLY connected with a single straight cable betweenn the 2 servers (no cr...
  4. eth1 missing!
    I have two nics in this box along with a Digium TDM800P and te120p (analog and digital telephony cards). eth0 works fine. The TE120P is showing up in hwconf as eth1, the tdm card is showing up as eth2. This is all well and good. I had eth1 as a realtek ethernet card, and it...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: lanboyoPosted on 2009-11-05 at 00:56:59ID: 25747689



This is somewhat difficult to do unless you know all of the networks that should go out thru eth0.

From the command line;

route add -net 192.168.10.0 netmask 255.255.255.0 gw 192.168.0.1

(assuming the gateway on eth0 is 192.168.0.1) will route traffic to the 192.168.10.0/24 network thru eth0.

route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.0.1

will route all of the 192.168 networks that way... Since these routes are more specific than the default route, they will get routed out eth0.


These route commands will need to be added every time the box boots up, so you will need to add them to rc.local or another appropriate startup config file.

If you do not know what devices will connect from eth0, then you may have to do some kind of trickiness to get it to work, like using a different device to do network address translation to make incoming traffic to look like it comes from the local interface connected to eth0.

 

by: spriebePosted on 2009-11-05 at 01:05:38ID: 25747729

mhm so linux cannot handle this problem? I thought it must be very simple to use default route for eth0 if traffic comes from eth0 and use default route from eth1 if traffic comes from eth1.

For what situation is then the dev eth0 / dev eth1 parameter in the route add command for default gateways?

 

by: spriebePosted on 2009-11-05 at 12:43:00ID: 25753790

Found the solution myself but in german on www.ubuntuusers.de

 

by: KeremEPosted on 2009-11-05 at 13:00:18ID: 25753967

Hi,

I guess you must be mistaken. In a system with 2 ethernet adapters the first will be in the 10.0.0.0/24 segment while the second will be in 192.16.0.0/24 segment. When you want to communicate with a system located in the 192.168.0.0 segment the communication will be performed over ethernet. Because the local interface si tattached to the 192.168.0.0 segment and it will discover the system on the same subnet via arp and will directly communicate with it. So it will never use eth1 for a response.

This is being said if you want two default gateways with the system you need to setup metric so that system knows which to use for internet access

you need to add:

route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.0.1 metric 10

Cheers,
K.

 

by: spriebePosted on 2009-11-05 at 13:24:35ID: 25754211

i don't know who you mean but but i was writing about 192.168.10.X.

Also this can be done by using advanced routing rules and iproute

 

by: lanboyoPosted on 2009-11-05 at 14:35:34ID: 25754855

I don't see how advanced routing works better than assigning static routes to a particular interface by destination. Using the iproute feature to have two 0.0.0.0/0 routes will make your outbound packet flow even less predictable, as the new routing table will probobally load share based on flows, and traffic will not go to a predictable interface. If you have more than 10 subnets that you are trying to route to, then you may well be better off using a routing ptotocol such as RIP or OSPF, but this is not "two default networks" by any means, and it implies that the routers on the network are exchanging routing information with the host.

 Please post what your final configurations look like though, I am interested.

 

by: chenry334Posted on 2009-11-06 at 18:27:01ID: 25764725

You should look into iproute2.  Basically you need to create multiple routing tables - then bind them to an eth interface.  Here is an example of a script I used to do this on a box I have long since retired....

ip route add table T1 192.168.0.0/24 dev eth0 src 192.168.0.50
ip route add table T1 default via 192.168.0.1 dev eth0
ip route add table T2 10.0.0.0/24 dev eth1 src 10.0.0.50
ip route add table T2 default via 10.0.0.1 dev eth1
ip rule add from 192.168.0.50 table T1
ip rule add from 10.0.0.50 table T2
ip route flush cache

 

by: spriebePosted on 2009-11-06 at 23:53:31ID: 25765378

thats the solution i already found on ubuntuusers wiki and it's working fine.

 

by: KeremEPosted on 2009-11-07 at 00:15:02ID: 25765423

The problem is:

Your adapters are these:

eth0: 192.168.0.0/24
eth1: 10.0.0.0/24

So since 192.168.10.x is out of the scope of both your interfaces it is obvious that your request to access 192.168.10.x will go to your default route. If you have an internal router that has an access 10 192.168.10.x network then you'll need to specify it through :

route add -net 192.168.10.0 netmask 255.255.255.0 gw 192.168.0.2

Otherwise the packets will go through you default network. As I've told earlier the Default Gateway is used whenever your host does not know how to access locally through interfaces. Though it is rather in your 192.168 side it does not mean that there's an automatic way for your sytem to discover that. So you need to specify iy manually. On the example above I am assuming that 192.168.0.2 is the router who has access to the 192.168.10.x network.

 Cheers,
K.

 

by: KeremEPosted on 2009-11-07 at 00:15:55ID: 25765424

In fact all you need is the addition of a oruting you don't need fancy packet routng algorithms for that.

 

by: KeremEPosted on 2009-11-08 at 13:33:56ID: 25772050

Hi,

The problem is that: The asker expects something fancy as an answer. But the truth is he is expecting something unusual and what happening is quite the normal for TCP/IP if he needs to send 192.168 traffic to somewhere outside of the default route all he needs is to add a routing entry. I believe I've tried to tell him about this situation in my postings.

Cheers,
K.

 

by: stephenhoekstraPosted on 2009-11-08 at 15:56:59ID: 25772632

Questioner wants incoming traffic to go out on the same interface it came in on, and for that he'll need policy based routing.  

That said, if he had only had a handful of other subnets, or just 192.168.10.0, it would probably be easier just to add static routes as you suggested.

Just my 2p..

 

by: chenry334Posted on 2009-11-09 at 20:42:49ID: 25782469

KeremeE - I think you misinterpreted what the OP asked.  He wants traffic to go to 192.168.10.0 (or any subnet for that matter) through the same interface that it came in on.  You can add a static route as you mentioned: "route add -net 192.168.10.0 netmask 255.255.255.0 gw 192.168.0.2" but now traffic coming from 192.168.10.0 into the eth1 (10.0.0.0/24) will go out eth0.  The OP wants it to go out eth1 in that case because it came in on eth1.

EE Admin: In fairness the author did post that he found his solution before anyone posted an answer for them so I imagine at least a partial refund would be fair.  They however didn't close the question afterwards - and it would have been nice if he had posted the solution that worked for him instead of just "found something"...

 

by: KeremEPosted on 2009-11-10 at 02:28:45ID: 25783999

chenry334: I did not misinterpret the question just thought that what the asker needs is to send intranet packet through the eth0 and the rest to the default gateway and suggested him a different approach. But unfortunately none of us experts could get futher feedback. IT seems that the asker has abondoned the question altogether.

 

by: KeremEPosted on 2009-11-14 at 12:37:07ID: 25822254

Hi,

I would always accept if the asker finds a solution working for him. But he should not forget thath he was the one asking a question and he should have explained it clearly what was the answer for hm and how did it work for him. This way of abandoning the question is just something against the EE code.

I'll suggest you close the question with points refunded. However  I'd also suggest you, the moderaotr, remind the asker about his responsibilities as an asker. If all questions had ended up like that no expert would like to answer any question thus this would kill EE.

Cheers,
K.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...