Mapping interfaces to CCW devices

6.10 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.

Your distribution might do this tracking for you by providing udev-created interface names that are based on the bus ID of the CCW device. Use the information that follows if you need to map CCW devices to interface names with the naming pattern eth<n>, where <n> is an index number.

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
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
Example:
# ls /sys/class/net
eth0     eth1
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.

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.