nulldev
Posts: 23
Joined: Sat Mar 05, 2016 3:39 am

Re: Pi 3 as wiireless client and wireless AP?

Sun Feb 26, 2017 4:12 am

The issue I reported with disconnects and dropped packets appears to be gone now.
Here are the steps I took. I have no idea which if any of these steps are responsible for the 'fix'.

Upgrade software:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo reboot
sudo branch=next rpi-update
sudo reboot

Edit the interfaces file to disable power management for the wifi connection.
Add this line to /etc/network/interfaces in wlan0 section and save the file:
wireless-power off

Then I rebooted because I was unsure of the command to reload the wireless settings
sudo reboot
Wanted to share in case anyone else has a similar issue.
Thanks

nulldev
Posts: 23
Joined: Sat Mar 05, 2016 3:39 am

Re: Pi 3 as wiireless client and wireless AP?

Sun Feb 26, 2017 4:44 am

I may have spoken too soon about resolving the wifi issue I am experiencing.
I have now made another edit to the interfaces file as follows:
# wireless-power off

pre-up iw dev wlan0 set power_save off
post-down iw dev wlan0 set power_save on

Then I rebooted.
As I understand it this should turn powersaving off before the wlan0 comes up and then re-enable it when wlan0 goes down.

nulldev
Posts: 23
Joined: Sat Mar 05, 2016 3:39 am

Re: Pi 3 as wiireless client and wireless AP?

Sun Mar 05, 2017 3:27 pm

This has helped. Its not perfect but it seems to have stopped the disconnects, but at times the latency is still kinda high. Maybe this is a different issue? As my app requires a stable connection I would really like to figure out how to correct the lag.

In the meantime, in my last post I listed code the turns powersaving on and off for different interfaces, does anyone know how to just turn it off completely?

barry914
Posts: 44
Joined: Sat Aug 20, 2016 7:40 pm

Re: Pi 3 as wiireless client and wireless AP?

Sun Mar 05, 2017 3:56 pm

I'm not sure why it's necessary to turn power save on when shutting down the interface. I have no apparent issue with just turning it off.

nulldev
Posts: 23
Joined: Sat Mar 05, 2016 3:39 am

Re: Pi 3 as wiireless client and wireless AP?

Fri Mar 10, 2017 3:19 am

My problem persists.
SSH freezes after a few commands (or seconds) after connecting.
Reconnecting with putty allows another few commands.
Sometimes I cannot even complete typing one command.
I am not sure how to troubleshoot this.
I am not sure it has anything to do with this dual client/ap config so I am going to start a new thread.

Thanks for all the help.

namartin
Posts: 1
Joined: Mon Mar 13, 2017 11:43 pm

Re: Pi 3 as wiireless client and wireless AP?

Tue Mar 14, 2017 12:01 am

Hey everyone,

I am currently trying to set up a raspberry pi as a wireless router dhcp relay, but haven't had much luck. I am using hostapd to setup the wireless AP and dnsmasq configure the relay portion.

Has anyone done this? I am unsure of what to put into the /etc/dnsmasq.conf file to accomplish this. The hostapd config file I'm using looks like this:

Code: Select all

interface=wlan0
driver=nl80211
ssid=myssid
hw_mode=g
channel=6
ieee80211n=1
wmm_enabled=1
ht_capab=[HT40][SHORT-GI-20][DSSS_CCK-40]
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_passphrase=mypassword
rsn_pairwise=CCMP

nitin358
Posts: 2
Joined: Fri Jun 02, 2017 10:29 am

Re: Pi 3 as wiireless client and wireless AP?

Sun Jun 04, 2017 7:06 am

I followed the steps from http://imti.co/post/145442415333/raspbe ... station-ap with latest jessie lite version.

Currently i'm only able to work it in AP mode or Client mode at one time, both modes are not working simultaneously. Can anyone help me with this ?

barry914
Posts: 44
Joined: Sat Aug 20, 2016 7:40 pm

Re: Pi 3 as wiireless client and wireless AP?

Sun Jun 04, 2017 7:58 pm

Do you have both the AP and client set to the same channel? They should be. I had some trouble with my Android phone connecting to the AP when in dual mode, but I had full functionality with my Windows PC.

nitin358
Posts: 2
Joined: Fri Jun 02, 2017 10:29 am

Re: Pi 3 as wiireless client and wireless AP?

Tue Jun 06, 2017 9:00 am

barry914 wrote:Do you have both the AP and client set to the same channel? They should be. I had some trouble with my Android phone connecting to the AP when in dual mode, but I had full functionality with my Windows PC.
Yes both of them are on same channel (channel 9).

n00bistCol0ny
Posts: 3
Joined: Fri Jun 09, 2017 5:19 am

Re: Pi 3 as wiireless client and wireless AP?

Fri Jun 09, 2017 5:28 am

Greetings!

I followed the guide at http://imti.co/post/145442415333/raspbe ... station-ap and have the AP+wifi connection working flawlessly. In fact, I'm connected to the Pi, which is connected to my local wifi for internet, and posting this right now.

I'm having an issue that might be somewhat related, and is the only reason I thought it appropriate to continue in this thread...

From this machine (connected to the Pi AP, which has a hostname of `altoid`) if I `host altoid`, I receive `127.0.1.1`.

I am only able to ssh, and view webserver content via IP address.

Going from this configuration, is it possible to *also* be able to use a hostname to reference the Pi, when connected to it as AP?


The final goal being to utilize a local domain/hostname to serve static content, while allowing the rest of the usual internet traffic to function.

n00bistCol0ny
Posts: 3
Joined: Fri Jun 09, 2017 5:19 am

Re: Pi 3 as wiireless client and wireless AP?

Fri Jun 09, 2017 4:40 pm

Y'know... I think I found the answer.

It looks like avahi-daemon was failing early, or not starting. I changed the config, and now it appears to be working fine for me, as {hostname}.local from other machines.

See this gist for all my config info: https://gist.github.com/tcg/0c1d32770fc ... 7358c5d059

raspiNoob0xFF
Posts: 2
Joined: Sun Jun 18, 2017 3:45 pm

Re: Pi 3 as wiireless client and wireless AP?

Sun Jun 18, 2017 4:18 pm

H
I've been battling against this for over a week now..

I have followed all the steps to the letter on the above post (the github page).

I tried this on a different install and it appeared to work fine..

Here's the odd thing.. When I start hostapd the AP appears on my network, but refuses to accept any incoming connections (IE my devices attempt to connect, but then fail).

This is the error I get on start of hostapdstart:
[....] Restarting DNS forwarder and DHCP server: dnsmasq
dnsmasq: unknown interface uap0
failed!
net.ipv4.ip_forward = 1
RTNETLINK answers: File exists
Failed to bring up uap0.
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.uap0: -95 (Operation not supported)
Failed to update rate sets in kernel module
Could not connect to kernel driver.
Using interface uap0 with hwaddr b8:27:eb:12:17:5f and ssid 'nameOfAP'
It seems that is failing, yet is still broadcasting?!

I ran iwlist on uap0 and it comes up with the correct info.
So what gives?

I feel so close, yet so far!

I really hope someone finds the fix for this soon as I feel absolutely exhausted from it.
I've checked every reach of the internet but still am yet to find a solution.

n00bistCol0ny
Posts: 3
Joined: Fri Jun 09, 2017 5:19 am

Re: Pi 3 as wiireless client and wireless AP?

Mon Jun 19, 2017 9:44 pm

raspiNoob0xFF wrote:H
I've been battling against this for over a week now..

I have followed all the steps to the letter on the above post (the github page).

I tried this on a different install and it appeared to work fine..

Here's the odd thing.. When I start hostapd the AP appears on my network, but refuses to accept any incoming connections (IE my devices attempt to connect, but then fail).

This is the error I get on start of hostapdstart:
[....] Restarting DNS forwarder and DHCP server: dnsmasq
dnsmasq: unknown interface uap0
failed!
net.ipv4.ip_forward = 1
RTNETLINK answers: File exists
Failed to bring up uap0.
Configuration file: /etc/hostapd/hostapd.conf
Failed to create interface mon.uap0: -95 (Operation not supported)
Failed to update rate sets in kernel module
Could not connect to kernel driver.
Using interface uap0 with hwaddr b8:27:eb:12:17:5f and ssid 'nameOfAP'
It seems that is failing, yet is still broadcasting?!

I ran iwlist on uap0 and it comes up with the correct info.
So what gives?

I feel so close, yet so far!

I really hope someone finds the fix for this soon as I feel absolutely exhausted from it.
I've checked every reach of the internet but still am yet to find a solution.

To the best of my knowledge, the error your seeing can be ignored. I see the same thing when I manually run the start script. I'm not smart enough to know how to resolve that, but it still appears to work.

Have you tried commenting out the lines in `/etc/hostapd/hostapd.conf` that start with "wpa_", and see if you can connect WITHOUT a password-protected AP?

Budda
Posts: 1
Joined: Sat Jul 01, 2017 4:46 pm

Re: Pi 3 as wiireless client and wireless AP?

Sat Jul 01, 2017 4:48 pm

@raspiNoob0xFF got exactly the same problem here with my Pi Zero W board as a test. Been banging head on and off for a few weeks.

it seems when i boot the Pi up it doesn't work. But if i re-run my script from the terminal after boot - the WAP comes alive! :roll:

al3x
Posts: 1
Joined: Sat Jul 15, 2017 10:19 pm

Re: Pi 3 as wiireless client and wireless AP?

Sat Jul 15, 2017 10:30 pm

Finally got it running. I had the same problem with the script not starting automatically. My solution is to add the lines:

iw dev wlan0 interface add uap0 type __ap
ifup uap0

to the start) case of the init script of hostapd (/etc/init.d/hostapd). I don't need forwarding, therefore I skipped other lines. Now my PiZeroW starts with both client and hostap active.
Hope it helps.

JacoFourie
Posts: 66
Joined: Thu Mar 10, 2016 6:51 pm

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 7:23 am

Hi all. Thanks for all the info. It has helped a lot. I do have a question.

I need to run the pi with a AP and client wifi link. If there is a wifi network the client link of the Pi will be used to connect to the network and all users will connect to the same network and interact with the web interface on the PI via the normal wifi network.

I have 2 adapters. The local one on wlan0 (AP) and a dongle wlan1 (client)

If there is no wifi network then the user will connect to the Pi AP directly and use the web interface via the Pi AP. Now my question is this.

I dont want to bridge networks like eth0 to wlan0 as there is no eth0 set-up in the field and no internet. I just want to get to the local content on the PI via the AP. I assume this statement is doing that ?

Code: Select all

iptables -t nat -A POSTROUTING -s 172.24.1.0/24 ! -d 172.24.1.0/24 -j MASQUERADE
My normal network subnet is 10.64.9.0 and the AP is set to hand out ips 172.24.1.50 - 150

Here is my interfaces config

Code: Select all

auto lo
# bro
auto eth0
auto wlan0
auto wlan1

iface eth0 inet static
address 10.64.9.78
netmask 255.255.255.0
network 10.64.9.0
broadcast 10.64.9.255
gateway 10.64.9.20

iface lo inet loopback

allow-hotplug wlan0
allow-hotplug wlan1

allow-hotplug wlan0
iface wlan0 inet static

address 172.24.1.1
netmask 255.255.255.0
network 172.24.1.0
broadcast 172.24.1.255

iface wlan1 inet static
address 10.64.9.77
netmask 255.255.255.0
network 10.64.9.0
broadcast 10.64.9.255
gateway 10.64.9.20
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
/etc/dnsmasq.conf

Code: Select all

interface=wlan0                         # Use interface wlan0
listen-address=172.24.1.1                                       # Explicitly specify the address to listen on
bind-interfaces                                                 # Bind to the interface to make sure we aren't sending      $
server=8.8.8.8                                                  # Forward DNS requests to Google DNS
domain-needed                                                           # Don't forward short names
bogus-priv                                                              # Never forward addresses in the non-routed address $
dhcp-range=172.24.1.50,172.24.1.150,12h # Assign IP addresses between 172.24.1.50 and 172.24.1.150 with                     $
Will I be able to get to my webserver running on the PI using the same IP or should I make the DHCP that the AP hands out the same 10.64.9.50 - 150 so everything stays on the same subnet?

Basically I want to go to the same IP to get to the web interface no matter if I am connected to the Pi AP or to the wifi network that the pi client is connected to.

Not suer if it is making sense what I am trying to do?

SurferTim
Posts: 1107
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 10:20 am

If you are using Stretch, then I just posted how to set up an AP on a RPi3 on this thread. Do not modify the /etc/network/interfaces file.
viewtopic.php?f=36&t=191453

Jessie isn't much different, except the eth0 interface.

JacoFourie
Posts: 66
Joined: Thu Mar 10, 2016 6:51 pm

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 11:25 am

Lets say I have to stick to the old OS using these files as shown.

SurferTim
Posts: 1107
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 11:26 am

You must be specific. Which old OS?

JacoFourie
Posts: 66
Joined: Thu Mar 10, 2016 6:51 pm

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 1:40 pm

jessie but without /etc/dhcpcd.conf if possible.

SurferTim
Posts: 1107
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 2:25 pm

I don't think that is possible. Why don't you want to use /etc/dhcpcd.conf?

JacoFourie
Posts: 66
Joined: Thu Mar 10, 2016 6:51 pm

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 5:44 pm

OK so everything works 100% if I have the eth0 cable plugged in. I can connect to the AP and I see all I want to see on the 10.64.9.0 subnet. I can also connect to the pi from a pc on the network using 10.64.9.77 which is the client wifi IP. But as soon as I unplug the eth0 cable the wifi link will become inaccessible from the 10.64.9.0 subnet. But the AP part still works 100% from a mobile device. I don't need both client and AP to work at the same time in this case but I would like to know why it is doing this?

I am using another board in this case. I normally use RPi for all my projects but I need eMMC memory on the board as a SD card will fail because the board will not be shut down. I am using Armbian on a Orange Pi. I asked the same question on the OPi forum but it seems nobody has done this before. I found this post and it works with the one exception as I stated.

SurferTim
Posts: 1107
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 7:05 pm

It appears from what you posted earlier that your eth0 (not valid on Stretch) and wlan1 have the same subnet. 10.64.9.0/24

JacoFourie
Posts: 66
Joined: Thu Mar 10, 2016 6:51 pm

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 9:38 pm

Yes they are on the same subnet using 2 ips. Normally the eth0 is not connected. But I connected it for a fail save as the Pi is headless. It seems that I am connecting to the client ip via the lan cable and not the wifi. I removed the default gateway from the eth0 config and only left it on wlan1. But then I can not get out to the internet. So it seems the wifi ip is not getting passed to the wifi link as when I look at the link details on the router there is no ip. It is connected. But there is no ip showing up on the client wifi link on the router.

SurferTim
Posts: 1107
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Pi 3 as wiireless client and wireless AP?

Thu Aug 31, 2017 9:44 pm

Unless you bridge the interfaces, you can't use identical subnets on both interfaces.

Return to “Networking and servers”

Who is online

Users browsing this forum: No registered users and 12 guests