PDA

View Full Version : How to install Hostapd v2.3 devel + Disable bss neighbor check/force 40 MHz channels



Nick_the_Greek
2014-10-06, 17:25
The following procedure is a part of
Aerial - How to E-Z Setup a Multi-mode wireless LAN Based on a Software Access point (https://forums.kali.org/showthread.php?23028-Aerial-Multi-mode-wireless-LAN-Based-on-a-Software-Access-point)

Let's install the dependencies:

apt-get install -y linux-headers-"`uname -r`" build-essential
apt-get install -y libnl-3-dev libssl-dev libssl1.0.0
Create lbnl-3 symbolic links:

For Kali Linux i386 (x32):

ln -s /usr/include/libnl3/netlink/ /usr/include/
ln -s /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-3.so.200.5.2 /lib/"`dpkg --print-architecture`"-linux-gnu/libnl.so
ln -s /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl.so
ln -s /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`dpkg --print-architecture`"-linux-gnu/libnl-genl-3.so

For Kali Linux amd64 (x64):

ln -s /usr/include/libnl3/netlink/ /usr/include/
ln -s /lib/"`uname -m`"-linux-gnu/libnl-3.so.200.5.2 /lib/"`uname -m`"-linux-gnu/libnl.so
ln -s /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`uname -m`"-linux-gnu/libnl-genl.so
ln -s /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so.200.5.2 /lib/"`uname -m`"-linux-gnu/libnl-genl-3.so

Download latest hostapd:

export HOME_DIR="/root"
cd $HOME_DIR
git clone git://w1.fi/srv/git/hostap.git

Let's configure hostapd's configuration file:
# Set to yes: CONFIG_DRIVER_HOSTAP, CONFIG_DRIVER_NL80211, CONFIG_LIBNL32, CONFIG_IEEE80211N, CONFIG_IEEE80211AC, CONFIG_ACS
# Use openssl libraries
# Enable: WPS and UPnP support for external WPS Registrars


sed 's%#CONFIG_DRIVER_HOSTAP=y%CONFIG_DRIVER_HOSTAP=y% g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_DRIVER_NL80211=y%CONFIG_DRIVER_NL80211= y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_LIBNL32=y%CONFIG_LIBNL32=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_IEEE80211N=y%CONFIG_IEEE80211N=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_IEEE80211AC=y%CONFIG_IEEE80211AC=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_ACS=y%CONFIG_ACS=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_TLS=openssl%CONFIG_TLS=openssl%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_WPS=y%CONFIG_WPS=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
sed 's%#CONFIG_WPS_UPNP=y%CONFIG_WPS_UPNP=y%g' $HOME_DIR/hostap/hostapd/defconfig > $HOME_DIR/hostap/hostapd/defconfig1 && mv $HOME_DIR/hostap/hostapd/defconfig1 $HOME_DIR/hostap/hostapd/defconfig
Enable configuration file:

cp $HOME_DIR/hostap/hostapd/defconfig $HOME_DIR/hostap/hostapd/.config
Let's patch hostapd to Disable bss neighbor check and force 40 MHz channels width.
For detailed description about this patch please read this paragraph (1):
Aerial - How to E-Z Setup a Multi-mode wireless LAN Based on a Software Access point - Part 2 (https://forums.kali.org/showthread.php?23028-Aerial-Multi-mode-wireless-LAN-Based-on-a-Software-Access-point&p=38016&viewfull=1#post38016)
Open /root/hostap/src/ap/hw_features.c

nano /root/hostap/src/ap/hw_features.c
goto line 542 and change this:


iface->conf->channel,
iface->conf->channel +
iface->conf->secondary_channel * 4);
iface->conf->secondary_channel = 0;
if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) {
/*
* TODO: Could consider scheduling another scan to check
to this:

iface->conf->channel,
iface->conf->channel +
iface->conf->secondary_channel * 4);
/* iface->conf->secondary_channel = 0; */
if (iface->drv_flags & WPA_DRIVER_FLAGS_HT_2040_COEX) {
/*
* TODO: Could consider scheduling another scan to check
Let's compile and install:

make clean
make
make install
That's it! You're done. You have Hostapd v.2.3 devel compiled with nl80211 driver, IEEE80211N enabled, IEEE80211AC enabled, ACS enabled and WPS and UPnP enabled.

Please have in mind that if you want to use a wireless interface with hostapd you must first exclude that interface from controlling by network manager. To do e.g. wireless interface wlan0
Add a line to /etc/network/interfaces file

iface wlan0 inet manual
and stop and start networking and network manager

service network-manager stop
service networking stop
service networking start
service network-manager start
To undo that remove that line and redo the stop/start commands.

Enjoy!

Nick_the_Greek

bahha
2014-11-27, 18:29
thank you for the post I managed to do it .

now I have it setup with dhcp server .

the hotsapd.conf is a lot different than the old one.
too bad I have to disable the interface and restart net services whenever i use it to connect, unlike the old version that exist in repos

Nick_the_Greek
2014-11-27, 20:42
thank you for the post I managed to do it .

now I have it setup with dhcp server .

the hotsapd.conf is a lot different than the old one.
too bad I have to disable the interface and restart net services whenever i use it to connect, unlike the old version that exist in repos

Yes, it's a little bit annoying that start-stop thing but the 2.3 devel hostapd it's alot more stable, fast and we have allot more futures to 'play' with. (WPS, upnp, ieee80211ac etc) and you have to read very carefully the original hotsapd.conf file. Thank God it's very well documented.

bahha
2014-11-28, 10:12
Yes It has a lot of features compared to the old one . I have read the conf file it's well explained .
the version i pulled is 2.4 not 2.3 I don't know yet if those patches were necessary, but it's working anyway .

vytieubao
2014-11-29, 03:38
Yes It has a lot of features compared to the old one

digiz
2016-04-28, 00:07
I am really newbie. Found and installed kali 1.0.7 32bit, just to be sure that everything will be working.

Everything is fine until this step:
Let's compile and install:
Code:

make clean
make
make install

After make clean nothing is happening. Changing directory, but i cant make install. Searching for solution half a day, but i need more details how to install. I will very appreciate.
Thx

digiz
2016-04-28, 23:31
here is my solution. before make clean change directory.

cd /root/hostap/hostapd/

make clean
make
make install


I am using old chrunchbang linux. Some files are missing, but cli will tell you.