[NBLUG/talk] Ethernet connection status

Eric Eisenhart eric at nblug.org
Tue Jun 27 15:30:05 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.

Well...  you can look for "UP" and "RUNNING" in "ifconfig eth0", or you can
look for "Link detected: yes" in "ethtool eth0".
-- 
Eric Eisenhart
NBLUG Co-Founder, Scribe and InstallFest Coordinator
The North Bay Linux Users Group -- http://nblug.org/
eric at nblug.org, IRC: Freiheit at fn AIM: falschfreiheit



More information about the talk mailing list