LinuxQuestions.org
Review your favorite Linux distribution.
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 06-24-2007, 03:52 PM   #1
antidelldude
Member
 
Registered: Jan 2005
Distribution: Fedora Core 3/Ubuntu (debian)
Posts: 103

Rep: Reputation: 15
Failsafe Internet Connection


I have a fedora core 5 server running shorewall as my firewall/router. I have two internet providers in my area, and lets face it, they both suck because they are always going out at the most unfortunate times, but they usually don't go out at the same time. I have a connection from each of them now. I need my server to see both connections and when one goes out I want the other one to take over. I DO NOT WANT LOAD BALANCING. Is this possible? Is there some type of software that I will need beyond shorewall? Thanks.
 
Old 06-24-2007, 04:03 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
how are the two connections presented to the box? if they are on two different nic's you could easily just run a ping to reach google.com by eth0 or by eth1 and either fails then that connection is taken out of the routing table. you can add two default routes with either same of different metrics, not a problem really. if they are two ip's on a common subnet, you can try simply routing two different known ip addresses down each connection, nad so trying to ping address 1 will test router 2, address 2 will test router 2.
 
Old 06-25-2007, 02:34 PM   #3
antidelldude
Member
 
Registered: Jan 2005
Distribution: Fedora Core 3/Ubuntu (debian)
Posts: 103

Original Poster
Rep: Reputation: 15
I have the two internet connections. They will be introduced as eth0 and eth1 plugged into their nic cards. What you explain is almost exactly what I want to do but I do not want 2 default routes because I don't want the second internet connection to be used when the first one is active, Because the second one is 4 times slower than my primary, but better than nothing when the primary is out. If I have to specify them as default routes and send traffic over them both, so be it. If thats the case, what you explain would be perfect, except I have to clue how to do it. I have never dove into this part of linux before .
Thanks.
 
Old 06-25-2007, 04:05 PM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
ok, well in actual fact you *do* want two default routes, but with different metrics. this way the lower metric route will always be used, but should a test fail, that route can be removed and naturally fall back to the higher metric route. so with eth1 as the backup link...
Code:
route add default gw 192.168.2.1 metric 10
route add default gw 192.168.1.1 metric 20
and then under a cron job something like
Code:
ping -I eth0 64.233.167.99 -c3 > /dev/null
if [ $? ] then 
  route del default gw 192.168.1.1 metric 0
else
  route add default gw 192.168.1.1 metric 0
fi
that's a very quick simplistic example, but hopefully it illustrates the example that if you can hit a google.com ip (obviously change for whatever you like...) then add a default route prefering that interface. if it fails, remove the route. one immediate shortcoming here is that there is no status quo in place you change the routing tables, so technically it'd be better to only change it if a difference is required, but a simple grep would do that.
 
  


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
Internet connection problems - connection times out Count_Cloppy Red Hat 4 02-22-2007 03:02 AM
Internet connection timeout on Fedora Core 5 using USB connection mike1111 Linux - Networking 0 07-23-2006 09:44 PM
Running Internet at bootup in failsafe or TERMINAL-mode only lennysokol Linux - Networking 1 05-16-2005 03:48 PM
Nic card -> cable internet modem no internet connection zeshan_b Mandriva 21 09-26-2004 11:48 AM

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

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

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