LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 08-01-2007, 10:58 PM   #1
Ammad
Member
 
Registered: Apr 2004
Distribution: redhat 9.0, fc4, redhat as 4
Posts: 522

Rep: Reputation: 31
multiple routes


i have to Internet connections, i want set it like if one (ISP) goes down, all traffic redirect to another link (ISP).
for this, i have an idea to ping yahoo and google after 5 minutes interval, if both response "request time out" then my script will delete default gateway of ISP-1 and add default gateway to ISP-2.

i am confuse how do i set answer from ping of yahoo/google is down .

or
Any one knows best than this to set failover link.
 
Old 08-02-2007, 12:49 AM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by Ammad
i am confuse how do i set answer from ping of yahoo/google is down .
If none of the ping attempts work, ping will return a non-zero exit code. So you could:

Code:
if ! ping -c 1 yahoo.com &> /dev/null  && ! ping -c 1 google.com &> /dev/null; then

#   add your routing changes here

fi
Make sure you limit the number of ping attempts with the -c option, or the ping command will never terminate.

Quote:
or
Any one knows best than this to set failover link.
I think there is a better way to do this, but it is beyond my knowledge.
 
Old 08-02-2007, 01:17 AM   #3
vjn
LQ Newbie
 
Registered: Jul 2007
Posts: 12

Rep: Reputation: 0
Hi,

you can add both ISP ip in your linux box as a gateway.So if one will down the packet will go second ISP ip addr.


Vijayan
Team Safesquid
 
Old 08-03-2007, 07:52 PM   #4
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
Quote:
Originally Posted by Ammad
i have to Internet connections, i want set it like if one (ISP) goes down, all traffic redirect to another link (ISP).
for this, i have an idea to ping yahoo and google after 5 minutes interval, if both response "request time out" then my script will delete default gateway of ISP-1 and add default gateway to ISP-2.
hi,

i think you are doing it too much,
just do like vjn said - but with 1 of the gateway metric set higher.

like 0/0 dev eth1 metric 1 and the other 0/0 dev eth2 metric 10.

this will activate both gateway but - 1 will be passive until something trigger it to active.

HTH.
 
  


Reply



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
multiple default routes for dual nics alfman Linux - Networking 1 05-26-2006 09:26 AM
Routes Obie Linux - Networking 16 04-28-2005 10:15 PM
routes himyuza *BSD 6 08-03-2004 10:41 AM
I need some routes |Drakehash| Linux - Networking 1 06-07-2003 02:36 PM
Multiple routes DavidPhillips Linux - Networking 2 12-03-2001 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:00 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration