重命名无线接口时出现问题

重命名无线接口时出现问题

我想重命名一个无线接口。目前我有 4 个网络接口,2 个无线,2 个有线。顺序如下:

eth0 - 电缆 (Realtek RTL-8169)
eth1 - 电缆 (Intel 82579V)
eth2 - 无线 (Broadcom BCM4321 专有驱动程序)
wlan0 - 无线 (RaLink RT2800)

我想将 eth2 重命名为 wlan1。这样无线网卡就是 wlan,有线网卡就是 eth(我喜欢这种方式)。我该怎么做?

根据 virpara 的建议,我发现了以下内容:

eth1 - e1000e wlan0 - rt2800 wlan1 - b43 eth2 - wl

# PCI device 0x8086:/sys/devices/pci0000:00/0000:00:19.0 (e1000e)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="38:60:77:ab:5e:30", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

# PCI device 0x1814:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:02.0 (rt2800pci)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:9c:05:fd:28", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

# PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0/ssb0:0 (b43-pci-bridge)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:39:0e:f0:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

# PCI device 0x14e4:/sys/devices/pci0000:00/0000:00:1c.0/0000:02:00.0/0000:03:00.0 (wl)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:18:39:0e:f0:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth2"

现在我的问题是:

  1. 为什么wlan1和eth2有相同的MAC?
  2. 如果有 2 个重复的 MACS(eth2 和 wlan1),那么另一个 NIC 在哪里?
  3. 为什么 Realtek(eth0)没有出现在列表中?
  4. wlan1 从哪里来的,因为我看不到它使用ifconfig -aiwconfiglshw。除了文件中,没有 wlan1 /etc/udev/rules.d/70-persistent-net.rules

答案1

答案2

请参阅开头的评论/etc/udev/rules.d/70-persistent-net.rules

# 条目由 75-persistent-net-generator.rules 自动添加
 # 文件;但是您也可以自由添加自己的条目。

这是一个自动生成的(也可能是定制的文件)。

/lib/udev/rules.d/75-persistent-net-generator.rules是所有操作发生的地方。现在很难分辨哪些条目是自动添加的,哪些是由您或其他应用程序添加的。

尝试重命名70-.....为非扩展名.rules(或移至另一个目录)。然后重新启动,并粘贴“干净生成的”70-persistent-net.rules 的内容。

答案3

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

您将获得如下内容,

# This file maintains persistent names for network interfaces.
# See udev(7) for syntax.
#
# Entries are automatically added by the 75-persistent-net-generator.rules
# file; however you are also free to add your own entries.

# PCI device 0x11ab:0x4357 (sky2)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:25:b3:7b:28:3d", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# PCI device 0x8086:0x4222 (iwl3945)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1f:3c:e0:f2:45", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

做出相应的改变NAME=

相关内容