Compiler et configurer hostapd.

par

dans

Qui n'a jamais reve d'avoir un reseau wifi au maximum de ses capacites malgre les box voisines perturbant l'environnement ?

Cet article documente la compilation et la configuration de hostapd pour creer un point d'acces wifi performant sous Linux, avec support 802.11n/ac, ACS (Automatic Channel Selection) et WPS.

Script d'installation

Le script ci-dessous automatise la compilation de hostapd depuis les sources avec les options avancees (ACS, 802.11ac, WPS, P2P) :

#!/bin/bash
# Definition de quelques couleurs
red='e[0;31m'
RED='e[1;31m'
NC='e[0m'

if [ "$USER" != "root" ]; then
    echo -e ${RED}"Vous devez etre root pour lancer ce programme!"${NC}
    exit 1
fi

VERSION=2.5
apt-get install pkg-config make patch gcc libnl-genl-3-dev libnl-3-dev bridge-utils hostapd libssl-dev -y

brctl addbr br0
brctl addif br0 eth0
echo 'DAEMON_CONF="/etc/hostapd/wlan0.conf"' > /etc/default/hostapd

cd /usr/local/src/
wget http://w1.fi/releases/hostapd-${VERSION}.tar.gz
tar xzvf hostapd-${VERSION}.tar.gz

cd hostapd-${VERSION}/
wget http://jbsky.fr/Download/patch.hostapd
patch -p0 < patch.hostapd

cd ../hostapd-${VERSION}/hostapd
cp defconfig .config
cat << EOF >> .config
CONFIG_ACS=y
CONFIG_IEEE80211R=y
CONFIG_IEEE80211N=y
CONFIG_IEEE80211AC=y
CONFIG_DRIVER_NL80211=y
CONFIG_LIBNL32=y
CONFIG_LIBNL20=y
CONFIG_CTRL_IFACE=y
CONFIG_WPS=y
CONFIG_WPS2=y
CONFIG_P2P=y
CONFIG_AP=y
EOF

make
cp hostapd /usr/sbin/
cp hostapd_cli /usr/sbin/

Configuration

Les fichiers de configuration sont a placer dans /etc/hostapd/. Exemple pour un point d'acces 2.4 GHz en WPA2 :

interface=wlan0
# bridge=br0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=Hotspot_2Ghz
ignore_broadcast_ssid=0
hw_mode=g
channel=11
auth_algs=1
wmm_enabled=1
ieee80211n=1
ht_capab=[LDPC][SHORT-GI-20][SHORT-GI-40][HT40-]
ieee80211ac=0

wpa=2
wpa_passphrase=password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
country_code=FR

Points notables

  • ACS (CONFIG_ACS=y) : selection automatique du canal le moins encombre
  • 802.11n (CONFIG_IEEE80211N=y) : support des debits HT (High Throughput)
  • 802.11ac (CONFIG_IEEE80211AC=y) : support VHT (Very High Throughput) pour les cartes 5 GHz
  • 802.11r (CONFIG_IEEE80211R=y) : fast roaming entre points d'acces
  • WPS : association simplifiee (desactiver en production pour la securite)

Liens

Articles connexes