Page 2 of 4
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:18 pm
by iOS_Neil
So I've copied everything exactly as you've posted and....
Code: Select all
pi@raspberrypi:/etc/hostapd $ sudo hostapd -d ./hostapd.conf.O
random: Trying to read entropy from /dev/random
Configuration file: ./hostapd.conf.O
Line 14: invalid/unknown driver 'rtl1871xdrv'
1 errors found in configuration file './hostapd.conf.O'
Failed to set up interface with ./hostapd.conf.O
hostapd_init: free iface 0x16be128
Failed to initialize interface
pi@raspberrypi:/etc/hostapd $

Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:19 pm
by iOS_Neil
(That was up to your previous post, not the one you've just done...)
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:23 pm
by epoch1970
Did you remove hostapd?
We want to see this:
Code: Select all
pi@raspberrypi:~ $ dpkg -l |grep hostap
ii hostapd-rtl 2.4-4 armhf IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
pi@raspberrypi:~ $
If you didn't, backtrack (EDIT: don't undo everything you've done! I mean: re-execute the uninstall.) to the point where I apt-get remove --purge hostapd, then reinstall hostapd-rtl to be sure:
Code: Select all
pi@raspberrypi:/usr/src $ sudo dpkg -i hostapd-rtl_2.4-4_armhf.deb
(Reading database ... 152397 files and directories currently installed.)
Preparing to unpack hostapd-rtl_2.4-4_armhf.deb ...
Unpacking hostapd-rtl (2.4-4) over (2.4-4) ...
Setting up hostapd-rtl (2.4-4) ...
Processing triggers for systemd (215-17+deb8u4) ...
pi@raspberrypi:/usr/src $
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:26 pm
by iOS_Neil
I see this:
Code: Select all
pi@raspberrypi:/etc/hostapd $ dpkg -l |grep hostap
ii hostapd-rtl 2.4-4 armhf IEEE 802.11 AP, IEEE 802.1X/WPA/WPA2/EAP/RADIUS Authenticator
pi@raspberrypi:/etc/hostapd $
Should I continue with the rest from above?
Edit: Yes, I should continue. Starting with removing hostapd?
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:27 pm
by epoch1970
No, that's correct. Would you mind rebooting?
EDIT: Argh.. I'll rephrase (sorry)
If you only have hostapd-rtl installed, then it is fine. Perhaps there is an error in the old config file. The reboot is just to play it safe.
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:31 pm
by iOS_Neil
Rebooting now...(I've not removed hostapd again yet)...Ok, done.
Now going for the uninstall of hostapd.
Code: Select all
pi@raspberrypi:~ $ sudo apt-get remove --purge hostapd
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'hostapd' is not installed, so not removed
The following package was automatically installed and is no longer required:
libnl-route-3-200
Use 'apt-get autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.
pi@raspberrypi:~ $
Shall I try the new install again?
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:35 pm
by epoch1970
You can uninstall and reinstall hostapd-rtl as many times as you want, I don't think it will change anything.
Can you post the contents of hostapd.conf.O?
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:39 pm
by iOS_Neil
Code: Select all
# Basic AP parameters
ssid=worky
wpa_passphrase="easypeasy"
interface=wlan0
channel=1
# WPA 2 PSK
wpa=2
auth_algs=1
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
# Wifi-N
driver=rtl1871xdrv
hw_mode=g
ieee80211n=1
ieee80211d=1
country_code=FR
ieee80211h=1
# I'm sorry, I don't know if the right stanza is
# wme_ or wmm_ so I include both...
wme_enabled=1
wmm_enabled=1
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:40 pm
by iOS_Neil
Would countrycode=FR matter? I set mine earlier to GB (in rpi config)
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:40 pm
by epoch1970
Great! I have the same error.

Let me see why.
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:45 pm
by iOS_Neil
Ok, I've stopped exactly where I am...Shall we pick this up tomorrow? You've done so much and I am extremely grateful...
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:46 pm
by epoch1970
iOS_Neil wrote:Would countrycode=FR matter? I set mine earlier to GB (in rpi config)
Nope. It's baffling because I don't see where the pb is. But use this file instead and it should work:
Code: Select all
# Basic AP parameters
wpa_passphrase=easypeasy
ssid=worky
interface=wlan0
#### LATER ### bridge=br0
channel=1
country_code=FR
# From Realtek docs
max_num_sta=8
# hostapd-rtl specific driver
driver=rtl871xdrv
# WPA 2 PSK
wpa=2
auth_algs=1
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
# 2.4 GHz
hw_mode=g
# Wifi-N
ieee80211n=1
# QoS support - Can't find out if it's called wme or wmm !!
wme_enabled=1
wmm_enabled=1
# Avoid crash at startup with Realtek RTL8188CUS
noscan=1
# from Realtek's docs Quick_Start_Guide_for_SoftAP.pdf and
# SoftAP_Mode_features.pdf. The [DSSS_CCK-40][MAX-AMSDU-7935]
# part comes from the interweb. Use [HT40-] or [HT40+]
ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+][DSSS_CCK-40][MAX-AMSDU-7935]
And while you try that, I'll edit installment 3 because I think I skipped the bridge-utils part. I'll check now.
Re: Trying to configure wifi AP (with VPN)
Posted: Tue May 31, 2016 9:57 pm
by epoch1970
Ok, I think you're gone (or the Pi is down

But if all goes well: the conf just above will work in debug mode "hostapd -d ./hostapd.conf.whateveryoucalledit"
And then, I've revised my third installment (install of bridge-utils was missing, I've added it near the end), you can execute it and you'll have a running AP.
(of course, change the country code, and carefully adapt the SSID and password to your choosing.)
As I said, this is the connection I am using now to access the forum, it seems to work. Tomorrow I'll know if it is resilient.
Signing off for now.
EDIT: Still working fine!
EDIT2: Mystery solved. You typed "driver=rtl1871xdrv" (RTL 1871 xdrv) instead of "driver=rtl871xdrv" (RTL 871 xdrv) during edits on your side

Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 9:53 am
by iOS_Neil
Good morning
A simple typo, so often the case!
So looking through what I now need to do:
I'll work through and play catchup tonight and let you know how it goes...Great it's still working this morning.
Question: What sort of range do you get with the AP?
Neil.
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 11:12 am
by epoch1970
Hi.
So you can confidently ignore all exchanges we had last night after you reported failure.
Just execute my
3rd installment and you should be fine.
Change FR to GB, SSID, password (no quotes around the password)
What you'll have is an AP in the traditional sense: connected to the wired network, it lets wireless devices participate to the LAN. Everybody (the AP, wifi clients) are served by your home router.
I tested connection and was able to associate and stream 1080p videos across 2 thin walls and about 10m away. YMMV.
When using the iPad I was reminded that association can be sketchy when using "wpa_passphrase=cleartext_password". But it works fine with "wpa_psk=hexadecimal_string". Use "wpa_passphrase SSID cleartext_passwd" to generate the hex key, and update hostapd.conf:
Code: Select all
pi@raspberrypi:~ $ wpa_passphrase worky easypeasy
network={
ssid="worky"
#psk="easypeasy"
psk=6aad4c3ee371b077d2eb402ffe2428eb41021e4e8926da0e4da3d87859d48d4e
}
pi@raspberrypi:~ $ sudo nano /etc/hostapd/hostapd.conf
(delete:
wpa_passphrase=easypeasy
add:
wpa_psk=6aad4c3ee371b077d2eb402ffe2428eb41021e4e8926da0e4da3d87859d48d4e
save the file and restart the AP)
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 4:39 pm
by iOS_Neil
All done...But something obviously not right! I got to the end, rebooted, waited...waited....waited...No AP showed up on my iPhone. When I look directly at the wifi module, there are no blue lights flashing...

Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 4:51 pm
by epoch1970
Hum. What does "brctl show" report?
Also "ps waxu | grep hostap" ?
And "grep DAEMON_CONF /etc/default/hostapd" ?
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:04 pm
by iOS_Neil
Code: Select all
pi@raspberrypi:~ $ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.74da386ae783 yes eth0
wlan0
pi@raspberrypi:~ $ ps waxu | grep hosta
pi 2745 0.0 0.4 4268 1888 pts/0 S+ 17:04 0:00 grep --color=auto hosta
pi@raspberrypi:~ $ grep DAEMON_CONF /etc/default/hostapd
# Uncomment and set DAEMON_CONF to the absolute path of a hostapd configuration
#DAEMON_CONF="/etc/hostapd/hostapd.conf"
pi@raspberrypi:~ $
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:08 pm
by epoch1970
You missed one tiny step. Transform this:
#DAEMON_CONF="/etc/hostapd/hostapd.conf"
to this:
DAEMON_CONF="/etc/hostapd/hostapd.conf"
then try "sudo service hostapd start", or simply reboot.
Come on, you can do it!

- IMG_1227.jpg (17.75 KiB) Viewed 3261 times
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:13 pm
by iOS_Neil
Whereabouts do I put that? I've looked in my hostapd and this is the whole file:
Code: Select all
# Basic AP parameters
wpa_passphrase=easypeasy
ssid=worky
interface=wlan0
bridge=br0
channel=1
country_code=GB
# From Realtek docs
max_num_sta=8
DAEMON_CONF="/etc/hostapd/hostapd.conf"
# hostapd-rtl specific driver
driver=rtl871xdrv
# WPA 2 PSK
wpa=2
auth_algs=1
wpa_key_mgmt=WPA-PSK
rsn_pairwise=CCMP
# 2.4 GHz
hw_mode=g
# Wifi-N
ieee80211n=1
# QoS support - Can't find out if it's called wme or wmm !!
wme_enabled=1
wmm_enabled=1
# Avoid crash at startup with Realtek RTL8188CUS
noscan=1
# from Realtek's docs Quick_Start_Guide_for_SoftAP.pdf and
# SoftAP_Mode_features.pdf. The [DSSS_CCK-40][MAX-AMSDU-7935]
# part comes from the interweb. Use [HT40-] or [HT40+]
ht_capab=[SHORT-GI-20][SHORT-GI-40][HT40+][DSSS_CCK-40][MAX-AMSDU-7935]
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:16 pm
by epoch1970
Nononono, don't touch this one.
Let me quote myself if I may, Step 1 in the third installment:
1 - Check file /etc/default/hostapd
and make sure this line
DAEMON_CONF="/etc/hostapd/hostapd.conf"
is not commented (by default it is, remove the sharp sign #)
There: "sudo nano
/etc/default/hostapd", remove the # in front, save and "sudo service hostapd start"
EDIT: BTW, you havent changed "wpa_passphrase" for "wpa_psk", there is a good chance you will see the AP but have trouble connecting with the iPhone. My mac fares better.
With the password as a hex string, everybody's happy.
EDIT2: Sorry, I goofed when repeating the path. My apologies. The file to edit is /etc/default/hostapd. And I was wrong the 1st time too. Ouch. I've corrected the post.
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:23 pm
by iOS_Neil
Ah! Ok...There's no hostapd.
conf in there but there is a hostapd so I edited the # out of that. Restarted hostapd, finally saw the AP on my iPhone, put the password in and got back, "Wrong password" so I tried again and then, "Unable to join"...
I'll try the bit you said about the password for iPad?
EDIT: I cross-posted...Yep, I'll do all that now

Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:26 pm
by epoch1970
iOS_Neil wrote:Ah! Ok...There's no hostapd.conf in there but there is a hostapd so I edited the # out of that. Restarted hostapd, finally saw the AP on my iPhone, put the password in and got back, "Wrong password" so I tried again and then, "Unable to join"...
I'll try the bit you said about the password for iPad?
Yes sorry for the approximations.
Please do use wpa_psk, it works with any client, and iOS seems to have an aversion for wpa_passphrase.
This time it is in /etc/hostapd/hostapd.conf. I promise.
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:34 pm
by iOS_Neil
All done - here's the top of hostapd.conf
Code: Select all
# Basic AP parameters
ssid=worky
wpa_psk=6aad4c3ee371b077d2eb402ffe2428eb41021e4e8926da0e4da3d87859d48d4e
interface=wlan0
bridge=br0
channel=1
country_code=GB
Restarted hostapd service, saw AP, entered easypeasy and..."Unable to join the network "worky" "
Code: Select all
pi@raspberrypi:/etc/default $ brctl show
bridge name bridge id STP enabled interfaces
br0 8000.74da386ae783 yes eth0
wlan0
pi@raspberrypi:/etc/default $ ps waxu | grep hosta
root 13747 0.0 0.4 2504 1796 ? Ss 17:30 0:00 /usr/sbin/host pd -B -P /var/run/hostapd.pid /etc/hostapd/hostapd.conf
pi 15487 0.0 0.4 4268 2016 pts/0 S+ 17:33 0:00 grep --color=auto hosta
Feel like it's so close now!
Re: Trying to configure wifi AP (with VPN)
Posted: Wed Jun 01, 2016 5:39 pm
by epoch1970
Ok. You have the right key, the network looks ok.
Are you standing far from the Pi?
We'll need to see how this works at boot, so please reboot it once more, "worky" should come back this time.
And while it's rebooting, try on the iOS device to connect to another wifi network, "forget" the nework "worky" and then try again joining.
If you have another machine at hand, you could try with that too.