NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: default gateway on different subnet
On Thu 13 Nov 2008 at 23:55:31 +0100, Johnny Billquist wrote:
> This setup looks very broken. I'm surprised that Linux would allow it.
I have noticed on other occasions too that Linux allows this situation,
which directly contravenes all IP routing standards.
> Looking at the routing table you provided, it appears as if Linux
> actually pretends that eth0 are on both networks. So what you should do
> is setup the interface with both addresses, so that it actually knows
> that it's on both networks.
That would be the correct way to do it, of course. An effect may be that
outgoing packets may get the "wrong" source address.
I have a weird setup with my ADSL modem/router which acts as a sort-of
unnumbered device between me and the Internet. My own external interface
owns my public IP address but the modem thinks that it owns it too. It
is accessible via 192.168.0.1 on my external rtk0 interface that has a
/32 address assigned.
This weird sequence of commands sets up my outgoing routing:
route add -net 192.168.0.1 -netmask 255.255.255.0 -ifp rtk0 -cloning
[external IP address] -interface
# ^^ (error checking in the route adding code (sys/net/rtsock.c,
# route_output, case RTM_ADD) insists on having a gateway (so we add a
# "random" one) (1.5+ wants an address on one of the subnets of the
# interface). Adding -interface cancels its presence again... The use of
# a host address for the -net option does not matter since the netmask is
# applied to it.
# The reason this route is needed in the first place, is that in a moment
# we'll be sending packets to 192.168.0.1 from an interface that does not
# have an address in that subnet, and we want it to send ARPs for it
# anyway.
route add default 10.0.0.200
route change default 192.168.0.1 -ifp rtk0
Something similar might help in this situation, if it cannot be done
right.
-Olaf.
--
___ Olaf 'Rhialto' Seibert -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl -- Cetero censeo "authored" delendum esse.
Home |
Main Index |
Thread Index |
Old Index