Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Jan 2001 19:20:18 -0500
From:      Tim Gustafson <tim@falconsoft.com>
To:        freebsd-isp@freebsd.org
Subject:   Question Re: Multiple Default Gateways
Message-ID:  <5.0.0.25.2.20010103191232.00a57260@esther.falconsoft.com>

next in thread | raw e-mail | index | archive | help
Hello

I just installed a D-Link DFE-570TX 4-Port network card into one of my 
FreeBSD 4.2-STABLE machines.  It works great so far, and I have different 
IPs assigned to each of the 4 ethernet ports, as follows:

dc0: inet 10.0.0.2 netmask 0xffffff00 broadcast 10.0.0.255
dc1: inet 10.0.1.2 netmask 0xffffff00 broadcast 10.0.1.255
dc2: inet 10.0.2.2 netmask 0xffffff00 broadcast 10.0.2.255
dc3: inet 10.0.3.2 netmask 0xffffff00 broadcast 10.0.3.255

This, obviously, is how I have it set up for testing only.  When this goes 
to production, it will have 4 different real-world IP addresses, one for 
each Internet connection I have.

My question is this:

I'd like to set up four default gateways on the machine, one for each of 
the ethernet ports, as follows:

route add -net 0.0.0.0 -netmask 0.0.0.0 10.0.0.1
route add -net 0.0.0.0 -netmask 0.0.0.0 10.0.1.1
route add -net 0.0.0.0 -netmask 0.0.0.0 10.0.2.1
route add -net 0.0.0.0 -netmask 0.0.0.0 10.0.3.1

However, after the initial default gateway is set up, I get this for each 
of the three subsequent additions:

route: writing to routing socket: File exists
add net 0.0.0.0: gateway 10.0.1.1: File exists

How can I make it so this machine will have the four different default 
gatways?  The reason I have them all is for redundancy - the application 
I'm creating pings each of the server's IPs before connecting, and connects 
to the one with the lowest round-trip time (thereby load balancing for me, 
and also allowing one or two of the DSL lines to be down and people can 
still get through).

I've read some of the archives of this list where it says you can just add 
them as I've mentioned above, but it doesn't seem to work like people have 
explained it.  Do I need to set any special options in the kernel or in the 
rc.conf file?

Incidentally, I don't need or want any of the interfaces to route packets 
to the other interfaces.  When a TCP connection comes in on the 10.0.0.2 
interface, I need the outbound part of that TCP connection to go back out 
the 10.0.0.2 interface.

Thanks for any help.

Tim

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   Tim Gustafson                          tim@falconsoft.com
   www.falconsoft.com                          (631)475-6662
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
   Share your knowledge - it's a way to achieve immortality.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5.0.0.25.2.20010103191232.00a57260>