wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Wed Jun 27, 2018 12:26 pm

ok, lets be a little superstitious.
modify the file dnsmasq.conf
and change
interface=uap0
to
interface=lo,uap0

the rest seems fine.
I do need to see the dhcpcd.conf file

wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Wed Jun 27, 2018 12:42 pm

do 1 thing, the reason for not getting the wlan0 ip address has something to do with the dhcpcd not starting up.
if its starting then its unable to recognise the wlan0 interface.
so, once ur raspi board comes online, please post the details of dhcpcd.conf and also run

Code: Select all

 sudo systemctl status dhcpcd 

mauricioc
Posts: 1
Joined: Wed Jun 27, 2018 9:10 pm

Re: Pi 3 as wiireless client and wireless AP?

Wed Jun 27, 2018 9:14 pm

Hi,

I am trying this too, and couldn't make it work.

my model is rpi3b+ I used this last one solution and restarted but it doesn't show the ap to the client.

if I put something on interfaces, then it crashes

shanem2
Posts: 13
Joined: Tue Jan 23, 2018 10:38 am

Re: Pi 3 as wiireless client and wireless AP?

Wed Jul 04, 2018 3:01 am

@wanstreet, here is the output of the requested files;

Code: Select all

/etc/dhcpcd.conf
<default file>
interface uap0
static ip_address=192.168.4.1/24

Code: Select all

]/etc/dnsmasq.conf
<default file>
interface=lo,uap0
dhcp-range=192.168.4.20,192.168.4.100,255.255.255.0,12h

FYI - I've just built a fresh SD Card and followed @SurferTim's configuration. No deviation from the post. The Pi takes a while to respond, seems CPU is busy. I also don't get any WiFi Client or AP connections.

OK, just hashed the line "iw dev wlan0 interface add uap0 type __ap" from the "/etc/rc.local" file and Wireless Client is now working again and login speed seems to be back to acceptable speed, but no AP as the uap0 interface isn't defined.

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

Re: Pi 3 as wiireless client and wireless AP?

Wed Jul 04, 2018 11:14 am

I warned about the speed and reliability challenges in previous posts. I have gotten this to work recently on a RPi3B+ and a Zero W. They require two different setups though. Not sure why.

Try this nohook addition. In /etc/dhcpcd.conf

Code: Select all

interface uap0
static ip_address=192.168.4.1/24
nohook wpa_supplicant

wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Wed Jul 04, 2018 1:37 pm

shanem2 wrote:
Wed Jul 04, 2018 3:01 am
@wanstreet, here is the output of the requested files;

Code: Select all

/etc/dhcpcd.conf
<default file>
interface uap0
static ip_address=192.168.4.1/24

Code: Select all

]/etc/dnsmasq.conf
<default file>
interface=lo,uap0
dhcp-range=192.168.4.20,192.168.4.100,255.255.255.0,12h

FYI - I've just built a fresh SD Card and followed @SurferTim's configuration. No deviation from the post. The Pi takes a while to respond, seems CPU is busy. I also don't get any WiFi Client or AP connections.

OK, just hashed the line "iw dev wlan0 interface add uap0 type __ap" from the "/etc/rc.local" file and Wireless Client is now working again and login speed seems to be back to acceptable speed, but no AP as the uap0 interface isn't defined.
this is my rc.local file,

Code: Select all

service hostapd stop
service dnsmasq stop
iw dev wlan0 interface add uap0 type __ap
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
ifdown wlan0
ip link set uap0 up
ip addr add 192.168.4.1/24 broadcast 192.168.4.255 dev uap0
service hostapd start
ifup wlan0
service dnsmasq start
keep it like this

dont make any changes.
add this line in ur /etc/dhcpcd.conf after static ip address line

Code: Select all

static domain_name_servers=8.8.8.8 8.8.4.4
even tho this line has minimal effect , but its a working configuration , so i am posting it, later u can filter things out which has no effect on this task
save the file and reboot
then tell me whats happening

wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Wed Jul 04, 2018 1:41 pm

SurferTim wrote:
Wed Jul 04, 2018 11:14 am
I warned about the speed and reliability challenges in previous posts. I have gotten this to work recently on a RPi3B+ and a Zero W. They require two different setups though. Not sure why.

Try this nohook addition. In /etc/dhcpcd.conf

Code: Select all

interface uap0
static ip_address=192.168.4.1/24
nohook wpa_supplicant
2 different setups mean?
like separate setups for separate boards?

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

Re: Pi 3 as wiireless client and wireless AP?

Wed Jul 04, 2018 5:16 pm

wanstreet wrote: 2 different setups mean?
like separate setups for separate boards?
Yes. What works for a Zero W does not work with the RPi3 and vice versa.

shanem2
Posts: 13
Joined: Tue Jan 23, 2018 10:38 am

Re: Pi 3 as wiireless client and wireless AP?

Thu Jul 05, 2018 2:26 am

@wanstreet

Thanks for the additional steps in the/etc/rc.local file.

I made these changes and it resolved the client issues, I was able to connect to my Wireless AP, but the RPi AP wasn't broadcasting.

I had a look at ifconfig and found uap0 had no IP Address. I issued the command;

Code: Select all

ip addr add 192.168.4.1/24 broadcast 192.168.4.255 dev uap0
This gave it an IP Address and started to broadcast, but I wasn't able to connect. I tried playing around with changing some commands and other settings but to no avail.

It looks like the ifdown commands fail as they're not defined in the /etc/network/interfaces file.

I know it would be painful, but is there any chance for instruction from scratch on a new build.

Also to confirm, are you using the 3B+ full device, not a Zero, etc? As it looks like they behave differently.

I'm also using the 2018-06-27-raspbian-stretch-lite image now, where I was previously using the 2018-04-18-raspbian-stretch-lite image. Not sure if that makes any difference?

wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Thu Jul 05, 2018 5:51 am

shanem2 wrote:
Thu Jul 05, 2018 2:26 am
@wanstreet

Thanks for the additional steps in the/etc/rc.local file.

I made these changes and it resolved the client issues, I was able to connect to my Wireless AP, but the RPi AP wasn't broadcasting.

I had a look at ifconfig and found uap0 had no IP Address. I issued the command;

Code: Select all

ip addr add 192.168.4.1/24 broadcast 192.168.4.255 dev uap0
This gave it an IP Address and started to broadcast, but I wasn't able to connect. I tried playing around with changing some commands and other settings but to no avail.

It looks like the ifdown commands fail as they're not defined in the /etc/network/interfaces file.

I know it would be painful, but is there any chance for instruction from scratch on a new build.

Also to confirm, are you using the 3B+ full device, not a Zero, etc? As it looks like they behave differently.

I'm also using the 2018-06-27-raspbian-stretch-lite image now, where I was previously using the 2018-04-18-raspbian-stretch-lite image. Not sure if that makes any difference?
uap0 gets the ip address from the dhcpcd.conf file.
my device is pi3 B board.
after SurferTim's steps, u do the restart,
u wait for sometime, the main wifi , means the wlan0 will get ip address, but the uap0 will not have the ip address.
to work around that,
you need to do the following thing,

Code: Select all

 sudo systemctl restart hostapd
 	(wait 1-2 secs)
 	    sudo systemctl restart dnsmasq
 	    sudo systemctl restart dhcpcd
 	    
the process is unreliable and may sometimes not give ip address to both the interfaces
surfertim's steps followed by sme changes in the dhcpcd and dnsmasq that i mentioned, the rest will stay the same with no changes in the /etc/network/interfaces file.
after that restart, the device,
then wait for sometime for wlan0 to get ip adress.
if wlan0 does not get ip address, then u can try restarting the dhcpcd service

Code: Select all

sudo systemctl restart dhcpcd
this time the dhcp service will restart and your wlan0 will get ip address.
So after wlan0 gets ip address, move ur mouse pointer to the top-right and keep it on the wifi icon to see if the uap0 is showing "unassociated"
and wlan0 has an ip address, that ip address class will be the same as u have set in the home-router.
once u verify those 2,
type the above 3 commands i wrote,
as u type those 3 commands u will see the changes in the wifi-icon
This is all i did, i didnt do anything different.
try it out

wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Thu Jul 05, 2018 5:52 am

SurferTim wrote:
Wed Jul 04, 2018 5:16 pm
wanstreet wrote: 2 different setups mean?
like separate setups for separate boards?
Yes. What works for a Zero W does not work with the RPi3 and vice versa.
aah, good to know,
thanks

wanstreet
Posts: 39
Joined: Fri Jun 01, 2018 5:28 am

Re: Pi 3 as wiireless client and wireless AP?

Thu Jul 05, 2018 5:54 am

shanem2 wrote:
Thu Jul 05, 2018 2:26 am
@wanstreet

Thanks for the additional steps in the/etc/rc.local file.

I made these changes and it resolved the client issues, I was able to connect to my Wireless AP, but the RPi AP wasn't broadcasting.

I had a look at ifconfig and found uap0 had no IP Address. I issued the command;

Code: Select all

ip addr add 192.168.4.1/24 broadcast 192.168.4.255 dev uap0
This gave it an IP Address and started to broadcast, but I wasn't able to connect. I tried playing around with changing some commands and other settings but to no avail.

It looks like the ifdown commands fail as they're not defined in the /etc/network/interfaces file.

I know it would be painful, but is there any chance for instruction from scratch on a new build.

Also to confirm, are you using the 3B+ full device, not a Zero, etc? As it looks like they behave differently.

I'm also using the 2018-06-27-raspbian-stretch-lite image now, where I was previously using the 2018-04-18-raspbian-stretch-lite image. Not sure if that makes any difference?
my config worked on the recent version of rpi stretch.

piuscran
Posts: 2
Joined: Mon Aug 27, 2018 11:07 am

Re: Pi 3 as wiireless client and wireless AP?

Wed Aug 29, 2018 12:03 pm

I have a raspberry PI with two virtual interfaces and one onboard interface, i have configure vlan on both virtual interface .
i have an access point connected to the same switch with the raspbery PI but i am unable to ping the raspberry pi
the AP is configured in the same ip rang of one of the virtual interface but i cannot ping the raspberry from the AP or the AP from the raspberry PI please help i really need this

sora03
Posts: 188
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: Pi 3 as wiireless client and wireless AP?

Sun Oct 14, 2018 1:17 am

piuscran wrote:
Wed Aug 29, 2018 12:03 pm
I have a raspberry PI with two virtual interfaces and one onboard interface, i have configure vlan on both virtual interface .
i have an access point connected to the same switch with the raspbery PI but i am unable to ping the raspberry pi
the AP is configured in the same ip rang of one of the virtual interface but i cannot ping the raspberry from the AP or the AP from the raspberry PI please help i really need this
you may need to configure NAT and packet forwarding
FLOSS enthusiast, Debian user (linux-libre)

notacloud
Posts: 1
Joined: Fri Oct 19, 2018 12:09 pm

Re: Pi 3 as wiireless client and wireless AP?

Fri Oct 19, 2018 12:29 pm

Hi All,

I have perused this thread and have found it very helpful. Many thanks to SurferTim and others for their patience and helpfulness.

I have a few questions that I would like to ask:

1. There are caveats about performance and reliability of configuring the Pi3 B+ onboard wifi as both AP and station (client). What are the reasons for this? Is it the same reason as explained in this link https://www.actiontec.com/wifihelp/wifi ... very-time/ ? Does the simple act of expecting the wlan0 to be both AP and station hamstring performance?

2. If the performance and reliability of using the onboard wifi as both AP and station are degraded (as well as the inconvenience of needing to have both on the same channel) then can the rpi3 b+ be configured to use a USB wifi dongle to avoid those performance and reliability issues? What dongles are going to be the best to try to use to achieve this configuration?

3. Lastly, what is the recommended set of steps to take on a rpi3 B+ whose wlan0 (onboard) interface is already acting as an AP (using hostapd and dnsmasq) to add a USB wifi dongle (wlan1) which acts as a station? I am running raspbian stretch lite, so the advice offered by links such as https://imti.co/iot-wifi/ which seems to avoid dhcpcd.conf is not as helpful

Thanks In Advance

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

Re: Pi 3 as wiireless client and wireless AP?

Fri Oct 19, 2018 5:56 pm

#1) Both the AP and client use the same radio and frequency. This causes delays and errors.

#2) I use a usb dongle for wlan1 when I want to use a wireless device as the wan interface. The AP must be wlan0.

#3) The only addition you must do is add a masquerade for wlan1 in the same fashion as you do for eth0.

Return to “Networking and servers”