HMC: Which network interfaces have a link

The HMC allows the network interface configuration to be displayed using the “lshmc -n” command. It cannot be determined from the output whether a network interface currently has a link or not. However, this can be determined relatively easily via the sysfs file system, mounted under /sys. First, you can use the following command to determine which network interfaces the HMC has:

hscroot@hmc02:~> ls -1d /sys/class/net/eth*
/sys/class/net/eth0
/sys/class/net/eth1
/sys/class/net/eth2
/sys/class/net/eth3
/sys/class/net/eth4
/sys/class/net/eth5
hscroot@hmc02:~>

(Output is from a 7063-CR2.)

The link status is recorded in the operstate file and can be shown with a simple cat command:

hscroot@hmc02:~> cat /sys/class/net/eth*/operstate
up
up
down
down
down
down
hscroot@hmc02:~>

In the example case shown, the first two network interfaces (eth0 and eth1) have the link status up.

The current speed can be displayed by showing the content of the speed file:

hscroot@hmc02:~> cat /sys/class/net/eth*/speed
1000
1000
-1
-1
-1
-1
hscroot@hmc02:~>

There are a number of additional files for each network interface with additional information.