Autoconnect to wifi via Netcfg and wpa2

On archlinux, to automatically connect your wifi on boot to a hidden, wpa2 encrypted network, create a wpa_supplicant.conf that looks similar to this:

ctrl_interface=DIR=/var/run/wpa_supplicant
network={
ssid=”my wifi essid”
psk=randomnumberlettercombinationhere
}

The ctrl_interface is required to store session data.

Then you also need a netcfg profile. Copy the file from /etc/network.d/examples/wireless-wpa-config to/etc/network.d/myname and edit the file to look similar to this:

CONNECTION=’wireless’
DESCRIPTION=’A wpa_supplicant configuration based wireless connection’
INTERFACE=’wlan0′
SECURITY=’wpa-config’
WPA_CONF=’/etc/wpa_supplicant.conf’
IP=’dhcp’
PRE_UP=’ifconfig wlan0 up | iwconfig wlan0 essid myessidhere’

Edit the WPA_CONF to point at the previously created wpa_supplicant.conf.

Now edit your /etc/rc.conf network and daemons configuration:

NETWORKS=(myname)
DAEMONS=(syslog-ng dbus hal @network @net-profiles @openntpd netfs crond sshd alsa slim)

On your next boot, the wifi should automatically try to connect and establish a connection. You can also try netcfg2 myname to debug it.

15.05.12

Kommentare

Leider gibt es noch keine Kommentare zu diesem Eintrag. Schreibe den ersten!


Einen Kommentar schreiben

You must be logged in to post a comment.