Network routing and Multiple ADSL lines

Geraint Edwards gedge-lists at yadn.org
Mon Aug 7 12:50:18 BST 2006


Paul <freebsd at caspersworld.co.uk> said
		(on Sun, Aug 06, 2006 at 08:54:41PM -0400):
> I currently have my default gateway on FreeBSD set to 192.168.0.1.

I have a similar setup.  I use cable (NTL) for personal use and
have ADSL (Plusnet) for more work-related things - both patched
into my FreeBSD box through different NICs.

My solution to your problem would be to use a static route.

> What I really want is for the alpha to have a default gateway of 
> 192.168.0.1 (I use it for personal tasks as well as for my friend), to 
> be able to connect to it internally from the 192.168.0.0/24 network, 
> and externally using the IP from the first ADSL line
> I would also like to be able to connect to it externally using the IP 
> address from the seconds ADSL line, so my friend can backup to it 
> using rsync and also use it as a DNS server

If your friend has a static IP, or a known range of IPs (let's
say it is 12.34.56.78/30) then you could use that range to setup a
static route which goes via the 2nd ADSL line.

Of course, all traffic to 12.34.56.78/30 from hosts with this
static route will be routed via the 2nd/ADSL line, but that's not
a problem for me.

Here's my solution for this (I have three static routes for known
Plusnet ranges):

In /etc/rc.conf I have something like this:

static_routes="foo1_via_plus foo2_via_plus foo3_via_plus"
myvars__adsl2_gw="10.0.200.1"
route_foo1_via_plus="-net 217.140.44.0 -netmask 255.255.255.0 ${myvars__adsl2_gw}"
route_foo2_via_plus="-net 212.159.0.0  -netmask 255.255.0.0   ${myvars__adsl2_gw}"
route_foo3_via_plus="-net 84.92.0.0    -netmask 255.255.0.0   ${myvars__adsl2_gw}"

So, yours would be something like this:

static_routes="pal_via_adsl2"
myvars__adsl2_gw="10.0.200.1"
route_pal_via_adsl2="-net 12.34.56.78 -netmask 255.255.255.252 ${myvars__adsl2_gw}"

Reboot... et voila!


For Windows boxes that need to use these routes (of course, they
have to be connected to the 2nd router too, or perhaps route via
the FreeBSD box), I use Samba login scripts.  My Windows hosts
login to Samba running on my FreeBSD box, and I have a shell
script which extracts the above routes from rc.conf and creates a
.BAT file, which sets up the Windows box with those static routes
when users log in.  Automagically.

If you want more details, let me know privately and I'll share
(my setup is - in reality - a bit more complicated than the
example above, so I'd need to tweak to suit).  If enough people
contact me, I'll post to the list.

Hope this helps,

-- 
Geraint A. Edwards (aka "Gedge")
gedge at yadn.org




More information about the Ukfreebsd mailing list