DragonFly users List (threaded) for 2005-10
Re: pebkac routing problem
Matthew Dillon wrote:
:Trying to add a route for 184.108.40.206/24 (FAILS):
:# route add 220.127.116.11/24 18.104.22.168
:route: writing to routing socket: File exists
:add net 22.214.171.124: gateway 126.96.36.199: File exists
The outgoing packet is routed based only on the destination address,
and at the moment we can only have one default route, so any outgoing
packet to an outside internet address will wind up going through the
default route nomatter what it's source address is.
BUT! It *IS* possible to get around this using IPFW (and probably
ipfilter too, but I'm more familiar with IPFW), using a 'forward' rule.
Do a 'man ipfw' and look for 'fwd' or 'forward'. What you want to do is
create 'allow' rules for target IP's that are on your two LANs, and
then any packets destined for the outside world will fall through to
your forwarding rules which you can set up to forward to the correct
gateway based on the source IP.
Thanks alot, this would save my day! (also thanks to Erik)
Three tiny question left before I start testing tomorrow;
Am I save to assume that when a package arrives to ip X it will always
be replied from X and not from Y?
That is, in the IP header of the reply, the source IP address is set to
the IP address the request was original send to?
And that the fwd rule sends the mac frame to the other gateways mac
address instead of the default one?
I guess if this is yes on all three, I have understood it correctly.