[Beowulf] Ethernet Status

Robert G. Brown rgb at phy.duke.edu
Wed May 25 04:12:57 PDT 2005


On Tue, 24 May 2005, 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.)

Hmmm, this sounds like the kind of question that suggests that it would
be a good idea for you to get a book or two on linux from B&N or Amazon.

There are lots of ways to get information about the network.  All of the
commands below are low level raw commands entered at a command line.
For an individual workstation, one can often determine a lot of
information using Win-like configuration GUIs (e.g.
system-config-network in RH or Fedora), but these tools are too limiting
to use as a cluster manager.

The most immediately useful is the command:

  /sbin/ifconfig

which shows you the status of your existing network and can be used to
configure a network device (e.g. give it an IP number, netmask,
broadcast address, and more).

  /sbin/route

is a companion to this that is often useful for resolving routing
problems, which are as likely to be a problem as anything else if a
network device doesn't work.

  cat /etc/resolv.conf

lets you see your current nameservice resolution table, in case you are
having difficulty resolving hostnames; in a cluster environment you may
well want to set up cluster nodenames in e.g. /etc/hosts.conf and turn
on local hostname resolution in /etc/nsswitch.conf.  If you use dhcp and
NIS though, most of this will be handled automagically for you, once you
learn those somewhat more complicated tools for distributing network and
host database information.

A >>very<< useful thing to learn to do is to read the system logs, which
will usually show you attached devices when it probes them during boot.
This presumes to some extent that the devices were at SOME time
autoprobed or installed by hand in e.g. /etc/modprobe.conf, a file that
maps specific device names (such as eth0) to kernel driver modules (such
as e100).  

  /sbin/lsmod 

will show you whether the module associated with your network device is
loaded -- it will generally autoload on demand when the network device
is first initialized.  If your system was never probed, you can try
adding lines to /etc/modprobe.conf by hand (if you know for sure what
kind of network device you have) -- something like 

  alias eth0 e100

(where e100 is the name of the appropriate kernel module) might do it.
Or run a probing tool.  In RH or Fedora this tool is "/usr/bin/kudzu".
I have no idea what it might be in other flavors of linux.

To read the logs, use e.g.

  /usr/bin/less /var/log/messages

and look through the kernel's boot logs, /var/log/boot.log.?.  If a
device is present but not initializing correctly, it will likely be
traced out there.

Finally, there are certain places where the information that the kernel
maintains about network devices can be read directly from the "raw"
/proc interface.  Try looking at /proc/net/dev, for example.

There are a variety of higher end tools for displaying network device
load (processed out of /proc data).  Try for example

  /bin/netstat -i 5

(and note the obvious connections to /proc/net/dev, "digested").
netstat is a swiss-army-knife tool.  Read the man page to get some idea
what it can do.

Hope this helps.

    rgb

> 
> Best Regards,
> 
> Paul R.
> 
> 
> --
> Paul Romero
> 
> RCOM Communications Software
> 
> Phone/Fax: (510)339-2628
> E-Mail: paulr at rcom-software.com
> 
> 
> _______________________________________________
> Beowulf mailing list, Beowulf at beowulf.org
> To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf
> 

-- 
Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu





More information about the Beowulf mailing list