10

I'm trying to get a particular piece of software to run that uses a licence manager that hasn't noticed that newer Linux distributions don't name their network devices eth0 anymore. It is trying to verify the MAC address, but as my NIC is called ens1 on Centos 7 this doesn't work.

The vendor of this software already fixed this on a different computer, and I'd like to understand how they did this. They created some kind of alias for ens1 so that the licence manager can find eth0 again.

The alias is not shown at all if I do ifconfig -a, but it is visible when explicitly calling ifconfig eth0. Using the ip link command it is visible as the following:

eth0@ens1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT
link/ether [mac address] brd ff:ff:ff:ff:ff:ff

What exactly did they do here, and how can I recreate this kind of alias on another computer?

  • 1
    Did they perhaps use ip link set ens1 name eth0@ens1? I doubt that would survive a reboot like that, but perhaps you can make the change in the DEVICE line in ifcfg-ens1 or something? Can you see both eth0@ens1 and ens1 in your ip link list, or just the new name? – Eric Renouf Oct 22 '15 at 13:54
  • i just tested this in a VM - ip link set ens1 name eth0@ens1 shows the new name in ifconfig -a too. and ip link set ens1 alias eth0 shows alias eth0 on a separate line when you run ip link. – cas Oct 22 '15 at 23:57
4

This is probably done using the macvlan feature. It allows to add virtual Ethernet interfaces on top of an existing hardware interface. In your case, it could have been done like this:

ip link add link ens1 name eth0 type macvlan

By default the new interface gets a randomly chosen locally administered unicast MAC address. Alternatively you can specify the MAC address with address <MAC>.

1

You can use a udev rule to rename the NIC back to the old eth0 style.

e.g. edit /etc/udev/rules.d/70-persistent-net.rules to have a line like this:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

where xx:xx:xx:xx:xx:xx is your NIC's MAC address.

You will also have to update any network configuration so that it uses the eth0 name rather than ens1

See Predictable Network Interface Names for more info on why this change has occurred.

  • 2
    I'd like to avoid completely renaming the interfaces, and I'm also curious just how the alias works that they implemented. – Mad Scientist Oct 22 '15 at 13:01
  • 1
    i've never seen that eth0@ens1 form before, and googling for it only shows your question. Have you tried grep -r eth0 /etc? if you find it, please post as i'm curious too. – cas Oct 22 '15 at 13:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.