On 30 Jul 2003, Peteris Krumins <(E-Mail Removed)> wrote:
> I have forgotten how to avoid linux (>2.4.x) setting up a route as soon
> as
> i configure an interface.
> If i use netmask 255.255.255.255 no route is added but i am unable to
> add
> a default gw (since it is not on the same subnet as the interface?).
>
> for example:
> `ifconfig eth0 10.0.0.55 netmask 255.255.255.0 broadcast 10.0.0.255 up`
> would add me a route for 10.0.0.0/24 on eth0, but this is no good if i
> have to route it out via 10.0.0.1 (for example if there is some machine
> inbetween).
>
> The only workaround i have found is:
> ifconfig eth0 ...
> route del -net 10.0.0.0 netmask 255.255.255.0 dev eth0
> route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1 dev eth0
>
> if i try `ifconfig eth0 ... netmask 255.255.255.255 ... up` and then
> no route is added (since it is a single host?) but if as soon as i try
> `route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1 dev eth0`
> i get an error that the network is unreachable.
You need a route to a gw, before you can use it as a gw. I would think
the following would work best:
ifconfig eth0 10.0.0.55 netmask 255.255.255.255 broadcast 10.0.0.55 up
route add -host 10.0.0.1 dev eth0
route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.1 dev eth0
It is quite common for ppp or pppoe to use 255.255.255.255 netmask for
your IP, a host route to gw, and that remote host as gw, since in that
case, there are no other IPs between you and the gateway, and
often the gw IP is not even on the same network. Example:
Jul 22 22:27:11 wireless1 pppd[2237]: local IP address 64.108.180.6
Jul 22 22:27:11 wireless1 pppd[2237]: remote IP address 65.42.7.73
Dial Pool - TLDOOH TNT1 SBCIS-100717-16332 (NET-64-108-180-0-1)
64.108.180.0 - 64.108.180.255
Toledo Admin SBCIS-011502135054 (NET-65-42-7-0-1)
65.42.7.0 - 65.42.7.255
--
David Efflandt - All spam ignored
http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/