[NBLUG/talk] Ethernet connection status

Kyle Rankin kyle at nblug.org
Tue Jun 27 15:32:45 PDT 2006


On Tue, Jun 27, 2006 at 02:29:53PM -0700, Barry Stump wrote:
> 
> Does anyone know of an easy way to determine the status of an ethernet 
> connection from a shell script?  I'm hoping there's some parameter for 
> ifconfig or possibly something in the /proc filesystem that will do it. 
> I'd like to be able to determine whether or not eth0 is up and connected. 
> A disconnected cable at boot time is easy to detect because eth0 won't 
> initialize and therefore won't show up in the output from ifconfig. 
> However, disconnecting the cable once the box is running doesn't change 
> the output, and I don't want to resort to ping.
> 
> -Barry
> 
> +--------------------------------------------------------------------+
> | There are two theories to arguing            Barry Stump           |
> | with women. Neither one works.               barry at stump.net       |
> |                                              barry at shrewdlogic.com |
> +--------------------------------------------------------------------+
> 
> 

There are two different tools that might work depending on your ethernet
hardware (basically whether it supports MII so you can see cable insertion
events), mii-diag and ethtool. If your card supports it they should be able
to let you know the current status of your ethernet card.

-- 
Kyle Rankin
NBLUG President
The North Bay Linux Users Group
http://nblug.org
IRC: greenfly at irc.freenode.net #nblug 
kyle at nblug.org



More information about the talk mailing list