I got a question. 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".

There is another thing, 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
  • Note that some wifi equipment can act as AP and client simultaneously; here is a glance at some details, and DD-WRT Repeater Bridge mode is one example of what's possible. You can use the leftover adapter to do even more good stuff!:-)
    – Abbafei
    Commented Dec 15, 2013 at 4:05

3 Answers 3


You have to initalize your hostapd interface on e.g. wlan0. After that you can bring up your wlan1 and connect it to your router. Now you can bridge wlan0 and wlan1 like this:

apt-get install bridge-utils

brctl addbr bridge0
brctl addif bridge0 wlan0
brctl addif bridge0 wlan1
ifconfig bridge0 up

You can assign an ip to that bridge with:

dhclient bridge0

Now all packets from/to wlan0 to/from wlan1 will be redirected.

  • 1
    solved your question?
    – Alex Tape
    Commented Dec 16, 2013 at 19:02
  • I doubt that this proposed answer does work, as other questions may be an indication of: this will give an error when trying to add an wlan interface to the bridge which is in station mode, but not in Access Point station mode. The reason for this error is the three MAC address model used in the IEEE 802.11 MAC layer, and that makes it impossible to send a frame to a station MAC with a different destination MAC. That's because the station radio only matches its receiver MAC but cannot match MACs for other destinations. For this, a four address model would be needed ... which never was done.
    – TheDiveO
    Commented Jul 14, 2017 at 18:44

I have done the same thing with my rpi-2 using hotapd and ics-dhcpd-server and in addition installed openvpn and set it up as a vpn router. All you need to do is

sudo iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE

once the vpn server is up and running.

So now rather than using eth0 I just plug in another wifi dongle and I get a mobile vpn router I can carry around ....

wlan1 connects to my isp router and wlan0 is vpn The problem is having two rf modules in very close proximity induces cross-talk ....


This script logs the Pi into a wireless network (e.g. 802.1x) and then configures an access point on a second wifi adapter. https://github.com/DrRowland/pifi2wifi I could not get the above bridge method to work as specified in the question, and so provide this as a working solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.