1

I'm using my Pi as a WAP (wireless access point). Is it possible to have two separate WiFi networks coming from the same Pi? I bought a usb adaptor that supports 8 APs, but I can only get one wap showing and working.

I'm using a Raspberry pi 4 and using command iw list the adaptor shows up correctly. I have modified the dhcpcd.conf file to include both interfaces wlan0 and wlan1, the dnsmasq.conf file to indicate the range of ip addresses and two separate hostapd.conf files for two networks. In /etc/default/hostapd I also indicated both the paths for hostapd.conf.

Still only one wlan shows up in ifconfig, any idea why? I really appreciate any help.

Yiming Xie
  • 11
  • 1
  • 4

2 Answers2

1

The wifi device on a Raspberry Pi can only make one access point at a time. To have a second access point you have to use an additional USB/wifi dongle that also supports an access point.

How to setup a single access point you can look at Setting up a Raspberry Pi as an access point - the easy way, section Setting up a stand alone access point. This is using interface wlan0. you can just repeat the same setup by replacing everywhere wlan0 with wlan1. Then you have two independent services that you can manage each separately, for example start and stop them:

rpi ~$ sudo systemctl stop wpa_supplicant@wlan1.service
rpi ~$ sudo systemctl start wpa_supplicant@wlan0.service

There are other combinations possible, maybe with the eth0 as uplink to an internet router or bridged with one access point.

Ingo
  • 42,961
  • 20
  • 87
  • 207
0

Actually hostapd is capable of setting up multiple access points on the same wifi interface and the same frequency (and even using multiple vlans to have actually separated networks) in case the wifi hardware has support for multiple APs.

The hostapd configuration can be quite complicated especially since the documentation is misleading in many places... Also due to the configuration having to match the hardware, you are often left with trial and error.

What you need a second wifi dongle for, is when you want to create an AP on another frequency. E.g. you need one dongle for a (multitude of) 2.5G networks and another dongle for a (multitude of) 5G networks.

Example configuration, credits to sensepost

The following is a shameless copy of https://github.com/sensepost/hostapd-mana/wiki/Multiple-Networks

Different networks can be created in the hostapd config with the bss keyword. For example, if we take the simplest hostapd.conf as our starting example:

ssid=hostapd-mana wifi
channel=6
hw_mode=g

We can add another network with:

ssid=second wifi

However, hostapd will create the second interface as a +1 offset of the original interface’s MAC address. This regularly causes problems for me, and I find hardcoding the original interface’s MAC address to something ending in :00 fixes it. Thus, the complete simplest config for two networks would be:

bssid=aa:bb:cc:dd:ee:00
ssid=hostapd-mana wifi
channel=6
hw_mode=g
bss=wlan0_0
ssid=second wifi

Depending on your adapter, it’s often possible to create more networks, for example, to add a third network:

ssid=third wifi

Multiple Security Configs

Additionally, the security options for each network can be varied. For example, to create an open, WPA/2 PSK and WPA/2 EAP network at the same time, using the options discussed in Creating PSK or EAP Networks:

bssid=aa:bb:cc:dd:ee:00
ssid=OpenNet
channel=6
hw_mode=g

bss=wlan0_0 ssid=PSKNet wpa=3 wpa_key_mgmt=WPA-PSK wpa_pairwise=TKIP CCMP wpa_passphrase=ASecurePassword auth_algs=3

bss=wlan0_1 ssid=EAPNet wpa=3 wpa_key_mgmt=WPA-EAP wpa_pairwise=TKIP CCMP auth_algs=3 ieee8021x=1 eapol_key_index_workaround=0 eap_server=1 eap_user_file=hostapd.eap_user ca_cert=ca.pem server_cert=server.pem private_key=server.key private_key_passwd=password dh_file=dhparam.pem