1、下載hostapd
可以到官網上下,主頁:http://w1.fi/hostapd/ ,我選擇使用hostapd-0.7.3
也可以使用wget下載:
wget http://w1.fi/releases/hostapd-x.y.z.tar.gz(這里改成自己選用的版本)
解壓並進入源碼目錄:
tar xzvf hostapd-x.y.z.tar.gz
cd hostapd-x.y.z/hostapd
2、配置hostapd,使它編譯為支持nl80211驅動
cp defconfig .config
vi .config
找到“#CONFIG_DRIVER_NL80211=y”,去掉“#”符號。保存。
3、編譯hostapd
make
編譯的過程中可能會遇到的問題及解決方法:
a、../src/drivers/driver_nl80211.c:22:31: fatal error:netlink/genl/genl.h: No such file or directory
原因:缺少libnl
解決方法:下載並編譯安裝libnl
可以到主頁下載:http://www.infradead.org/~tgr/libnl/,也可以使用git下載:git clone git://github.com/tgraf/libnl-1.1-stable.git
編譯並安裝libnl:
cdlibnl-1.1-stable
./configure
make
sudo make install
b、../src/crypto/tls_openssl.c:23:25:fatal error: openssl/ssl.h: No such file or directory
原因:缺少openssl庫
解決方法:下載並安裝openssl庫
sudo apt-get install libssl-dev
4、安裝編譯好的hostapd
sudo apt-get make install
進行到這兒的時候可以進行一個簡單的測試:
新建一個hostapd的配置文件:hostapd-minimal.conf
配置文件內容如下:
#change wlan0 to your wirelessdevice
interface=wlan0
driver=nl80211
ssid=test
channel=1
運行命令:sudo hostapd hostapd-minimal.conf
這時,用手機能搜索到一個名為“test”的WiFi熱點,但是不能連接。
使用cygwin工具將linux環境中運行的hostapd移植到windows中:http://www.linuxdiyf.com/linux/15820.html