Hi,

I took days(or weeks, I don’t know exactly) to set up an access point on debian. Yeah, it’s not so complicated if you have Atheros chip set in your wifi card.

But I like Murphy, and I didn’t checked the compatibility correctly, as I remember, so I chose a  TL-WN822N v3.0, with RTL8192CU chip set.

I found some post where somebody say it’s impossible to make it work, but I can’t believe and these port made me more determined.

The goal is, we will install the hostapd via apt-get, download another manually, prepare it to work with a different driver, and overload the old binary files.

So, how I got it:

1.) Install the packages

Install the driver and the dependencies:

apt-get install bridge-utils vlan wireless-tools iw wpasupplicant isc-dhcp-server linux-headers-... dkms hostapd
git clone https://github.com/dz0ny/rt8192cu.git
cd rt8192cu
make
sudo make install

As you probably noticed, we installed the hostapd via apt.
I did it because we need all files, we will just use different binaries.

 

2.) Set your country code

iw reg set HU

3.) Patch it up!

Download the latest hostapd manually from there. I used that one.

Then copy all patch files to the hostapd directory where the hostapd and the src folders located:

unzip hostapd-2.4.zip
unzip hostapd-rtl871xdrv-master.zip
cp hostapd-rtl871xdrv-master/* hostapd-2.4/hostapd-2.4/
cp hostapd-rtl871xdrv-master/.c* hostapd-2.4/hostapd-2.4/
cd hostapd-2.4/hostapd-2.4/

Now you should be in the folder where the hostapd and the src located. Run the patch:

patch -Np1 -i rtlxdrv.patch

Then copy the driver_rtl.h and driver_rtw.c files into src/drivers directory.

If it’s done, then copy the .config file to hostapd directory, and install the daemon:

cp .config ./hostapd/
cd hostapd
make
make install

Then it will create the binary files somewhere(hostapd, hostapd_cli), you should copy them to /usr/sbin:

cp /usr/sbin/hostapd  /usr/sbin/hostapd-old
cp /usr/sbin/hostapd_cli /usr/sbin/hostapd_cli-old
cp /usr/local/bin/hostapd /usr/sbin/hostapd
cp /usr/local/bin/hostapd_cli /usr/sbin/hostapd_cl

Edit the /etc/default/hostapd file, add the following:

DAEMON_CONF="/etc/hostapd/hostapd.conf"

4.) Config the daemon

Open up the /etc/hostapd/hostapd.conf. It should looks like:

## Basic setup

interface=wlan0
bridge=br1
driver=rtl871xdrv
hw_mode=g
channel=1
macaddr_acl=0

country_code=HU

ieee80211n=1    # 802.11n support
wmm_enabled=1   # QoS support
ieee80211d=1          # limit the frequencies used to those allowed in the country


ssid=AirKcorp
auth_algs=1           # 1=wpa, 2=wep, 3=both
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
wpa_passphrase=12345678

Then, as a last step start the hostapd:

service hostapd start

If you want to tune the power of your wifi card, you can add a line to your /etc/network/interfaces file. Here is mine one as a reference:

## Lan part
allow-hotplug wlan0
iface wlan0 inet manual
iface eth0 inet manual
iface eth0.100 inet manual
  vlan-raw-device eth0
iface eth0.128 inet manual
  vlan-raw-device eth0

# Connection to Home
auto br1
iface br1 inet static
  address 172.17.9.126
  netmask 255.255.255.128
  bridge_ports eth0.128 wlan0
  bridge_stp off
  bridge_waitport 5
  prepend domain-name-servers 127.0.0.1
  bridge_maxwait 5
  post-up iwconfig wlan0 txpower 12

That should work now as a basic AP.

 

Advertisements