[Beowulf] Ethernet Status
ajt at rri.sari.ac.uk
Wed May 25 02:17:50 PDT 2005
Paul Romero wrote:
> Hi Tony:
> This doesn't work. If for example the device is logically up
> and the Ethernet cable is not plugged into the NIC, it
> still reports the device as up. (i.e. I need to avoid pinging.)
> Furthermore, I would prefer to avoid using "manual/shell script"
I suggested "ifconfig" because it tells you the device names...
The other place to look is /proc/net/dev which is where "ifconfig" gets
its information if you have a 'procfs' kernel. It's all open source, and
you can dig out the bit of code you want from the "ifconfig" source to
use it in your own program...
Another possibility is to use Donald Becker's "mii-diag" (Media
Independent Interface Diagnostics) if your NIC is supported - have a
This is example output (you can, of course, use the source code!):
# mii-diag eth2
Basic registers of MII PHY #1: 3100 786d 0101 8f28 05e1 41e1 0005 2801.
The autonegotiated capability is 01e0.
The autonegotiated media type is 100baseTx-FD.
Basic mode control register 0x3100: Auto-negotiation enabled.
You have link beat, and everything is working OK.
Your link partner advertised 41e1: 100baseTx-FD 100baseTx 10baseT-FD
End of basic transceiver information.
> Tony Travis wrote:
>>Paul Romero wrote:
>>>Dear User Group:
>>>How does one determine the status of a device
>>>such as eth0. My initial guess is that once
>>>you know the device name for eth0, you can
>>>just open it and use ioctl calls, or perhaps it will
>>>not successfully open if the hardware device is down.
>>>My problem is I can't figure out the device name.
>>>(i.e. My motivation for doing this is to find out if
>>>my system has physical IP connectivity without referencing
>>>a particular IP address.)
>> ifconfig -a
>>This will tell you the status of all configured and unconfigured NIC's
>>on you system.
>>Dr. A.J.Travis, | mailto:ajt at rri.sari.ac.uk
>>Rowett Research Institute, | http://www.rri.sari.ac.uk/~ajt
>>Greenburn Road, Bucksburn, | phone:+44 (0)1224 712751
>>Aberdeen AB21 9SB, Scotland, UK. | fax:+44 (0)1224 716687
> Paul Romero
> RCOM Communications Software
> Phone/Fax: (510)339-2628
> E-Mail: paulr at rcom-software.com
Dr. A.J.Travis, | mailto:ajt at rri.sari.ac.uk
Rowett Research Institute, | http://www.rri.sari.ac.uk/~ajt
Greenburn Road, Bucksburn, | phone:+44 (0)1224 712751
Aberdeen AB21 9SB, Scotland, UK. | fax:+44 (0)1224 716687
More information about the Beowulf