Wlan mit wpa_supplicant unter NixOS?

1652
musicmatze

Wie kann man mit wpa_supplicant ein Netzwerk (wlan) auf NixOS einrichten? Immer wenn ich versuche, mich mit meinem lokalen WLAN-Netzwerk zu verbinden, bekomme ich einen CONN_FAILEDGrund dafür, was ein wenig informativ ist. Es sagt mir auch, dass meine pksnicht gültig ist ( WRONG_KEY), aber ich habe bestätigt, dass es richtig ist, und ich habe die Konfiguration mit demselben Schlüssel (git-Version gesteuert) im Netzwerk meiner Archlinux-Box verwendet, und es hat funktioniert.

1

1 Antwort auf die Frage

5
MariusMatutiae

I doubt it will become any more informative than what you already have, yet here we go.

First we need to store our WPA2-PSK secrets:

 wpa_passphrase MyWifiSSID MySecretPassword > wpa_supplicant.conf 

Now make sure you have stopped a Network Manager, if you use one, and issue all the following commands as sudo. We clean the interface (I call it wlan0):

 ip link set dev wlan0 down ip addr flush dev wlan0 ip link set dev wlan0 up 

Now we associate to the AP:

 wpa_supplicant -B -i wlan0 -Dnl80211 -c wpa_supplicant.conf dhclient wlan0 

If the network is correctly configured, then you are done. If there are some errors in the DHCP configuration, you may be missing either the default gateway or the DNS servers. You can set them just as I am about to do in the case of a static IP.

If you do not have a DHCP server, or if you wish to give yourself a static IP (say, 192.168.1.200), then skip the last command above, and issue instead

 ip addr add 192.168.1.200/24 dev wlan0 

Remember, 24 is the network mask in CIDR notation. If yours differs, please adjust accordingly. Once this is done, you will need a default gateway:

 ip route add default via 192.168.1.1 dev wlan0 

where 192.168.1.1 is the address of your home router/gateway, and DNS servers,

 echo nameserver 8.8.8.8 >> /etc/resolv.conf echo nameserver 8.8.4.4 >> /etc/resolv.conf 

This is it.

Ich werde das so schnell wie möglich ausprobieren, festhalten! musicmatze vor 8 Jahren 0
Dies funktioniert, ich bekomme WLAN, aber ich kann immer noch nicht in meinem internen Netzwerk pingen. musicmatze vor 8 Jahren 0
@musicmatze Vielleicht läuft dhcpd nicht? Oder nicht an dieser Schnittstelle? Daniel Jour vor 8 Jahren 0
@DanielJour Nein, das ist nicht das Problem. Höchstwahrscheinlich hat er kein Standard-Gateway und keine DNS-Server eingerichtet. MariusMatutiae vor 8 Jahren 1
Es funktioniert jetzt. Ich bin mir nicht sicher über DNS oder Gateway ... Ich werde dies als passende Antwort markieren. musicmatze vor 8 Jahren 0