AssetBurned
Posts: 11
Joined: Wed Mar 02, 2016 1:59 am

Hostapd with RTL8188cus on Jessie

Wed Mar 02, 2016 2:21 am

Hi,

I tried to get the host mode running of some RTL8188cus USB sticks that I bought on eBay for cheap money. However it did't work.

So I browsed the web and checked the forum here and was quiet disappointed about this topic.

It looks like there are plenty of guides for Wheezy (some 3.x kernel), but nothing for Jessie (the Debian branch that is part of the Noobs 1.8.0 release).

Also all the dropbox and private web page links I could find downloaded the same 0.8.x release of hostapd which is horrible outdated and I can't even find it on the official change log page https://w1.fi/cgit/hostap/plain/hostapd/ChangeLog

Long story short... here is what I did.

First I checked for what I have as USB dongles. You can do that with the command lsusb.

Then I install the hostapd like you can find it everywhere and adjust the config files as you wish.

Then I did this:

Code: Select all

# creating an folder to work in
mkdir hostapd-comp
cd hostapd-comp

# getting the source from hosted 2.4 (not the latest but works with Noobs 1.8.0)
wget https://w1.fi/releases/hostapd-2.4.tar.gz
tar zxvf hostapd-2.4.tar.gz
cd hostapd-2.4

# getting the source for the patch to allow WiFi chips such as RT8188C and RT8192C, who are recognized as RTL8188CUS
wget https://github.com/pritambaral/hostapd-rtl871xdrv/archive/hostapd_2_4.zip
unzip hostapd_2_4.zip

# now we patch the original source
patch -Np1 -i hostapd-rtl871xdrv-hostapd_2_4/rtlxdrv.patch
cp hostapd-rtl871xdrv-hostapd_2_4/driver_rt* src/drivers/
cp hostapd-rtl871xdrv-hostapd_2_4/.config hostapd/.config

cd hostapd
# the following may take a while and hopefully will not terminate
make

# Checking if it could be compiled and shows the patch
# it should show a line containing ”hostapd v2.4 for Realtek rtl871xdrv”
./hostapd -v

# moving the original hostapd files out of the way and saving them as a backup
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
sudo mv /usr/sbin/hostapd_cli /usr/sbin/hostapd_cli.bak

# putting the new hostapd files in place
sudo cp hostapd /usr/sbin/hostapd
sudo cp hostapd_cli /usr/sbin/hostapd_cli

# now cleaning up again (deleting all the stuff that we downloaded and extracted)
cd ..
sudo rm -R hostapd-comp
Fun facts now:
  • You now have a slightly newer version of hostapd. The one you can get via apt-get is 2.3 and you have now 2.4. As of writing this 2.5 is the latest version.
  • In the driver line in the /etc/hostapd/hostapd.conf can be ignored now.
  • If you want to use two different USB dongle you can do so by using separated /etc/hostapd/hostapd.conf files e.g. /etc/hostapd/hostapd-1.conf and /etc/hostapd/hostapd-2.conf. You then need to adjust the /etc/default/hostapd to have following line in there: DAEMON_CONF="/etc/hostapd/hostapd-1.conf /etc/hostapd/hostapd-2.conf"
  • you might want to disable autoupdate for your hostapd or backup those two files
Thanks to pritambaral on GitHub and Jorrit in the ipfire.org forum!

Reference:
http://forum.ipfire.org/viewtopic.php?t=14654
https://github.com/pritambaral/hostapd-rtl871xdrv

CU AssetBurned

GrantMatthews
Posts: 2
Joined: Wed Mar 09, 2016 4:17 am

Re: Hostapd with RTL8188cus on Jessie

Wed Mar 09, 2016 4:20 am

Hi - many thanks for your post, it compiled perfectly. However, I still can't get a connection. The SSID is visible but connection times out before any completed handshake. Nothing is shown in syslog nor does running hostapd in interactive mode show anything...

Any ideas?

AssetBurned
Posts: 11
Joined: Wed Mar 02, 2016 1:59 am

Re: Hostapd with RTL8188cus on Jessie

Thu Mar 10, 2016 3:54 am

did you tried to run hostapd from the command line?
that should give some more info about what is happening.

GrantMatthews
Posts: 2
Joined: Wed Mar 09, 2016 4:17 am

Re: Hostapd with RTL8188cus on Jessie

Thu Mar 10, 2016 5:02 pm

I did - nothing shown.

After some extended troubleshooting, I have found that I need to stop avahi-daemon, then restart hostapd, then I can connect other LAN devices to the AP. It remains working, even if I restart avahi-daemon. However on reboot, I'm broken again.


One thing I do note is that avahi-daemon registers the fixed IP of the wlan0 but also assigns another address 169.254.49.102 - which would suggest that its causing a problem and it can't get a dhcp address for the second IP... really I'm down to guessing now...

So there must be something clashing.... any guidance would be great.

AssetBurned
Posts: 11
Joined: Wed Mar 02, 2016 1:59 am

Re: Hostapd with RTL8188cus on Jessie

Sun Mar 13, 2016 9:58 pm

Hmm i currently can not try this out but as an idea... maybe there is an power saving setting interfering?
viewtopic.php?f=28&t=72902 is about the power saving issue.

I also found a nicer way on how to get to the hostapd that supports more WiFi adapters, will write it down this week if I have a bit of time.

CU AssetBurned ;-)

AssetBurned
Posts: 11
Joined: Wed Mar 02, 2016 1:59 am

Re: Hostapd with RTL8188cus on Jessie

Sat Mar 19, 2016 12:54 pm

so I had a bit more time to test here as well.

I Guess my setup is a bit different then yours. I set my IP addresses for the interfaces via my own startup script. I went this way to be able to load the config from an FAT partition in case I can not access the machine so that I can quickly change the configuration on my Mac by using the microSD.
Also I primary fiddle around with self organising IPv6 networks and do not depend on the IPv4. IPv4 is used only as another fallback on WLAN2 in my setup that almost never have connected (as this requires 3 network interfaces) and is not using hostapd.

Anyhow yes if I set an IPv4 in /etc/network/interfaces it is getting ignored. Therefore my Mac keeps on moving up and down the WiFi symbol as if it is trying to connect. It however is connected to the network, it just doesn't get an IPv4 (I have no DHCP running).
After setting an IPv4 on the Raspberry with

Code: Select all

ifconfig wlan0 10.4.0.1 netmask 255.255.0.0
and manually setting my Macs IP to 10.4.0.2 both devices can interact with each other.

Regarding the easier way to get a hostapd 2.4 version this is the way:

Code: Select all

mkdir a
cd a
wget https://github.com/lostincynicism/hostapd-rtl8188/blob/master/hostapd/hostapd?raw=true
ls -lah
mv hostapd\?raw\=true hostapd
chmod +x hostapd 
./hostapd -v
There is also an corresponding hostapd_cli on https://github.com/lostincynicism/hosta ... er/hostapd.
The downside (you need to use the "driver=rtl871xdrv" again but it works for all cards, at least in my case).

CU AssetBurned ;-)

ult_avatar
Posts: 1
Joined: Thu Apr 06, 2017 9:05 am

Re: Hostapd with RTL8188cus on Jessie

Thu Apr 06, 2017 9:16 am

AssetBurned wrote:Hi,

I tried to get the host mode running of some RTL8188cus USB sticks that I bought on eBay for cheap money. However it did't work.

So I browsed the web and checked the forum here and was quiet disappointed about this topic.

It looks like there are plenty of guides for Wheezy (some 3.x kernel), but nothing for Jessie (the Debian branch that is part of the Noobs 1.8.0 release).

Also all the dropbox and private web page links I could find downloaded the same 0.8.x release of hostapd which is horrible outdated and I can't even find it on the official change log page https://w1.fi/cgit/hostap/plain/hostapd/ChangeLog

Long story short... here is what I did.

First I checked for what I have as USB dongles. You can do that with the command lsusb.

Then I install the hostapd like you can find it everywhere and adjust the config files as you wish.

Then I did this:

Code: Select all

# creating an folder to work in
mkdir hostapd-comp
cd hostapd-comp

# getting the source from hosted 2.4 (not the latest but works with Noobs 1.8.0)
wget https://w1.fi/releases/hostapd-2.4.tar.gz
tar zxvf hostapd-2.4.tar.gz
cd hostapd-2.4

# getting the source for the patch to allow WiFi chips such as RT8188C and RT8192C, who are recognized as RTL8188CUS
wget https://github.com/pritambaral/hostapd-rtl871xdrv/archive/hostapd_2_4.zip
unzip hostapd_2_4.zip

# now we patch the original source
patch -Np1 -i hostapd-rtl871xdrv-hostapd_2_4/rtlxdrv.patch
cp hostapd-rtl871xdrv-hostapd_2_4/driver_rt* src/drivers/
cp hostapd-rtl871xdrv-hostapd_2_4/.config hostapd/.config

cd hostapd
# the following may take a while and hopefully will not terminate
make

# Checking if it could be compiled and shows the patch
# it should show a line containing ”hostapd v2.4 for Realtek rtl871xdrv”
./hostapd -v

# moving the original hostapd files out of the way and saving them as a backup
sudo mv /usr/sbin/hostapd /usr/sbin/hostapd.bak
sudo mv /usr/sbin/hostapd_cli /usr/sbin/hostapd_cli.bak

# putting the new hostapd files in place
sudo cp hostapd /usr/sbin/hostapd
sudo cp hostapd_cli /usr/sbin/hostapd_cli

# now cleaning up again (deleting all the stuff that we downloaded and extracted)
cd ..
sudo rm -R hostapd-comp
Fun facts now:
  • You now have a slightly newer version of hostapd. The one you can get via apt-get is 2.3 and you have now 2.4. As of writing this 2.5 is the latest version.
  • In the driver line in the /etc/hostapd/hostapd.conf can be ignored now.
  • If you want to use two different USB dongle you can do so by using separated /etc/hostapd/hostapd.conf files e.g. /etc/hostapd/hostapd-1.conf and /etc/hostapd/hostapd-2.conf. You then need to adjust the /etc/default/hostapd to have following line in there: DAEMON_CONF="/etc/hostapd/hostapd-1.conf /etc/hostapd/hostapd-2.conf"
  • you might want to disable autoupdate for your hostapd or backup those two files
Thanks to pritambaral on GitHub and Jorrit in the ipfire.org forum!

Reference:
http://forum.ipfire.org/viewtopic.php?t=14654
https://github.com/pritambaral/hostapd-rtl871xdrv

CU AssetBurned
Thanks AssetBurned!

I created this account just to thank you for your manual - worked like a charm!
Before, my AP kept disconnecting my clients before they could even aquire an IP address.. now everything works!

Cheers
utl_avatar

Return to “Troubleshooting”