MAC地址不断变化

MAC地址不断变化

我在 CentOS7 上使用 NetworkManager。每次我重新启动 NetworkManager 时,ifconfig 都会将 MAC 地址显示为无线卡的其他地址。我在 ifcfg-AP_NAME 中指定 MAC,但它永远不会起作用,因为每次它都会改变。这是我从 CLI 得到的信息:

[root@blue network-scripts]# ifconfig -a wlp3s0                             
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether f6:4d:4e:2e:01:ea  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@blue network-scripts]# systemctl restart NetworkManager
[root@blue network-scripts]# ifconfig -a wlp3s0              
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 62:25:b9:b6:9b:0b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@blue network-scripts]# systemctl restart NetworkManager
[root@blue network-scripts]# ifconfig -a wlp3s0              
wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b6:d1:1c:f7:1b:23  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@blue network-scripts]# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    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
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:01:c0:20:22:14 brd ff:ff:ff:ff:ff:ff
    inet 10.1.2.130/25 brd 10.1.2.255 scope global enp1s0
       valid_lft forever preferred_lft forever
3: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 00:01:c0:20:22:2c brd ff:ff:ff:ff:ff:ff
4: wlp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether b6:d1:1c:f7:1b:23 brd ff:ff:ff:ff:ff:ff
5: mgmt0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:b6:23:0c:8d brd ff:ff:ff:ff:ff:ff
    inet 172.18.1.12/24 brd 172.18.1.255 scope global mgmt0
       valid_lft forever preferred_lft forever
[root@blue network-scripts]# systemctl restart NetworkManager
[root@blue network-scripts]# ip a s
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    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
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:01:c0:20:22:14 brd ff:ff:ff:ff:ff:ff
    inet 10.1.2.130/25 brd 10.1.2.255 scope global enp1s0
       valid_lft forever preferred_lft forever
3: enp2s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN qlen 1000
    link/ether 00:01:c0:20:22:2c brd ff:ff:ff:ff:ff:ff
4: wlp3s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
    link/ether 22:49:ba:1f:fb:3a brd ff:ff:ff:ff:ff:ff
5: mgmt0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:50:b6:23:0c:8d brd ff:ff:ff:ff:ff:ff
    inet 172.18.1.12/24 brd 172.18.1.255 scope global mgmt0
       valid_lft forever preferred_lft forever
[root@blue network-scripts]# 

答案1

正如你所描述的,这可能是网络管理器正在做

如博客中所述,有一些设置可以实现此目的。你应该做的最好的事情可能是:

nmcli c modify id yourwifiid 802-11-wireless.cloned-mac-address permanent

这将在启动接口之前恢复卡的永久 MAC 地址,同时在检测网络时仍然不会暴露 MAC。

根据博客和评论,您还可以在扫描过程中禁用所有地址随机化网络管理器.conf:

[device]
wifi.scan-rand-mac-address=no

相关内容