Re: howto disable auto route setup?

Adam Heath (doogie@debian.org)
Tue, 2 Feb 1999 19:25:45 -0600 (CST)


On Tue, 2 Feb 1999 kuznet@ms2.inr.ac.ru wrote:

> Hello!
>
> > ifconfig 192.168.0.1 netmask 255.255.255.0 dev eth0 up
> >
> > what route i want?
>
> Writing this you have already answered this rethoric question 8)
>
> > maybe i want to add a policy route, and i don't want the
> > "implicit" route to be up for even a millisecond. maybe i want a
> > different window size, maybe i want to do a whole load of strange
> > things, maybe i don't even want to have a route... who's to say
> > what i want?
>
> If you are aware of these tricks and are about to use them
> you never will execute command above.
>
> The only sense of netmask on interface is that BSD API complying
> applications may read it and guess that destinations in this range
> are DIRECTLY reachable. If we do not provide this
> (even for several milliseconds), we have bug. If you do some smart
> overrides, simultaneously cheating applications about netmask,
> your configuration is wrong.
>
> BTW if you wanted to get rid of millisecond gaps,
> it would not use ifconfig for address configuration at all,
> it is racy by design. ip addr add 192.168.0.1 dev eth0
>
> Gentelmen, let's stop on this point, this thread became a bit longish.
> If someone really cannot sleep quietly without this feature, he is free
> to submit (only correct!) patch and the "survival of the fittest"
> will make its job as usually 8)

Here is a WORKING network setup, that would break if auto-route was in use.

---
#!      /bin/sh
gw=x.x.x.1
ip1=x.x.x.2
ip2=x.x.x.3
ip3=x.x.x.4

# Configure the interfaces ifconfig lo 127.0.0.1 ifconfig eth0 $ip1 netmask 255.255.255.0 broadcast x.x.x.255 arp ifconfig eth1 $ip1 netmask 255.255.255.0 broadcast x.x.x.255 arp ifconfig eth1:0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255

# Add routes for the networks route add -net 127.0.0.0 route add -net x.x.x.0 netmask 255.255.255.0 eth0 route add -net 192.168.1.0 netmask 255.255.255.0 eth1:1

# The spare static ip's are routed out eth1, the store # lan, so that machines there can have static ip's as # needed. route add -host $ip2 eth1 route add -host $ip3 eth1 route add default gw $gw metric 1

# Setup the default policy, and masquerade the # private ip space. echo "1" > /proc/sys/net/ipv4/ip_forward ipfwadm -F -f ipfwadm -F -p deny ipfwadm -F -a m -S 192.168.1.0/24 -D 0.0.0.0/0

#Allow packets for the sjcc<->voyager link to be forwarded. ipfwadm -F -a accept -S x.x.x.0/24 -D 0/0 ipfwadm -F -a accept -S 0/0 -D x.x.x.0/24

#accept packets for the static ips on the voyager lan. arp -i eth0 -Ds $ip2 eth0 pub arp -i eth0 -Ds $ip3 eth0 pub

#accept packets for the router on the storelan. arp -i eth1 -Ds $gw eth1 pub

---
Note, it also uses arp.  This makes the upstream router on eth0 think the
other machines residing on eth1 are on the eth0 network.  There is no route
for eth1 for $ip1.

Adam

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/