I struggled somewhat to piece together information from the Arch Linux Wiki on setting up my wireless network to connect automatically with my home network, so I thought I'd document some of the interesting tidbits I learned along the way.
To start from the beginning, I recently installed Arch Linux from scratch on my home desktop as an exercise to help me learn more about linux system administration and configuration. There's a great Beginners' Guide on Arch's wiki that was pretty darn good in getting me up and running.
One of the only things I struggled with was getting my Netgear wg111v3 USB 802.11b/g wireless adapter to automatically connect to my home network using WPA encryption. I read through their wireless setup page and decided a good way to accomplish this was via a combination of net-profiles, netcfg and wpa_supplicant. Luckily I didn't have to worry about drivers for my network adapter since the wg111v3 is apparently supported in-kernel already (hurray!).
- My first step was to connect to my network manually, so I followed the steps in the Beginners' Guide Wireless LAN section. No problems, I was pinging google in no time at all.
- Since I had a fresh install I needed to snag a few packages that I found on the Network Profiles wiki page. Technically for what I ended up doing, I think only netcfg is required, but the other two packages seem like they'll come in handy down the line and they are tiny packages, so I went nuts and included them.
# pacman -S netcfg wpa_actiond ifplugd
- As instructed by the Network Profiles page, I copied the example file that used an external wpa_supplicant.conf since I already had one generated from when I had manually connected to my network and edited it contain INTERFACE='wlan0' and WPA_CONF='/etc/wpa_supplicant.conf'
# cp /etc/network.d/examples/wireless-wpa-config /etc/network.d/mynetwork
- This is where it got tricky. I tested my configuration with netcfg and discovered things were broken.
# netcfg mynetwork
:: mynetwork up Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory - I found a forum post which confused me, but I took their advice and added the following arcane lines to my /etc/wpa_supplicant.conf and they seemed to quash this problem:
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0 - Well, things seemed to work! Now all I had to do was edit /etc/rc.conf and add @net-profiles to my DAEMONS list and mynetwork to my NETWORKS list. The @ is so that it will load asynchronously, since I didn't want to slow down my startup just to wait for my connection to kick in. So my /etc/rc.conf edits looked something like this:
File: /etc/rc.conf
NETWORKS=(mynetwork)
...
DAEMONS=(... @net-profiles) - I reboot the machine to see if all those steps had worked, and sure enough the network connected! Success!
I had a few other missteps along the way... inside my rc.conf I had wlan0 inside my INTERFACES list, which slowed down my reboots significantly since (IINM) it tried to get a DHCP lease before loading up my WPA key, resulting in a hang until it decided it was a failed operation. Removing wlan0 from INTERFACES fixed that hang and net-profiles loads up everything necessary, so good riddance!
I have a feeling that this isn't quite the end of my network setup story, but it was enough to my network up and running automatically at startup. I'm sure there are probably easier ways to accomplish this also, but I learned a fair amount about wpa_supplicant and netcfg to get to this point, so while it felt masochistic at times I think it was worth the experimentation and docs-reading.
Quick list of all the documentation I used to figure this out:
Hope you enjoyed the saga, and maybe some of it was even useful :) Peace out!
Brilliant, thanks so much for posting this.. It got me going with Arch.
Posted by: David | 2011.05.29 at 03:10
Thank you very much for sharing this.
I ran into the same issue you mentioned/solved in steps 4 and 5. Pasting those lines resolved my issue as well.
Now everything is working - thanks!!
Posted by: Cliff | 2012.02.14 at 19:28