sbeland
Posts: 6
Joined: Sat Oct 21, 2017 2:11 pm

wifi + ap problem

Fri Dec 13, 2019 2:35 pm

Hi,

I am using a raspberry pi zero w.

I have settled up a connection to my router through wifi and have also an access point at the same time.

All works if my ssid that connect to my router works for wifi access, i have access to my AP as well and can connect to.

The problem is if my ssid cannot connect to my router for my wifi, then my AP doesn't shows up.

I have tried numerous things but can't figured it out.

Any help is very appreciate.

Here's my configuration:

cat /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

country=CA
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
    ssid="my router"
    psk="*******"
}
cat /etc/dnsmasq.conf

Code: Select all

interface=lo,RpiDiningRoom
no-dhcp-interface=lo,wlan0
bind-interfaces
server=8.8.8.8
domain-needed
bogus-priv
dhcp-range=192.168.34.50,192.168.34.150,12h
cat /etc/network/interfaces

Code: Select all

source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
auto RpiDiningRoom
auto wlan0
allow-hotplug RpiDiningRoom
iface RpiDiningRoom inet static
    address 192.168.34.1
    netmask 255.255.255.0
    hostapd /etc/hostapd/hostapd.conf
allow-hotplug wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
cat /etc/dhcpcd.conf

Code: Select all

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

# Example static IP configuration:
#interface eth0
#static ip_address=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 fd51:42f8:caae:d92e::1

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

cat /etc/hostapd/hostapd.conf

Code: Select all

ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
interface=RpiDiningRoom
driver=nl80211
ssid=RpiDiningRoom
hw_mode=g
channel=11
wmm_enabled=0
macaddr_acl=0
auth_algs=1
wpa=2
wpa_passphrase=********
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
cat /etc/iptables.conf

Code: Select all

# Generated by iptables-save
*nat
:PREROUTING ACCEPT [1:78]
:INPUT ACCEPT [1:78]
:OUTPUT ACCEPT [2:142]
:POSTROUTING ACCEPT [2:142]
-A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8095
-A POSTROUTING -s 192.168.34.0/24 ! -d 192.168.34.0/24 -j MASQUERADE
COMMIT

sbeland
Posts: 6
Joined: Sat Oct 21, 2017 2:11 pm

Re: wifi + ap problem

Fri Dec 13, 2019 3:24 pm

os is raspbian:
Linux RpiDiningRoom 4.9.59+ #1047 Sun Oct 29 11:47:10 GMT 2017 armv6l GNU/Linux

epoch1970
Posts: 4244
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: wifi + ap problem

Fri Dec 13, 2019 3:41 pm

Use of /etc/network/interfaces is deprecated and makes networking fail. Used dhcpcd.conf only on Raspbian.
See the official docs for network configuration.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

wolf.z
Posts: 131
Joined: Thu Dec 24, 2015 8:34 pm

Re: wifi + ap problem

Fri Dec 13, 2019 9:24 pm

I found 2 sources claiming strong dependencies of virtual interfaces to running real interface. No real interface = no virtual one. Maybe you have to force things, as described here: https://blog.thewalr.us/2017/09/26/rasp ... mode-wifi/ I am not enabled to fully understand the config (or am not willing), since I use no Pi zero but two pieces of WIFI hardware (with a Pi2) for repeating. That simply runs!

As epoch1970 stated, mayby you better follow a new road, like: https://raspberrypi.stackexchange.com/q ... 9804#89804
However. Even this late setup guide states:
"It is not possible to just set up ap0 when needed. It can only start when wlan0 "Gained carrier" and link becomes ready" (if configured as intended by you)
So the entire idea of a single hardware WIFI repeater seems dependant on having a link to your router established.

epoch1970
Posts: 4244
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: wifi + ap problem

Sat Dec 14, 2019 4:03 pm

I’m not sure the OP wanted concurrent AP+STA on the built in WiFi interface.
If that is the case, consider it an impossibility. The functionality of AP+STA is worse than marginal, at least up to pi3b. And reaching the state where you’ll get it working hit or miss requires understanding the dependencies that exist in the hardware and in the software...
You can make AP+STA a topic of study, you’ll probably learn a few things of relative interest. But in the end it will never work well, it is a house of cards. Just add another adapter if you need dual role.
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

sbeland
Posts: 6
Joined: Sat Oct 21, 2017 2:11 pm

Re: wifi + ap problem

Mon Dec 16, 2019 12:30 am

thank you very much for all replies, well appreciated, i will change that to be AP mode when no wifi works only instead of both at same time.

Return to “Troubleshooting”