Networking Forums

Networking Forums > Computer Networking > Linux Networking > Linux automatic route after bringing up interface

Reply
Thread Tools Display Modes

Linux automatic route after bringing up interface

 
 
Peteris Krumins
Guest
Posts: n/a

 
      07-30-2003, 10:08 PM
Hello,

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.


--
Eue
 
Reply With Quote
 
 
 
 
Job Eisses
Guest
Posts: n/a

 
      07-30-2003, 11:29 PM
Peteris Krumins wrote:
> 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


That is what i do, on Solaris as well ; not bad -job
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      07-31-2003, 06:13 PM
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect automatic route entries in routing table Andy L Windows Networking 0 12-18-2006 06:21 PM
Bringing PocketPC with SynCE to Linux and Internet Gerrit Leder Linux Networking 3 05-03-2005 03:48 PM
Bringing up interface ppp0 antalb Linux Networking 2 11-05-2004 11:21 PM
'bringing up interface eth0:' takes ages ... Rob Linux Networking 8 02-08-2004 10:11 AM
Bringing Interface eth0.... Aspire Linux Networking 2 08-19-2003 03:22 PM



1 2 3 4 5 6 7 8 9 10 11