pebkac routing problem

Martin P. Hellwig mhellwig at xs4all.nl
Thu Oct 6 14:43:36 PDT 2005


Matthew Dillon wrote:
<cut>
:
:Trying to add a route for 213.126.48.0/24 (FAILS):
:# route add 213.126.48.0/24 213.126.48.1
:route: writing to routing socket: File exists
:add net 213.126.48.0: gateway 213.126.48.1: 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.

Thanks again!

--
mph




More information about the Users mailing list