Linux automatic route after bringing up interface

From: Peteris Krumins (pkruminsREMOVETHIS_at_inbox.lv)
Date: 07/31/03


Date: 30 Jul 2003 22:08:59 GMT

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


Relevant Pages

  • Re: Cant send packets via WiFi (possibly route issue)
    ... I think that this WiFi device should route all ... it should *all* be routed to the eth1 interface. ... Wireless is much like a point-to-point link using ... The connection between the two networks is the "Wifi AP". ...
    (comp.os.linux.networking)
  • RE: Running public IPs inside an RFC 1597 network
    ... > I'm running a typical Class C RFC 1597 network in my lab. ... know or care if we humans designate a subnet as public or private. ... is the absolute most general route there is for a machine. ... In a correctly configured system when you define an interface, ...
    (freebsd-questions)
  • Equal cost paths from separate OSPF Processes
    ... the network statements are valid in all OSPF processes. ... interface Serial0.300 point-to-point ... router#sh ip route ospf ... connected, includes subnets in redistribution ...
    (comp.dcom.sys.cisco)
  • Re: panic in rt_check_fib()
    ... It dropped a the lock on one route while it went off an did something ... then brings up the wired interface of my laptop. ... echo '## Bringing up network interface.' ... With your version of rt_check_fibI have no panics so far. ...
    (freebsd-current)
  • kludgily solved: bridge with access on both interfaces
    ... address on each interface that is only accessible ... from its own interface side of the bridge - which is actually what we ... there are some checks in the ARP code ... wound up having better luck with route, though it was still a struggle ...
    (freebsd-net)