![在 Debian 10 上使用网络管理器更改 MAC 地址](https://linux22.com/image/174810/%E5%9C%A8%20Debian%2010%20%E4%B8%8A%E4%BD%BF%E7%94%A8%E7%BD%91%E7%BB%9C%E7%AE%A1%E7%90%86%E5%99%A8%E6%9B%B4%E6%94%B9%20MAC%20%E5%9C%B0%E5%9D%80.png)
在之前的会话中查看 Debian 10 上的系统日志文件时,我注意到 MAC 地址发生了变化,但我不知道为什么会发生这种情况。关于如何阻止这种情况有什么想法吗?
Jun 8 15:43:46 NetworkManager[729]: <info> [1591623826.4785] manager: NetworkManager state is now CONNECTED_LOCAL
Jun 8 15:43:46 NetworkManager[729]: <info> [1591623826.4790] device (wlp8s0): state change: unavailable -> unmanaged (reason 'sleeping', sys-iface-state: 'managed')
Jun 8 15:43:46 dbus-daemon[727]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.11' (uid=0 pid=729 comm="/usr/sbin/NetworkManager --no-daemon ")
Jun 8 15:43:46 NetworkManager[729]: <info> [1591623826.4793] device (wlp8s0): set-hw-addr: **reset MAC address to 68:5D:43:61:77:45** (unmanage)
Jun 8 15:43:46 NetworkManager[729]: <info> [1591623826.4799] device (enp7s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'managed')
Jun 8 15:43:46 kernel: [15194.894941] IPv6: ADDRCONF(NETDEV_UP): enp7s0: link is not ready
Jun 8 15:43:46 kernel: [15194.895237] RTL8211E Gigabit Ethernet r8169-700:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=r8169-700:00, irq=IGNORE)
Jun 8 15:43:46 systemd[1]: Starting Network Manager Script Dispatcher Service...
Jun 8 15:43:46 dbus-daemon[727]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Jun 8 15:43:46 systemd[1]: Started Network Manager Script Dispatcher Service.
Jun 8 15:43:46 nm-dispatcher: req:1 'down' [enp7s0]: new request (1 scripts)
Jun 8 15:43:46 nm-dispatcher: req:1 'down' [enp7s0]: start running ordered scripts...
Jun 8 15:43:46 nm-dispatcher: req:2 'connectivity-change': new request (1 scripts)
Jun 8 15:43:46 NetworkManager[729]: <info> [1591623826.6955] device (wlp8s0): state change: unmanaged -> unavailable (reason 'managed', sys-iface-state: 'managed')
Jun 8 15:43:46 kernel: [15195.108815] IPv6: ADDRCONF(NETDEV_UP): enp7s0: link is not ready
Jun 8 15:43:46 kernel: [15195.110559] IPv6: ADDRCONF(NETDEV_UP): wlp8s0: link is not ready
Jun 8 15:43:46 NetworkManager[729]: <info> [1591623826.6963] device (wlp8s0): set-hw-addr: set MAC address to **DE:5B:91:11:04:52** (scanning)
Jun 8 15:43:46 nm-dispatcher: req:2 'connectivity-change': start running ordered scripts...
答案1
MAC 地址正在被随机化。看使用 NetworkManager 随机化您的 MAC 地址
请注意,扫描 wifi 网络时会生成一个随机 MAC 地址(因为任何人都可以通过空中嗅探您的 MAC 地址),并且在建立与接入点的连接时会生成另一个地址。
您是否查看过您的配置文件/etc/NetworkManager/NetworkManager.conf
(或子目录)?如果您不喜欢这种行为,您仍然可以对某些连接(例如家庭网络)使用欺骗性但“稳定”的地址。
您还可以编辑网络管理器连接并为“克隆的 MAC 地址”字段分配一个值。