Mapping interfaces to CCW devices

KVM guest

If you define multiple interfaces on a Linux instance, you need to keep track of the interface names assigned to your CCW network devices.

After setting a device online, read /var/log/messages or issue dmesg to find the associated interface name in the messages that are issued in response to the device being set online.

To list the network interfaces, issue:
# ls /sys/class/net
The command output is a list of symbolic links that match the interface names. There is an interface for each network device that is online.
Example:
# ls /sys/class/net
eth0     eth1
For each network device that is online, there is a symbolic link of the form /sys/class/net/<interface>/device where <interface> is the interface name. To find the device bus-ID for a particular interface, issue a command according to the following example:
Example:
# ls -1 /sys/class/net/eth0/device/../.. | head -1
0.0.f500
Tip: Issue the following command to obtain a mapping of network devices to interface names.
# ls -d /sys/devices/css0/*/*/virtio*/net/*
Example:
# ls -d /sys/devices/css0/*/*/virtio*/net/*
/sys/devices/css0/0.0.0001/0.0.f500/virtio0/net/eth0
/sys/devices/css0/0.0.0002/0.0.1ed0/virtio1/net/eth1
You can pipe the command output to awk to obtain a more compact view:
# ls -d /sys/devices/css0/*/*/virtio*/net/* | awk -F "/" '{print $9 "\t" $6}'
eth0    0.0.f500
eth1    0.0.1ed0