[clug] Ethernet Link Status

Brett Worth brett at worth.id.au
Thu Jun 1 00:05:03 GMT 2006

How can I check the link status of ethernet in Linux?

I'd like to write a script that will down the eth0 interface of my notebook if its
not plugged in so the wireless can come up.  Currently I have the eth0
coming up automatically at boot.  If I plug my PCMCIA wireless card in it comes up
but the default route is not applied because the eth0 interface stops it for some
reason.  To fix I have to down the eth0 interface manually then down and up the
wifi interface.

I see that the "link up" and "link down" messages go into syslog when the ethernet
cable is plugged and unplugged but I cant work out how to examine this status.

I'd like to be able to sit at my desk with the ethenet plugged in an be able to
unplug the ethernet and plug in the wireless card and have the interfaces
configured properly without me doing anything.


More information about the linux mailing list