Projects / gwswitch


gwswitch is a bash/ksh script to check a primary and a secondary gateway for availability, and update the routing tables in the event of a failure. It's useful for a small site that can afford two cheap connections, but is not big enough for multihoming with BGP.

Operating Systems

Recent releases

  •  04 Mar 2003 08:03

    Release Notes: This release allows for checking hosts other than the gateways themselves. 'route' and 'netstat' are used instead of 'iproute' for portability, and a 'dry-run' option was added. The program now verifies that route changing happens without error, and if not, rolls back to the previous gateway.

    •  03 Mar 2003 07:59

      No changes have been submitted for this release.

      Recent comments

      03 Mar 2003 08:31 netmask

      Re: a little too immature at this point

      Of course there are many places where BGP and OSPF aren't going to work.. My point of mentioning gated wasn't to setup your own complete BGP setup, or where you don't control the links.. but you can use it in such a way, to sort of fail over, without having to actually do a real bgp config.

      I agree with you completely, many hands make light work, and if it works, it works. I was just thinking there could be more to this, before being unleashed upon the FM community. At the very least, you actually put effort into design into shell scripts, you don't see that often.

      03 Mar 2003 06:47 wcooley

      Re: a little too immature at this point

      There are plenty of cases where BGP or OSPF are not feasible, particularly the case of where you don't control the gateways (such as from a DSL or fixed wireless link).

      You're right--it is a very simple piece of software. That is, I hope, its strength. Indeeed, you can do everything it does in Mon or Nagios. But if this is all you actually need it to do, these packages are a good deal more trouble to set up.

      Sure, nearly any experienced sys admin could have implemented this. But should he have to? The whole point of free software (other than the sheer joy of sharing) is to save time.

      03 Mar 2003 03:02 netmask

      a little too immature at this point

      This software seems to be exactly what article 198 covers. (

      This is a shell script.. that pings gateways, and changes to whichever host is up from cron. I'll grant you that you took the time to actually use shell functions, debugging, etc.. But, it doesn't change the fact this is a script that pings a host.. and changes gateway.

      The least you could do is add some sort of routing verification, to make sure the host you are pinging is actually a router (ie: Some user brought their workstation up with your routers IP address.. and you're getting ~50% packetloss on your cheap hub'd network, etc).

      But really.. for what you describe this project to be, a quick fail over application for people too lazy to setup BGP.. There are already dynamic routing applications out there that will do this.. gated for example :P

      Further.. if you are too lazy to setup bgp.. than one would assume you have different IP ranges on these multiple gateways you have.. unless you are NAT'd, how do you counter for that? Especially if this is on a server.. have your script cut over dns as well, on a zone with a TTL of 10 seconds? (Note: I didn't say I thought that was a good idea, I think that is a horrible idea, I was just saying..)

      I just think this 183 line script is a little immature for freshmeat at this point.


      Project Spotlight


      A Fluent OpenStack client API for Java.


      Project Spotlight

      TurnKey TWiki Appliance

      A TWiki appliance that is easy to use and lightweight.