pengotter
Posts: 4
Joined: Sat Dec 14, 2013 9:52 am

How to make Pi an AP with 2 wifi adapters?

Sat Dec 14, 2013 1:49 pm

Hello,everyone.
I got a question.That is how to make Pi to be an AP with 2 wifi adapters, one wifi adapter is used to connect to the router, and another one is used to be an AP ? How to do this ?

By the way, I have realized that make an AP with eth0 and wlan0, using "hostapd" and "isc-dhcpd-server".

User avatar
DougieLawson
Posts: 39120
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: How to make Pi an AP with 2 wifi adapters?

Sat Dec 14, 2013 4:15 pm

There's no reason why you can't run hostapd configured for wlan1 and bridge wlan0 to wlan1.

Just update the configs you've found.

I'd guess you will have to use a unique SSID for the new network.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

User avatar
redhawk
Posts: 3465
Joined: Sun Mar 04, 2012 2:13 pm
Location: ::1

Re: How to make Pi an AP with 2 wifi adapters?

Sat Dec 14, 2013 4:40 pm

Bridging 2 Wifi adapters should be possible but having 2 devices working on the 2.4GHz band in close proximity could degrade performance similar to operating Bluetooth and Wifi at the same time.
If you do use 2 Wifi dongles then make sure they're operating on different channels i.e. 1 + 14 and kept them some distance apart with a USB extension cable.

Richard S.

pengotter
Posts: 4
Joined: Sat Dec 14, 2013 9:52 am

Re: How to make Pi an AP with 2 wifi adapters?

Sun Dec 15, 2013 2:23 am

DougieLawson wrote:There's no reason why you can't run hostapd configured for wlan1 and bridge wlan0 to wlan1.

Just update the configs you've found.

I'd guess you will have to use a unique SSID for the new network.
Hi,Dougie, thanks for your reply. When I make the AP, I didn't use the bridge that bridge eth0 to wlan0 or bridge wlan0 to wlan1, I am using the isc-dhcp-server.

As I said, I have realized AP with eth0 and wlan0, the isc-dhcp and hostapd just need to appoint which network card will be used as AP, so I am wondering the problem is occurred when configuring the iptables, here is how I configured the iptables when I using eth0 and wlan0:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

pengotter
Posts: 4
Joined: Sat Dec 14, 2013 9:52 am

Re: How to make Pi an AP with 2 wifi adapters?

Sun Dec 15, 2013 2:25 am

redhawk wrote:Bridging 2 Wifi adapters should be possible but having 2 devices working on the 2.4GHz band in close proximity could degrade performance similar to operating Bluetooth and Wifi at the same time.
If you do use 2 Wifi dongles then make sure they're operating on different channels i.e. 1 + 14 and kept them some distance apart with a USB extension cable.

Richard S.
Hi! Thanks for your reply. When I make the AP, I didn't use the bridge that bridge eth0 to wlan0 or bridge wlan0 to wlan1, I am using the isc-dhcp-server.

As I said, I have realized AP with eth0 and wlan0, the isc-dhcp and hostapd just need to appoint which network card will be used as AP, so I am wondering the problem is occurred when configuring the iptables, here is how I configured the iptables when I using eth0 and wlan0:
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

Is there any problem ?

Return to “Troubleshooting”