Rename network adapter on Ubuntu 16.04 LTS

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/haifeng_gu/article/details/86332987
  1. Step 1

I created a new file named 70-persistent-net.rules under the path /etc/udev/rules.d/, like the following command

$ sudo vim /etc/udev/rules.d/70-persistent-net.rules

The texts written in this file are shown as follows:

Remember to change the MAC address ATTR{address}=="b2:ca:3a:a4:1e:60" as yours for your computer.

## Following this website: https://unix.stackexchange.com/questions/328485/ubuntu-16-04-change-interface-name
#
## PCI device 0x10ec:0x8xxxx (ethernet_module_here)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="b2:ca:3a:a4:1e:60", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

## PCI device 0x168c:0xyyy (wifi_module_here)
#SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="05:84:dc:02:26:57", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

##########

## Another reference website: https://askubuntu.com/questions/767786/changing-network-interfaces-name-ubuntu-16-04

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="12:34:56:78:90:12", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="12:34:56:78:90:12", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="wlan0"

##Third reference website: https://ubuntuforums.org/showthread.php?t=2337580

  1. Step 2
## Back up the file `80-net-setup-link.rules` as it will be overwirte by the following command.
$ sudo cp /lib/udev/rules.d/80-net-setup-link.rules  /lib/udev/rules.d/80-net-setup-link.rules_backup

$ ln -sf /dev/null /lib/udev/rules.d/80-net-setup-link.rules
  1. Step 3
    Reboot.
    Done!

PS:
I firstly tried to use the configuration with condition KERNEL=="eth*"in the file 70-persistent-net.rules. But
it does not work for me as the name of network adapter didn’t changed from enp3s0 to eth0. Then I tried to remove the condition KERNEL=="eth*" in file 70-persistent-net.rules. It worked after reboot.
在这里插入图片描述

References:
Ubuntu 16.04 - Change interface name – Answered by @GAD3R
Changing Network Interfaces name Ubuntu 16.04 – Answered by @ Sebastian Marsching

猜你喜欢

转载自blog.csdn.net/haifeng_gu/article/details/86332987