[H-GEN] Connecting to 2 ISPs one entirely just for theFreeZone, How?

Russell Stuart russell-humbug at stuart.id.au
Mon Sep 18 04:43:59 EDT 2006


On Thu, 2006-09-14 at 23:46 +1000, Crowy wrote:
> [ Humbug *General* list - semi-serious discussions about Humbug and     ]
> [ Unix-related topics. Posts from non-subscribed addresses will vanish. ]
> 
> Ok, seems I need to clarify a few things based on the questions from the
> replies, also reword a couple of things, I'll start by rewriting my original
> question minus the diagram :)
> 
> Background:
>  Current network setup is a IPcop box with a single ADSL connection through
> Wild Internet. We have a debian Squid Server on the LAN.
> 
> Main reason for adding second ISP:
>  Improve Pings in games, and give fast downloads of updates for said games.
> Hence the new ISP connection is a Bigpond Cable connection, but I only wish
> to allow free traffic on this connection as additional traffic is charged at
> 15c/MB

Sorry for the delay in replying.

Since you need to route general traffic it is easier to do this
at the IP packet level.

Step 1.
   Is to determine the LAN addresses you want to route via
  cable.  From your comments I assume you know how to do this.
  Since they are dynamic I would store them in a file.  To make
  parsing them easier I would put them one per line, like this:

  203.99.129.0/24
  199.26.128.0/17
  .. etc

Step 2.
  Is to write a script that runs whenever your cable connection
  comes up.  Point the "connectedprog" in /etc/bpalogin.conf to
  it.  This script has two jobs:

  a. Delete the default route created by dhclient when the cable
     connected, if it existed.

  b. Add the routes from the above file.

Here is an example script that does these two tasks.
This is just off the cuff - I have not run it.  It
should place a file in /tmp that logs what it did.
If it doesn't work email me that.

     #!/bin/bash
     set -e
     exec >/tmp/${0##*/}.trc 2>&1
     set -xv

     declare -r FREE_ADDRESS_FILE=/path/free_address_list
     declare -r CABLE_DEVICE=eth1
     declare -r CABLE_IP=$(
       ip addr show dev $CABLE_DEVICE | 
       sed --silent 's/.* inet \([^ ]*\) .*/\1/p')

     # delete all existing routes for the cable
     ip route show $CABLE_DEVICE | while read route rest
     do
       ip route delete $route dev $CABLE_DEVICE
     done

     # install our new routes
     while read route rest
     do
       case $route in
         [0-9]*)
           ip route add $route dev $CABLE_DEVICE src $CABLE_IP ;;
       esac         
     done <$FREE_ADDRESS_FILE






More information about the General mailing list