Hostapd

Hostapd 

1、基本概念

 hostapd is an application used to setup your wireless interface as an access-point (master mode). Hostapd requires a configuration file in order to operate, and in addition, it needs to support the driver used for the wireless interface.php

2、用途

To use hostapd, you have two choices.bash

  1. use hostapd as a global service
  2. use hostapd as a standalone user application

一、Global Service

  If you install hostapd through yum (Fedoras package system), it comes with some startup scripts located in /etc/init.d. To use the service, you have to create a configuration file, put it in/etc/hostapd/hostapd.conf and issue the service hostapd start|restart|stop command.服務器

二、Standalone User Application (Preferred)

  This allows you to tailor hostapd for your experiments and set the configuration to your preferences. But as you most of the time would use nearly identical configurations, you may create a configuration file which you use for several experiments.app

終端應用

若是已經準備好配置文件hostapd.conf,能夠經過下面的指令啓動hostapd程序:less

hostapd /path/to/file/hostapd.conf

hostapd將以終端應用的方式運行,並能夠經過Ctrl+C終止程序的運行。ide

後臺程序

若是不想以終端應用的方式運行hostapd,能夠之後臺程序的方式運行它:ui

# hostapd -B /path/to/file/hostapd.conf

 

爲了能kill掉hostapd,須要經過指令將hostapd的pid寫入到文件中: spa

hostapd -B -P/path/to/pid/hostapd.pid /path/to/file/hostapd.conf

上述指令會將hostapd的pid寫入到文件hostapd.pid中rest

查看hostapd的狀態

ps aux | grep hostapd

3、配置  

For running a WPA-PSK access-point one may use a configuration file like the one belowblog

ssid=test
hw_mode=g
channel=10
interface=wlan0
bridge=br0
driver=nl80211
ignore_broadcast_ssid=0
macaddr_acl=0
accept_mac_file=/etc/hostapd.accept
deny_mac_file=/etc/hostapd.deny
  • ssid:別人所看到的無線接入點的名稱;
  • hw_mode:指定802.11協議,其中 a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g;
  • channel:設定無線頻道;
  • interface:接入點設備名稱,注意不要包含ap後綴,即若是該設備稱爲wlan0ap,填寫wlan0便可;
  • bridge:指定所處網橋;
  • driver:設定無線驅動;
  • macaddr_acl:可選,指定MAC地址過濾規則,0表示除非在禁止列表不然容許,1表示除非在容許列表不然禁止,2表示使用外部RADIUS服務器;
  • accept_mac_file:指定容許MAC列表文件所在;
  • deny_mac_file:指定禁止MAC列表文件所在;

 

相關資料

參考1:http://w1.fi/hostapd/  

參考2http://w1.fi/wpa_supplicant/devel/

相關文章
相關標籤/搜索