红联Linux门户
Linux帮助

Ubuntu17.04修改无线网络名称

发布时间:2017-05-28 11:00:26来源:linux网站作者:楚云泽
关于如何在Ubuntu17.04中更改无线网络名称,网上有一些误导性的信息。因为Ubuntu17.04不使用Systemd.link。实际上,更改接口名称的方式几乎与以前一样,有两个小的差别:首先,必须手动创建规则/etc/udev/rules.d/70-persitstent-net.rules。这样做的好处是不必担心任何脚本覆盖这个文件,并且可以简单地添加需要的行。然后在Ubuntu 14.04 LTS中有附加条件的KERNEL=="eth"。由于某些原因,这在Ubuntu 17.04中并不适用。如果出现这种附加条件,则忽略整个行,然后返回默认的行为。
 
修改过程分两步:
 
1.使用iw dev查看无线网卡以及MAC地址
root@ubuntu:/opt# iw dev
phy#0
Interface wlp3s0
ifindex 3
wdev 0x1
addr 1c:4b:d6:81:77:7d
type managed
channel 3 (2422 MHz), width: 20 MHz, center1: 2422 MHz
txpower 20.00 dBm
 
2.新建设备规则文件70-persitstent-net.rules
root@ubuntu:/opt# cd /etc/udev/rules.d/
root@ubuntu:/etc/udev/rules.d# touch 70-persitstent-net.rules
root@ubuntu:/etc/udev/rules.d# vi 70-persitstent-net.rules
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="1c:4b:d6:81:77:7d", ATTR{dev_id}=="0x0", ATTR{type}=="1", NAME="wlan0"
root@ubuntu:/etc/udev/rules.d# reboot
注:2中的MAC地址需要填写1查出来的MAC地址。
 
本文永久更新地址:http://www.linuxdiyf.com/linux/31129.html