Routing through two networks

Dinesh Nair dinesh at alphaque.com
Wed Apr 23 02:36:50 PDT 2003


On Wed, 23 Apr 2003, Jonathan wrote:

> All I'm trying to do is ensure that any traffic that comes in for
> 193.0.0.250 routes back out through 193.0.0.1 and anything that comes in
> for 217.0.0.250 routes back out through 217.0.0.1 keeping bandwidth
> charges to a minimum.

it's interesting that you're asking the very same question i asked on this
list yesterday. i had the same problem, where i wanted traffic incoming on
one interface to go out the same on a dual homed box.

playing around with ipfw's fwd directive, i came to the following
solution. set the default route to the router on one interface, say a
default route to 193.0.0.1. then add the following ipfw rule

ipfw fwd 217.0.0.1 ip from 217.0.0.250 to any

this way, traffic which is outgoing from 217.0.0.250 will hit the forward
rule and be sent on a next hop of 217.0.0.1, while all other traffic will
obey the default rule and go out with a next hop 193.0.0.1.

this works for me, but my question was if this is the optimum way of
solving this problem.

Regards,                           /\_/\   "All dogs go to heaven."
dinesh at alphaque.com                (0 0)    http://www.alphaque.com/
+==========================----oOO--(_)--OOo----==========================+
| 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