Mapping identifiers and finding interface attributes

You can use sysfs to determine the identifier, interface name, physical port, and virtual function number of a network device.

Procedure

  1. Find the identifier for a network interface.
    
    readlink /sys/class/net/<interface>/device
              
  2. List interfaces for a PCI device.
    
    ls /sys/bus/pci/devices/<pci_id>/net/
              
  3. Display the physical port (PF only).
    
    cat /sys/class/net/<interface>/phys_port_name
              
  4. Display the virtual function number (VF only).
    
    cat /sys/class/net/<interface>/device/vfn
              

Results

You can correlate the PCI identifier, interface name, physical port, and VF number of the device. These attributes can be used for identification in automation scenarios.