HOSTAPD source code compilation and configuration

Source: Internet
Author: User






HOSTAPD is a Wi-Fi hypervisor under Linux





Download HOSTAPD Source code


First need to download HOSTAPD source code from the official website, there are two ways



One is to get HOSTAPD's latest development version from the official Git repository.


git clone git://w1.fi/srv/git/hostap.git
cd hostap/hostapd


The second is to download a stable version from the official website, http://w1.fi/hostapd/


 
wget http://w1.fi/releases/
wget http://w1.fi/releases/hostapd-2.6.tar.gz
tar xzvf hostapd-2.6.tar.gz
cd hostapd-2.6/hostapd
-2.6.tar.gz tar xzvf hostapd-2.6.tar.gz cd hostapd-2.6/hostapd


Then we need to configure HOSTAPD so that it can get support for nl80211 drivers. Copy the Deconfig file in the HOSTAPD directory to. config and edit it.


 
cp defconfig .config
vi .config


Find the following line, remove the # comment


#CONFIG_DRIVER_NL80211 =y


You can then compile the HOSTAPD.


Make





During the compilation process, we may encounter several problems



Question 1:


driver_nl80211.c:21:31: warning: netlink/genl/genl.h: No such file or directory
driver_nl80211.c:22:33: warning: netlink/genl/family.h: No such file or directory
driver_nl80211.c:23:31: warning: netlink/genl/ctrl.h: No such file or directory
driver_nl80211.c:24:25: warning: netlink/msg.h: No such file or directory
driver_nl80211.c:25:26: warning: netlink/attr.h: No such file or directory


Workaround:



Installing the LIBNL and LIBSSL libraries


sudo Install linssl-dev libnl-3-dev


If you still have a problem, edit the. config file, remove the comment from the following statement, and make again.


#CONFIG_LIBNL32 =y




Configure HOSTAPD


In the downloaded HOSTAPD directory there is a default profile hostapd.conf, but too many configurations, for beginners is not very good understanding, we first create a simple configuration file hostapd-minimal.conf, the HOSTAPD function to verify.



Edit hostapd-minimal.conf File


 
#wlan0 is your wireless network card name
interface=wlan0
driver=nl80211
ssid=test
hw_mode=g
channel=1


After the configuration is complete, you can use the command to try to turn on HOSTAPD


./hostapd./hostapd-minimal.conf


You may encounter the following error


 
Configuration file: hostapd-minimal.conf
nl80211: Could not configure driver mode
nl80211: deinit ifname=wlp9s0b1 disabled_11b_rates=0
nl80211 driver initialization failed.
wlp9s0b1: interface state UNINITIALIZED->DISABLED
wlp9s0b1: AP-DISABLED 
hostapd_free_hapd_data: Interface wlp9s0b1 wasn‘t started


This is because there are other network programs that occupy the wireless card interface, you must first shut down the system itself wireless network management Program


 
sudo nmcli radio wifi off
sudo rfkill unblock wlan
sudo ifconfig wlan0 192.168.1.1/24 up


And then open HOSTAPD. As shown below, you have successfully launched the HOSTAPD


 
Configuration file: hostapd-minimal.conf
Using interface wlp9s0b1 with hwaddr 68:94:23:8b:88:a3 and ssid "test"
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED 


Next use the mobile phone to connect WiFi, found that can search the WiFi signal, but the phone is not connected. This is because the computer does not have DHCP and routing capabilities. Next, I'll install the DHCP-related program to configure software routing.






HOSTAPD source code compilation and configuration


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.