LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 09-03-2012, 11:20 AM   #1
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Rep: Reputation: 0
Two gateways on eth0 how to do this


Ok, so the similar threads didn't really help me on this one, so once again Dear LQ Users, I'm asking for your advice on this matter.

Scenario:
=========
We've got some servers in a datacentre. These are behind a firewall. They are happy. There are no problems.

We now have a load balancer for certain servers. This is requesting that it is the gateway. This is fine for everything that addresses the servers via the load balancers but in the event that the load balancer fails or becomes decommissioned for any particular reason, then we need to be able to automatically route via the firewall.

Is it therefore possible to have something that says

Code:
route_eth0="default via 10.x.x.80 alternate via 10.x.x.4"
or similar? I'm guessing that you need to use metrics here to weight the direction the traffic takes. Bear in mind that all these servers have only ONE ethernet card. Anything else you need to know, please do ask.

Thanks in Advance for any/all assistance rendered.
Marcus
 
Old 09-03-2012, 01:25 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,028
Blog Entries: 5

Rep: Reputation: 790Reputation: 790Reputation: 790Reputation: 790Reputation: 790Reputation: 790Reputation: 790
I don't think so and I don't see how it would work anyway at host level. Typically if you're on a load balancer the reason they want the gatweway changed is because you're directly connected (or switched) to the load balancer. Which is to say if the load balancer is down your traffic is going to fail as you've already surmised because it has no other route. To route around the load balancer would be a switch change (or physical connection change if direct connected) rather than a host level change.

What we do instead is we keep two separate NICs at host level. One routes through the load balancer and the other routes through our normal "internal" network. Even when we have internal facing load balancers we do this.
 
1 members found this post helpful.
Old 09-03-2012, 01:39 PM   #3
Celyr
Member
 
Registered: Mar 2012
Location: Italy
Distribution: Slackware+Debian
Posts: 314

Rep: Reputation: 77
i would suggest you to do:

Code:
do
 sleep 1
 if (default gateway is reachable) and not (on backup)
   do nothing
 if (default gateway is not reachable) and not (on backup)
   change route to backup gw
 if (default gateway is reachable) and (on backup)
   change route to default gw
 if (default gateway is not reachable) and not (on backup)
   do nothing

while true
It may look a bit quirky but i think it's the easiest solution
 
Old 09-07-2012, 07:55 AM   #4
MarcusWebb1966
Member
 
Registered: Mar 2011
Posts: 58

Original Poster
Rep: Reputation: 0
Just to let you know:

Whilst Celyr's method would work in principle, I've come round to MensaWater's way of thinking, and cannot see a benefit to providing multiple gateways.

Thanks to all who read and all you who answered so thoughtfully.
 
  


Reply

Tags
eth0, gateways, networking


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
vnStat - if pointed to eth0 will it aggregate eth0 and eth0:1 alias stardotstar Linux - Networking 0 07-20-2010 08:49 PM
Two gateways? candyman123 Linux - Networking 1 09-08-2005 01:36 PM
Gateways Esmo2000 Linux - Networking 1 01-03-2005 03:49 PM
2 Gateways Equis Linux - Networking 1 11-15-2003 04:58 AM
2 Gateways def1014 Linux - Networking 3 10-24-2002 06:21 PM


All times are GMT -5. The time now is 08:44 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration