wpa_supplicant and DHCP

Issues related to configuring your network
Post Reply
Posts: 6
Joined: 2007/10/03 09:40:42

wpa_supplicant and DHCP

Post by Steve_K » 2008/02/22 00:30:22


I've recently installed CentOS 5 on my laptop, and I'm liking it very much. It's the first time I've tried it on a laptop/desktop machine.

I use wireless a lot with my laptop, and the wireless connection uses WPA2. This all works nicely with wpa_supplicant, with one slight exception. When booting, the wpa_supplicant script is run by default [b]after[/b] the network script, which means that the laptop isn't able to get an IP address at boot time from the wireless AP.

As a workaround, I've changed the symlink to the /etc/init.d/wpa_supplicant script for runlevels 3, 4 and 5 to S09wpa_supplicant so it starts before the network script (linked as S10network). This seems to work nicely.

However I'm wondering if this is likely to cause any future problems with updates? problems with chkconfig?
Also, is there a better way to resolve this issue without changing the symlinks?


Forum Moderator
Posts: 2476
Joined: 2007/09/03 21:18:09
Location: NYC

wpa_supplicant and DHCP

Post by scottro » 2008/02/22 04:08:13

Glad you asked. :)

It was worse for a few days, wpa_supplicant was starting before message bus which was causing it all to fail, at least on Fedora.

The canonical way seems to be to leave things at the default. (I have Fedora on the laptop, so there might be some slight differences.)

Then, add the following to /etc/rc.local. (This assumes your card is wlan0, obviously, substitute with your card's designation.)

/bin/sleep 1
/sbin/dhclient wlan0

Sometimes, you might have to increase the length of sleep--on one install, it didn't work unless I did sleep 3.
Sometimes, (through a few different installs, I've had varying results) you have to, in /etc/sysconfig/network-scripts (at least in Fedora, it might be named differently in CentOS--I'm not sure if network-scripts is the later version name) set ifcfg-wlan0 to ONBOOT: no. (Then, sometimes, though not always, if you do that, above the dhclient line in /etc/rc.local you have to insert /sbin/ifconfig/wlan0 up--it really hasn't beeen consistant for me over a few installations.)

There was a bug filed, but after some discussions, the developer felt that it was better to have network start before wpa_supplicant. I have a little page with links to the bug (a to a very good howto on setting up wpa_supplicant) at

Hope this helps. It seems that part of the logic is that they go by the assumption that most people will use a GUI and NetworkManager, (I guess most people, at least in Fedora, probably do) and by the time X starts, it doesn't matter.

Like you, (and several others who filed on that bug report--there are over 60 posts on it, though not from 60 individuals) I prefer wpa_supplicant to NetworkManager.

Post Reply

Return to “CentOS 5 - Networking Support”