3

We are trying to auto deploy kvm vms of rhel 7. We need to set udev rules and we're finding the interface names can be different and this breaks the udev rules.

Wondering if there is a file we can read via virt-cat that will guide on what the interface names will be. If not any other way to predict the names.

user192749
  • 391
  • 4
  • 10
  • Every time I install EL 7 in KVM, I am surprised to find that consistent device names _are not being used_. Everything is eth0, eth1, etc. I'll get around to fixing this eventually. – Michael Hampton Oct 17 '16 at 00:42
  • Do it with a generic script that names the interface after the MAC addr? You define it before starting the VM so you can preset the resulting name everywhere as it's predictable. – John Keates Oct 17 '16 at 01:55
  • Thanks John, I see how we could set the name via MAC, however I don't know how to determine the MACs (without the uber task of managing MACs) before the VMs are deployed and we're trying to customize the udev rules before we deploy and boot the VM. – user192749 Oct 18 '16 at 04:50

2 Answers2

0

From 11.3. UNDERSTANDING THE PREDICTABLE NETWORK INTERFACE DEVICE NAMES:

The names have two-character prefixes based on the type of interface:

  1. en for Ethernet,
  2. wl for wireless LAN (WLAN),
  3. ww for wireless wide area network (WWAN).

The names have the following types:

  • o<index>

    on-board device index number

  • s<slot>[f<function>][d<dev_id>]

    hotplug slot index number. All multi-function PCI devices will carry the [f<function>] number in the device name, including the function 0 device.

  • x<MAC>

    MAC address

  • [P<domain>]p<bus>s<slot>[f<function>][d<dev_id>]

    PCI geographical location. In PCI geographical location, the [P<domain>] number is only mentioned if the value is not 0. For example:

    ID_NET_NAME_PATH=P1enp5s0
    
  • [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]

    USB port number chain. For USB devices, the full chain of port numbers of hubs is composed. If the name gets longer than the maximum number of 15 characters, the name is not exported. If there are multiple USB devices in the chain, the default values for USB configuration descriptors (c1) and USB interface descriptors (i0) are suppressed.

stackprotector
  • 596
  • 1
  • 8
  • 27
0

See How do I Control the Ordering of Network Interfaces? In brief, either use the predictable interface name or name what you want with udev persistent-net.rules.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34