35

I decided to do a clean install of 15.10, and as a result, need to reinstall MATLAB. MATLAB licenses are tied to the the eth0 hardware address.

My Ethernet card is listed as enp1s0, and I need to rename it to eth0. only lo is listed in /etc/network/interfaces, and /etc/udev/rules.d/70-persistent-net.rules does not exist, so I'm unsure where to start.

kyodake
  • 17,808

5 Answers5

29

My solution to this was to create a file /etc/udev/rules.d/10-rename-network.rules with the content:

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ff:ff:ff:ff:ff", NAME="eth0"
richvdh
  • 973
10

I had the same problem and adding files to /etc/udev/rules.d/ did not help. The issue seems to be in the use of Predictable Network Interface Names as described here. To create your own manual naming scheme, i.e., to name your device "eth0" for MATLAB, you can create your own .link files in /etc/systemd/network/ as described here.

Specifically, I created a file /etc/systemd/network/10-eth.link with the contents

[Match]
MACAddress=ff:ff:ff:ff:ff:ff
[Link]
Name=eth0

replacing ff:ff:ff:ff:ff:ff with the MAC address of the device I wanted to change. After reboot the name was as desired.

jdnz
  • 217
6

If for any reason answer suggested by @zab doesnt work for you, you can also disable this naming scheme like it made here. But the method proposed by @zab is potentially safer

I just did not include biosdevname=0 to command line argument, it seems to be turned off by default.

Following steps schould be made:

$ sudo nano /etc/default/grub

At the line GRUB_CMDLINE_LINUX add net.ifnames=0

GRUB_CMDLINE_LINUX="[previous parameters] net.ifnames=0"

Then generate new grub file:

$ sudo grub-mkconfig -o /boot/grub/grub.cfg

At the end reboot system.

3

I had this issue running 16.04 Server (minimal) on a raspberry pi 3 and none of the posted answers helped. What solved the problem was disabling Predictable Network Interface Names as descripbed here: https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/

by running this command:

ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules
2

This worked for me on 16.04 server as eno1 was showing when I did ifconfig -a. I had to bring up the interface as ifconfig eno1 up then I did the following:

vi /etc/udev/rules.d/10-network.rules

SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="ff:ff:ff:ff:ff:ff", NAME="eth0"
edwinksl
  • 24,109
Jose
  • 21