![NixOS 下带有 wpa_supplicant 的 wlp2s0](https://linux22.com/image/1584784/NixOS%20%E4%B8%8B%E5%B8%A6%E6%9C%89%20wpa_supplicant%20%E7%9A%84%20wlp2s0.png)
我有一个 NixOS 系统(nixoshttps://nixos.org/channels/nixos-18.03)。使用wpa_supplicant
,我无法让我的无线网卡连接到我的家庭网络(WPA2)。
它使用新的Systemd 可预测的网络接口名称方案(wlp2s0
替换wlan0
)。
A)下列的NixOS 手册 / 11.6 无线网络,我设置了 WPA sid 和密码。
$ wpa_passphrase ESSID PSK > /etc/wpa_supplicant.conf
$ systemctl restart wpa_supplicant.service
模块wpa_supplicant
可以是活动的
$ systemctl status wpa_supplicant
● wpa_supplicant.service - WPA Supplicant
Loaded: loaded (/nix/store/fw6xw11p5nprhbchdgapj54js84zk97l-unit-wpa_supplicant.service/wpa_supplicant.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2019-03-09 14:40:43 EST; 1min 11s ago
Main PID: 800 (wpa_supplicant)
Tasks: 1 (limit: 4915)
CGroup: /system.slice/wpa_supplicant.service
└─800 wpa_supplicant -s -u -Dnl80211,wext -c /etc/wpa_supplicant.conf -iwlp2s0
Mar 09 14:40:43 nixos systemd[1]: Started WPA Supplicant.
Mar 09 14:40:48 nixos wpa_supplicant[800]: Successfully initialized wpa_supplicant
或者已加载,但不处于活动状态。
$ systemctl status wpa_supplicant
● wpa_supplicant.service - WPA Supplicant
Loaded: loaded (/nix/store/fw6xw11p5nprhbchdgapj54js84zk97l-unit-wpa_supplicant.service/wpa_supplicant.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Sat 2019-03-09 12:04:11 EST; 2h 30min ago
Process: 2017 ExecStart=/nix/store/77cvdnjyb1djvirr61591ipgnm6nx9mx-unit-script/bin/wpa_supplicant-start (code=exited, status=0/SUCCESS)
Main PID: 2017 (code=exited, status=0/SUCCESS)
Mar 09 11:59:03 nixos systemd[1]: Started WPA Supplicant.
Mar 09 11:59:03 nixos wpa_supplicant[2017]: Successfully initialized wpa_supplicant
Mar 09 12:04:11 nixos wpa_supplicant[2017]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlp2s0/drop_unicast_in_l2_multicast: No such file or directo>
Mar 09 12:04:11 nixos wpa_supplicant[2017]: nl80211: Failed to set IPv4 unicast in multicast filter
Mar 09 12:04:11 nixos wpa_supplicant[2017]: nl80211: Failed to open /proc/sys/net/ipv4/conf/p2p-dev-wlp2s0/drop_unicast_in_l2_multicast: No such file or directo>
Mar 09 12:04:11 nixos wpa_supplicant[2017]: nl80211: Failed to set IPv4 unicast in multicast filter
Mar 09 12:04:11 nixos wpa_supplicant[2017]: nl80211: deinit ifname=p2p-dev-wlp2s0 disabled_11b_rates=0
Mar 09 12:04:11 nixos wpa_supplicant[2017]: p2p-dev-wlp2s0: CTRL-EVENT-TERMINATING
Mar 09 12:04:11 nixos wpa_supplicant[2017]: nl80211: deinit ifname=wlp2s0 disabled_11b_rates=0
Mar 09 12:04:11 nixos wpa_supplicant[2017]: wlp2s0: CTRL-EVENT-TERMINATING
无论如何,我仍然无法 ping 网址。
$ iwconfig
lo no wireless extensions.
wlp2s0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=0 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
enp0s20f0u2 no wireless extensions.
enp0s31f6 no wireless extensions.
B)我也尝试过手动设置 SSID 和密码。但没成功。
$ iwlist wlp2s0 scan
$ iwconfig wlp2s0 essid <mysid> key s:<mypassphrase>
C)我搜索了互联网,发现有人遇到了类似的问题。但这些解决方案对我不起作用(关闭、刷新、启动 wlp2s0、重新绑定 wpa_supplicant)。
$ ip link set dev wlp2s0 down
$ ip addr flush dev wlp2s0
$ ip link set dev wlp2s0 up
$ wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant.conf
Successfully initialized wpa_supplicant
nl80211: Could not set interface 'p2p-dev-wlp2s0' UP
nl80211: deinit ifname=p2p-dev-wlp2s0 disabled_11b_rates=0
p2p-dev-wlp2s0: Failed to initialize driver interface
P2P: Failed to enable P2P Device interface