0

I'm trying to setup two wireless AP on a Raspberry Pi. Lets call the two APs AP0 and AP1. I use hostapd to setup the APs and dnsmasq as the dhcp server.

AP0 is setup on the built-in WiFi on the RasPi at wlan0

AP1 is setup on an external USB adapter that supports AP mode at wlan1

This is my /etc/network/interfaces file:

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
        address 192.168.43.1
        netmask 255.255.255.0
        hostapd /etc/hostapd/hostapd.conf

auto wlan1 allow-hotplug wlan1 iface wlan1 inet static address 192.168.4.1 netmask 255.255.255.0 hostapd /etc/hostapd/hostapd1.conf

and this is my /etc/dnsmasq.conf file:

dhcp-range=wlan0,192.168.43.50,192.168.43.150,24h

dhcp-range=wlan1,192.168.4.50,192.168.4.150,24h

AP0 and AP1 are on channels 6 and 11 respectively.

I am able to connect multiple clients to AP1 and the clients can speak to each other. But the issue is with AP0 where the client connects for a second and then disconnects and this keeps on repeating. How to fix this issue?

Ingo
  • 42,961
  • 20
  • 87
  • 207
mottom
  • 3
  • 1

1 Answers1

2

As noted in a comment you are also agreed with using systemd-networkd. Here in short a configuration I have just tested, based on Setting up a Raspberry Pi as an access point - the easy way.

Switch over to systemd-networkd

Just follow to Use systemd-networkd for general networking. You can use section "♦ Quick Step". Then come back here.

Configure wpa_supplicant as access points

To configure wpa_supplicant as access point create these two files with your settings for country=, ssid=, psk= and maybe frequency=. You can just copy and paste this in one block to your command line beginning with cat and including both EOF (delimiter EOF will not get part of the file):

rpi ~$ sudo -Es   # if not already done
rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf <<EOF
ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev
update_config=1
country=DE

network={ ssid="AP0" mode=2 # access point frequency=2437 # channel 6 key_mgmt=WPA-PSK proto=RSN WPA psk="password" } EOF

rpi ~# cat > /etc/wpa_supplicant/wpa_supplicant-wlan1.conf <<EOF ctrl_interface=DIR=/run/wpa_supplicant GROUP=netdev update_config=1 country=DE

network={ ssid="AP1" mode=2 # access point frequency=2462 # channel 11 key_mgmt=WPA-PSK proto=RSN WPA psk="password" } EOF

rpi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan0.conf rpi ~# chmod 600 /etc/wpa_supplicant/wpa_supplicant-wlan1.conf rpi ~# systemctl disable wpa_supplicant.service rpi ~# systemctl enable wpa_supplicant@wlan0.service rpi ~# systemctl enable wpa_supplicant@wlan1.service rpi ~# rfkill unblock wlan

Configure network interfaces

Create the following two files to configure the interfaces:

rpi ~# cat > /etc/systemd/network/08-wlan0.network <<EOF
[Match]
Name=wlan0
[Network]
Address=192.168.43.1/24
MulticastDNS=yes
DHCPServer=yes
EOF

rpi ~# cat > /etc/systemd/network/12-wlan1.network <<EOF [Match] Name=wlan1 [Network] Address=192.168.4.1/24 MulticastDNS=yes DHCPServer=yes EOF

Reboot and it should do.

Ingo
  • 42,961
  • 20
  • 87
  • 207