使用NetworkManager代替wpa_supplicant管理网络

146 阅读1分钟

使用NetworkManager代替wpa_supplicant管理网络

配置/etc/NetworkManager/NetworkManager.conf,修改网卡接管状态

managed参数改为true

[main]
plugins=ifupdown,keyfile

[ifupdown]
managed=true

确保 /etc/network/interfaces 文件中没有对目标网卡接口的配置。通常,如果接口在此文件中配置,NetworkManager会将其视为未托管接口。

注释掉各个网卡的配置

# This file describes the network interfaces available on your system  
# and how to activate them. For more information, see interfaces(5).  
  
source /etc/network/interfaces.d/*  
  
# The loopback network interface  
# auto lo  
# iface lo inet loopback  
  
# The primary network interface  
# allow-hotplug wlp2s0  
# iface wlp2s0 inet dhcp  
#       wpa-ssid RedmiFly  
#       wpa-psk  12345678

禁用wpa_supplicant

sudo systemctl stop wpa_supplicant
sudo systemctl disable wpa_supplicant

重启NetworkManager

sudo systemctl restart NetworkManager

查看网卡接口状态

nmcli device status