routing q on dual homed freebsd

Dinesh Nair dinesh at
Tue Apr 22 04:25:38 PDT 2003


i've got a freebsd box with 2 NICs, net diagram below:

             ISP_1       ISP_2
               |           |
               |           |
             ROUTER_1    ROUTER_2
         (IP_ADDR_1)    (IP_ADDR_2)
               |           |
               |           |
               |           |
               +- FREEBSD -+
     (IP_ADDR_3)           (IP_ADDR_4)

now, all the ip addresses shown are public ip addresses. the default
gateway of the freebsd box is IP_ADDR_1. no routing daemon is being run,
all static routes (only default so far).

what i want is for all packets arriving into the freebsd box on IP_ADDR_3
to go out the same interface, and all packets arriving on IP_ADDR_4 to go
out that interface. what's happenning is that because default route is to
ROUTER_1 (IP_ADDR_1), all packets incoming on IP_ADDR_4 is also going out
to ROUTER_1 (IP_ADDR_1) (with a source ip of IP_ADDR_4). now when ISP_1's
routers see this, they drop the packets coz it's not setup to be a proper
border router.

i've managed to get this to work with a single ipfw rule
fwd IP_ADDR_2 ip from IP_ADDR_4 to any
and it seems to work. is this the recommended way of doing it, or is there
another way of doing it ? note there are other ipfw rules in place with a
default policy to deny. the other rules allow web, ssh and name service.

i can't exchange routing info with either ISP as both of them don't allow
it. the freebsd box is not a gateway for anything else, it just runs a few
web sites on different ip addresses, some aliased on one interface and
some on the other.

so, am i doing it right ?

Regards,                           /\_/\   "All dogs go to heaven."
dinesh at                (0 0)
| for a in past present future; do                                        |
|   for b in clients employers associates relatives neighbours pets; do   |
|   echo "The opinions here in no way reflect the opinions of my $a $b."  |
| done; done                                                              |

More information about the freebsd-questions mailing list