Linux – Fix Udev Rules Not Working

linuxnetworkingudev

sorry for my English….

I am with Linux Mint

I to try to change my interface name but without result…

The steps which I to does…

First search for my interface name and mac from it,

ip a

to come, interface name enp0s3, mac address 08:00:27:2e:7a:49.

Seconds set down the interface,

sudo ip link set dev enp0s3 down

Rename the device name, I'll change to eth0.

Call the 70-persistent-net.rules file,

sudo gedit /etc/udev/rules.d/70-persistent-net.rules

and write,

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="08:00:27:2e:7a:49", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

I call the interfaces file,

sudo gedit /etc/network/interfaces

and write,

auto eth0
iface eth0 inet static
address 192.168.178.48
netmask 255.255.255.0
gateway 192.168.178.1

Then, the computer new start…

On Terminal write,

ip a

but have similar interface name, enp0s3.

Can Please someone help me with this problem, Thanks!

Best Answer

Try this methods:

You basically have two options:

  1. You disable the assignment of fixed names, so that the unpredictable kernel names are used again. For this, simply mask udev's rule file for the default policy:

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

  1. You create your own manual naming scheme, for example by naming your interfaces "internet0", "dmz0" or "lan0". For that create your own .link files in /etc/systemd/network/, then choose an explicit name or a better naming scheme for one, some, or all of your interfaces. See systemd.link(5) for more information.

You pass the net.ifnames=0 on the kernel command line

I tested systemd.link method. It is works! systemd.link