Madwifi AP configuration with hostapd. [Solved]

Issues Related to Networking (Wired and Wireless)

Moderator: Moderators

Madwifi AP configuration with hostapd. [Solved]

Postby Audiossis » Wed Feb 10, 2010 12:32

Hi all,

I am in the middle of migrating my laptop from Gentoo to Sabayaon. I am having difficulty setting up my Atheros (5001X+) wireless card using madwifi_ng.

On Gentoo, I was able to setup this card to run both a VAP (in access point mode) with hostapd as wlan0, and a VIF (in managed mode) using wpa_supplicant through wicd as wlan1. Both interface ran simultaneously using madwifi_ng drivers.

On Gentoo, I did this by creating the VAP and VIF when the ath_pci kernel module was loaded. I used a static configuration to start the VAP without encryption and then started hostapd which then bound to the VAP (in this case wlan0). So the access point was always running, regardless of whether or not the managed interface (wlan1) was running or not.

This left the VIF (wlan1) free to be managed by wicd. This is a configuration I have used on several Gentoo boxes

I cannot seem to achieve this in Sabayon. The network configuration scripts in Sabayon are very different to those of Gentoo, and it seems they are not as well documented. I cannot seem to figure out how to start the VAP (wlan0) without encryption and with a static IP address, which is required by hostapd. Nor can I seem to find any documentation on this subject in Google, that specifically pertains to Sabayon.

Every static configuration I try for he VAP (wlan0) results in the network scripts trying to start wpa_supplicant immediately after the interface is brought up. I do not want wpa_supplicant to bind to this interface as it needs to be managed by hostapd.

Could somebody please explain how to prevent the network scripts from trying to start wpa_supplicant every time I start wlan0?

In Gentoo, I was able to prevent the network scripts from starting wpa_supplicant by using the network configuration file as follows.

/etc/conf.d/net:
Code: Select all
modules_wlan0="!ifconfig !iwconfig !wpa_supplicant"
essid_wlan0=Odysseus"
mode_wlan0="master"
chann_wlan0="12"
config_wlan0=( "15.0.1.1 netmask 255.255.0.0" )


And then calling hostapd in a "postup" routine.


In Sabayon, I have tried:

/etc/conf.d/network:
Code: Select all
ifup_wlan0="iwconfig \$int key off enc open essid Odysseus"
ifconfig_wlan0=15.0.1.1 netmask 255.255.0.0"


and

/etc/conf.d/network:
Code: Select all
###ifup_wlan0="iwconfig \$int key off enc open essid Odysseus"
ifconfig_wlan0=15.0.1.1 netmask 255.255.0.0"


But nothing works. Every configuration I try (including none at all) results in the same effect, which is wpa_supplicant trying to bind to wlan0 (and failing due to the interface being in master mode) when I don't want it to.

Thanks.
Last edited by Audiossis on Thu Feb 11, 2010 7:13, edited 1 time in total.
Audiossis
Baby Hen
 
Posts: 7
Joined: Tue Feb 09, 2010 5:17

Re: Madwifi AP configuration with hostapd.

Postby Audiossis » Thu Feb 11, 2010 7:11

OK never mind, I made another newbie mistake and became confused by the existence of the file /etc/conf.d/network. :oops:

I realize now that, like Gentoo, the correct configuration file is /etc/conf.d/net. However, when I tried to use my original Gentoo /etc/conf.d/net file it didn't work

The differences between the Gentoo and Sabayon network scripts are not that great after all. This experience has however highlighted what could be a bug in the Gentoo scripts though.....

On Gentoo I used:

/etc/conf.d/net
Code: Select all
modules_wlan0="!iwconfig !ifconfig !wpa_supplicant"
essid_wlan0="Odysseus"
mode_wlan0="master"
channel_wlan0="12"
config_wlan0=( "15.0.1.1 netmask 255.255.0.0" )


which worked on Gentoo, though it probably shouldn't have since I've told it not to use iwconfig or ifconfig to bring up the interface. Indeed this was the problem on Sabayon.

When I tried this configuration on Sabayon, I got the error message:
* Caching service dependencies
* Bringing up interface wlan0
/lib/rc/net/wpa_supplicant.sh: line 64: _is_wireless: command not found
/etc/init.d/net.wlan0: line 510: _exists: command not found
* ERROR: Interface wlan0 does not exist
* Ensure that you have loaded the correct kernel modules for your hardware
* ERROR: net.wlan0 failed to start



But when I use this configuration in Sabayon:

/etc/conf.d/net
Code: Select all
modules_wlan0="!wpa_supplicant"
essid_wlan0="Odysseus"
mode_wlan0="master"
channel_wlan0="12"
config_wlan0=( "15.0.1.1 netmask 255.255.0.0" )


It works correctly!

This means that the Gentoo network scripts were still using ifconfig and iwconfig to start the interface, despite the fact that I had tried (stupidly) to disable them!

I must say though, that the error message issue by the Sabayon scripts is rather confusing. Perhaps there should be a trap in the script to catch silly mistakes like this.......?
Audiossis
Baby Hen
 
Posts: 7
Joined: Tue Feb 09, 2010 5:17


Return to Networking and Wireless

Who is online

Users browsing this forum: No registered users and 1 guest