×

INDI Library v2.0.7 is Released (01 Apr 2024)

Bi-monthly release with minor bug fixes and improvements

VAP Connection Issue

  • Posts: 13
  • Thank you received: 0
Me again!

So, having fixed my previous issue of not being able to connect to my WLAN, I now have been trying to get a remote connection to the ABS via the VAP.
Here's what I did:

Backup the wpa_supplicant file
Remove my WLAN details from the wpa_supplicant file, to mimic having no WLAN available
Restart the Pi

The device restarts and eventually (it seems to take some time!) the astroberry SSID is visible, but I cannot get a connection to it at all - I just get "Activation of Network Connection Failed" on my Ubuntu 18.04 client.
ifconfig shows
Link encap: Ethernet HWaddr b8:27:eb:4f:53:4f
inet addr: 192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
inet6 addr: fe80::ba27:ebff:fe4f:534f/64  Scope/link
UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
RX packets:109  errors:0  dropped:4  overruns:0  frame:0
TX packets:144  errors:0  dropped:0  overruns:0  carrier:0
collisions:0 txqueuelen:1000
RX bytes:17481 (17.4 KB)  TX bytes:22485 (22.4 KB)

The pi is a model 3b, so uses the hostapd_3b.conf file, but just to be sure, I updated the 3bplus file with the Channel and Mode changes...

So, now I'm stuck again!

i don't think I've changed anything else in my previous WLAN issue, but if anyone has any insights, I'd be grateful!
5 years 1 month ago #36587

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375

Replied by Radek Kaczorek on topic VAP Connection Issue

IP address is assigned properly (192.168.10.1) to VAP. Could you please show "ifconfig -a" and "iwconfig"?
5 years 1 month ago #36593

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0

Replied by Darren Jehan on topic VAP Connection Issue

Hi Radek

OK, ifconfig -a gives:
enxb827eb1a061a Link encap:Ethernet  HWaddr b8:27:eb:1a:06:1a  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
 
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:1033 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1033 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:77140 (77.1 KB)  TX bytes:77140 (77.1 KB)
 
vap0      Link encap:Ethernet  HWaddr b8:27:eb:4f:53:4f  
          inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
          inet6 addr: fe80::ba27:ebff:fe4f:534f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:91 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:14616 (14.6 KB)
 
wlan0     Link encap:Ethernet  HWaddr b8:27:eb:4f:53:4f  
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

And iwconfig gives:
vap0      IEEE 802.11  Mode:Master  
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:on
 
wlan0     IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:on

Thanks!
5 years 1 month ago #36606

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375

Replied by Radek Kaczorek on topic VAP Connection Issue

I'm diagnosing this on my side. It's a nightmare with Raspberry 3B+, which supports both 2.4GHz and 5GHz. The latter is much more sensitive to regional settings and channel selection (radar detection algorithms play their role here).
I can make it work for me, but building bulletproof configuration for everyone is a real challenge. Maybe I will figure out something today. I will keep you posted
5 years 1 month ago #36651

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0

Replied by Darren Jehan on topic VAP Connection Issue

Thanks Radek!
5 years 1 month ago #36655

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375

Replied by Radek Kaczorek on topic VAP Connection Issue

OK, let's try it out. I have prepared an experimental script, which should work. At boot time it checks if any known wireless network (configured in /etc/wpa_supplicant/wpa_supplicant.conf) is available. If so it connects to known AP, if no it starts VAP.

Step by step instruction how to use it:

1. Edit /etc/network/interfaces so it contains:
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
 
# The loopback network interface
auto lo
iface lo inet loopback

2. Edit /etc/hostapd/hostapd.conf so it contains:
interface=vap0
driver=nl80211
country_code=00
ssid=astroberry
hw_mode=g
ieee80211n=1
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=astroberry
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

3. Edit /etc/rc.local so it contains:
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
 
# start Virtual Access Point (VAP) if no active wireless connection
/usr/local/bin/astroberry_wireless > /dev/null 2>&1
 
exit 0

4. Download astroberry_wireless script, copy it to /usr/local/bin and set permissions:
cd /home/astroberry/Download
wget https://raw.githubusercontent.com/rkaczorek/astroberry-server/master/scripts/astroberry_wireless
sudo cp astroberry_wireless /usr/local/bin/
sudo chmod 755 /usr/local/bin/astroberry_wireless

5. Make sure that your /etc/wpa_supplicant/wpa_supplicant.conf contains proper wireless configuration e.g.
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=00
 
network={
scan_ssid=1
ssid="WIRELESS_NAME"
psk="WIRELESS_PASSWORD"
}

6. Reboot

If the wireless network WIRELESS_NAME is available and WIRELESS_PASSWORD is correct, the system should connect to the wireless network at boot time.
If the wireless network is not available or password is not correct it should fall back to Virtual Access Point (VAP), named astroberry with default password astroberry - both can be changed by editing /etc/hostapd/hostapd.conf (see ssid and wpa_passphrase parameters). For many reasons VAP needs to be started in 802.11g mode. You can change it by editing /etc/hostapd/hostapd.conf (see hw_mode=g and channel=6 parameters).

The script runs at boot only, so there is no real time switching between VAP and AP.

Let me know how it goes.
Last edit: 5 years 1 month ago by Radek Kaczorek.
5 years 1 month ago #36660

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0

Replied by Darren Jehan on topic VAP Connection Issue

Hi Radek

Step 1 - Check. Removed all other interface lines
Step 2 - Check
Step 3 - Check
Step 4 - Check
Step 5 - Check

And rebooted.

So, the VAP starts, but I still cannot connect to it, and now the WLAN won't connect either.
To see what what was happening, I modified rc.local to:
/usr/local/bin/astroberry_wireless > boot.log 2>&1

Here is the result:
Checking if connected to AP.......... Not connected
Trying to connect to known AP
Wireless network available
Connecting...............................
Can't connect to wireless network. ^[[31mCheck your password and try again^[[0m
Starting Virtual Access Point
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.vap0: -95 (operation not supported)
vap0: interface state UNINITIALIZED->COUNTRY_UPDATE
vap0: Could not connect to kernel driver
Using interface vap0 with hwaddr b8:27:eb:4f:53:4f and ssid "astroberry"
vap0: interface state COUNTRY_UPDATE->ENABLED
vap0: AP-ENABLED
Virtual Access Point Ready

And again, I can see it listed, but cannot connect to it.

Interesting that the connection to the WLAN failed - I have triple-checked the password and it is correct, as is the spelling of my WLAN ssid = 200% absolutely sure!!!

Sorry to cause you so much grief!
Last edit: 5 years 1 month ago by Darren Jehan. Reason: wrong tags for code!
5 years 1 month ago #36673

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0

Replied by Darren Jehan on topic VAP Connection Issue

Doing some more digging to try and assist...

So, this line:
/sbin/wpa_supplicant -s -B -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf

Gives me no output when run at the command-line, however this line:
wpa_cli -i wlan0 status

Gives an error "Failed to connect to non-global ctrl_ifname (nil) error: no such file or directory"

I don't know if that helps, or is even relevant!
5 years 1 month ago #36675

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375

Replied by Radek Kaczorek on topic VAP Connection Issue

What you get is:
Wireless network available
Connecting...............................
Can't connect to wireless network. Check your password and try again

This means that the AP is present but the password is not correct. It is case sensitive to please triple check this ;-)

Run these after reboot (note it does not contain -B flag, which sends it to background):
sudo astroberry_vap stop
sudo /sbin/wpa_supplicant -s -P /run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf

Review the output and/or paste it here.
Last edit: 5 years 1 month ago by Radek Kaczorek.
5 years 1 month ago #36678

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0

Replied by Darren Jehan on topic VAP Connection Issue

Password checked, double and triple checked. I even changed it, updated my phone, my laptop and tablet - all connected perfectly. Pi does not connect!

Entered that command and it just sits there - no output at all. I left it several minutes just in case, but nothing.
5 years 4 weeks ago #36729

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0

Replied by Darren Jehan on topic VAP Connection Issue

Just wondering Radek, if it would be easier/useful to do a complete refresh, run a complete update and then try the new astroberry_wireless sccript?
I have spare cards so easy to do....

Appreciate your support!
5 years 4 weeks ago #36740

Please Log in or Create an account to join the conversation.

  • Posts: 983
  • Thank you received: 375

Replied by Radek Kaczorek on topic VAP Connection Issue

Absolutely! Reflash and upgrade the system before further straggle :-)
5 years 4 weeks ago #36765

Please Log in or Create an account to join the conversation.

Moderators: Radek Kaczorek
Time to create page: 0.941 seconds