JTK – Notes and Ramblings Things we have found …

1/22/2012

hostapd and mythbuntu

Filed under: General,MythTV — taing @ 10:16 pm

We were looking to use the wireless card in the Acer Revo mythbuntu box as a wireless access point to extend the wifi coverage in the system. The solution is the hostapd package and a bit of configuration.

In our setup, there is a separate machine acting as primary gateway/router to the internet/DSL modem. We want the new “access point” to have the same SSID and security settings as the existing WAP. We will configure it to use a different B/G channel. The Acer Revo is connected to the main WAP and the router/gateway by wired ethernet so we will bridge the wired ethernet to the wireless interface. In this configuration the existing router/gateway will provide the DHCP services and gateway to the internet.

There were two main articles on the web I used as reference: http://www.su-root.eu/computing/turn-your-linux-computer-in-a-wireless-access-point-using-hostapd and http://blog.robin.smidsrod.no/2008/08/08/how_to_setup_an_atheros_based_access_poi.

The basic steps are to install hostapd, enable IP forwarding disable “NetworkManager” and configure the bridge. The final step is to make this automatic at startup. Our systems are running Mythbuntu Lucid (10.4) and all went well.

The Avec Revo units have a wireless card based on an Atheros chipset. This allows you to use the ath9k kernel driver. For this driver the you must use hostapd to set Master mode for the card. You will not be able to do this with iwconfig alone.

After installing hostapd via apt-get, the second part of the setup is to disable “NetworkManager” and create the appropriate bridge configuration is /etc/network/interfaces :
auto lo
iface lo inet loopback

iface eth0 inet manual

auto br0
iface br0 inet dhcp
#for testing you may want to leave wlan0 out of the bridge and add manually when hostapd is running
bridge-ports eth0 wlan0

iface wlan0 inet manual

For testing you can add or remove the wlan0 interface from the bridge using brctl addif br0 wlan0 or brctl delif br0 wlan0.

You will need to enable IP forwarding with echo 1 > /proc/sys/net/ipv4/ip_forward. If you have iptables or other firewall setup you will need to edit the config to allow the correct traffic.

The sample /etc/hostapd/hostapd.conf file from the link article worked well:
#wireless interface to use as AP
interface=wlan0

#bridge device (needed for madwifi & nl80211 drivers)
bridge=br0

#driver interface type (hostapd/wired/madwifi/prism54/test/none/nl80211/bsd)
# Use nl80211 for wifi drivers that implement MAC80211 interface
#You should set this to your relevant driver interface type
driver=nl80211

#Enables logging to standard output (useful for debugging)
logger_stdout=-1
logger_stdout_level=2

#Set SSID to use
ssid=YOUR_SSID

# Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g)
# note your card may not support every mode.
hw_mode=g

#Channel to use (1-13)
channel=6

auth_algs=3

max_num_sta=5

#Enable WPA2
wpa=2

#Set passphrase for WPA
wpa_passphrase=YOUR_PASSWORD
wpa_key_mgmt=WPA-PSK

# Set of accepted cipher suites (encryption algorithms) for pairwise keys
wpa_pairwise=TKIP CCMP
# Pairwise cipher for RSN/WPA2 (default: use wpa_pairwise value)
rsn_pairwise=CCMP

For testing you can start hostapd with sudo hostapd -d /etc/hostapd/hostapd.conf. Once all is working well you can make this a bit more automatic. If you have wlan0 set as part of br0 in /etc/network/interfaces, the only step left is to edit /etc/defaults/hostapd to set RUN_DAEMON="yes". This will allow hostapd to start at boot and allow you to use /etc/init.d/hostapd start|stop|restart to control.

For debugging you can use brctl show to view the members of the bridge. You can use hostapd_cli to control the operation of the WAP service.

No Comments

No comments yet.

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.

Powered by WordPress