[kwlug-disc] Detecting and using wired network when available
chris at chrisirwin.ca
Wed Jul 7 15:20:43 EDT 2010
On Wed, Jul 7, 2010 at 14:46, Kareem Shehata <kshehata at aeryon.com> wrote:
> (...) it doesn't adjust the routing when the cable is unplugged. Dmesg shows that the OS detects the cable unplugged, and ethtool shows the state correctly, but it doesn't seem to adjust the state of the interface nor the routing to reflect that.
It sounds like the link state is detected properly but the interface
itself still 'up'. On desktop-oriented distros, bringing the interface
up and down based on link-state is typically handled by a daemon like
Wicd or network-manager. I'm assuming you've statically assigned
network information (in /etc/network/interfaces or equivalent, I'm not
sure what you're using specifically).
Manually-assigned interfaces tend to be brought up regardless of plug
state (fire and forget). If they have no link, they simply can't send
packets that way, and usually that's fine since if you can't reach the
network, you can't reach the network. It gets more difficult in your
situation since you have multiple interfaces to the same network, but
via different medium with a defined precedence (normally I would bond
multiple interfaces to the same network).
You'll likely have to set something up to babysit the interface, like
Andrew mentioned. Before network-manager was common, I used a small
daemon called 'ifplugd'. On debian/ubuntu at least, it interfaces with
the ifup/down scripts. It will configure and bring up your interface
(and any associated routing rules) on plug-in, and take the interface
down again when it loses link. I'd suggest starting there, it should
be fairly easy to configure (I don't recall having any trouble with
it). It was pretty lightweight, essentially existing exclusively for
> In Mac and Windows it's as easy as giving each interface a gateway and a metric, and the system just figures out which one to use. Any idea how to get Linux to do this?
Same in Linux, you just need something to take the interface down afterwards.
<chris at chrisirwin.ca>
More information about the kwlug-disc_kwlug.org