Re: wireless + wired + dhcp +... : unproper default route
Thanks for your reply.
Matt Foster wrote:
Quoting Jerome BENOIT (jgmbenoit@wanadoo.fr):
Thanks for your reply: fellowing the below advice
I wrote an adquate script that I put in the directory
/etc/network/if-post-down.d
to set a default route when it is missing:
route add default gw <default ip>
According to the man page we can specify the Iface,
instead to let the kernel to chose for us,
by adding something as `dev eth0':
I have tried it, but each time
the default route seems to be blocked after a while
(except when I set the kernel favorite Iface).
My basic idea was to write after some basic checks:
route del default
route add default gw <default ip> dev <fastest connected iface>
but as I sait I got into troubles:
I guess I missed something:
any idea ?
Thanks in advance,
Jerome
This may just be me being dense,
I was asking for a hint.
Please note that I am not (yet) familiar with network stuff.
but why the 'if-post-down.d' directory, as
opposed to the 'if-up.d' directory? Surely it would be more logical to
change the routing tables when a new interface comes up?
in my /etc/network/interface I wrote
iface eth0 inet dhcp
iface wlan0 inet dhcp
wireless_<option> <value>
so the routing table is managed by the dhcp manchinerie.
This work fine when only one iface is involved,
but troubles emerge when the two ifaces are involved.
For the post-down why, please see below.
What kind of troubles ddi you have with the route exactly?
Up to now I encoutered two cases:
1]
my wireless iface (wlan0) and my wired iface (eth0) are plugged
(my automation scheme used ifplugd): I can do basic stuff.
Now if the iface that hold the default route is unplugged,
then the default route is removed by ifdown (called by ifplugd).
In other words I have no more default route,
hence my post-down action to set up the default route
(when the other card is still present):
route add default gw <default ip>
This just mimics what /etc/dhcp3/dhclient-script does.
And it works.
2]
My second point is that the choice of the default route iface
is done by the kernel since the above command contains no `dev' option.
So as my wired connection is far faster than my wireless connection,
I want the eth0 iface as my default interface when possible:
to do so, I try the fellowing:
route del default
route add default gw <default ip> dev eth0
and to check the routing table:
ping ping.symantec.com
If the default iface was eth0 before the `del' action,
the pinging is ok;
but if the default was `wlan0',
the pinging is ok for a short time,
and then it is lost.
Note that for my wlan0 iface, I have to used the fresh ndiswrapper
driver, so may be the trouble come from there.
Thanks,
Jerome
Reply to: