Hostapd简介:
简单说,hostapd能够使得无线网卡切换为master模式,模拟AP(通常可以认为是路由器)功能,也就是我们说的软AP(Soft AP)。
Hostapd的功能就是作为AP的认证服务器,负责控制管理stations(通常可以认为带无线网卡的PC)的接入和认证。
通过Hostapd可以将无线网卡切换为AP/Master模式,通过修改配置文件,可以建立一个开放式的(不加密)的,WEP,WPA或WPA2的无线网络。并且通过修改配置文件可以设置无线网卡的各种参数,包括频率,信号,beacon包时间间隔,是否发送beacon包,如果响应探针请求等等。还可以设置mac地址过滤条件等。具体可以参考它的配置文件说明。
下面就从官网上摘下的部分原因及翻译。翻译的不好请见谅。
hostapd is an IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator.
Hostapd是IEEE 802.11 AP and IEEE 802.1X/WPA/WPA2/EAP/RADIUS的认证器
hostapd is a user space daemon for access point and authentication servers. It implements IEEE 802.11 access point management, IEEE 802.1X/WPA/WPA2/EAP Authenticators, RADIUS client, EAP server, and RADIUS authentication server. The current version supports Linux (Host AP, madwifi, mac80211-based drivers) and FreeBSD (net80211).
Hostapd是一个访问点以及认证服务器的运行于用户空间的守护程序。它实现了IEEE 802.11接入带你(Access Point)的管理功能,是IEEE 802.1X/WPA/WPA2/EAP的认证器,是 RADIUS client, EAP server, and RADIUS认证服务器。当前版本的hostapd支持linux上Host AP,madwifi和基于mac80211协议栈的驱动程序,以及FreeBSD上net80211协议栈的驱动程序。
hostapd is designed to be a “daemon” program that runs in the background and acts as the backend component controlling authentication. hostapd supports separate frontend programs and an example text-based frontend, hostapd_cli, is included with hostapd.
Hostapd是一个后台守护进程,作为后台组件来控制和管理认证功能。Hostapd支持多个前台程序。hostapd_cli,就是一个跟hostapd一起的命令行前台程序。
下面我们来看一下利用hostapd和dhcpd在Ubuntu系统上建立无线热点的方法:
执行 iwlist 如果 Supported interface modes 的下有 AP 的话表示该网卡支持AP模式,可以创建无线热点。
比如我的无线网卡是Qualcomm Atheros AR9485 Wireless Network Adapter,Linux内核自带了驱动ath9k,支持创建AP无线热点。
1. 安装hostapd和dhcpd
复制代码
sudo apt-get install hostapd isc-dhcp-server
开机不需要启动这两个服务,建议把它们关掉:
复制代码sudo update-rc.d -f hostapd remove
注释掉下面两个文件start on那一行:
复制代码sudo nano /etc/init/isc-dhcp-server.conf
sudo nano /etc/init/isc-dhcp-server6.conf










