network

The following method allows to change the name of interfaces in ubuntu. The network card below some how is not good recogized by default, one interface is named renameX by default. With this method I assign it the name enp1s0 by configuration.

First I get all mac addesses of my interfaces

ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: rename2: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:07:43:0c:32:12 brd ff:ff:ff:ff:ff:ff
3: enp130s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:07:43:0c:32:13 brd ff:ff:ff:ff:ff:ff
    inet 10.7.10.70/24 brd 10.7.10.255 scope global dynamic enp130s0
       valid_lft 5639sec preferred_lft 5639sec
    inet6 fe80::207:43ff:fe0c:3213/64 scope link 
       valid_lft forever preferred_lft forever

Then I enable the feature in the grub configuration to set my own interface names.

vim /etc/default/grub
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

Apply the new configuration

grub-mkconfig -o /boot/grub/grub.cfg
update-grub
update-initramfs -u

Configure the new names per mac address

vim /etc/udev/rules.d/70-persistent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:07:43:0c:32:12", NAME="enp1s0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:07:43:0c:32:13", NAME="enp2s0"

Revision #2
Created Sun, Feb 16, 2020 10:25 AM by Bodo
Updated Sun, Feb 16, 2020 11:03 AM by Bodo