Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to build wireless AP with 2 Atheros cards (AR5413 / AR5414 both), and one ethernet card to act as WAN. I am also having doubts if I should use ath5k or madwifi drivers. I've tried both already but none worked as I wanted

Here is what I want (if possible):

  1. wireless cards (wlan0 / wlan1) in ap/master mode
  2. wpa2 encryption on both interfaces
  3. each wireless interface has static IP (ex: for wlan0, and for wlan1)
  4. each wireless interface has dhcp-server for managing client's addresses (ex: pool for wlan0:, pool for wlan0: -
  5. eth0 should be WAN interface with dhcp-client (public ip)
  6. forward traffic (and internet) from WAN to wireless interfaces (not sure how this should be done... iptables+dnsmasq?)
  7. QoS control (optional)

I've tried and managed to get wireless essid on box using hostapd (with WPA2 working), but it requires bridge (br0) interface to work (not sure how). This bridge forces ethernet and wireless card not to have IP addresses and bridge takes public IP from cable modem via eth0. As I try to connect my wireless ESSID my client machine (cell phone for ex.) can't get IP (no dhcp-server) and I don't know what configuration to put addresses manually because there is no local IP on wlan0 interface itself.

Just to recap:

[INTERNET] <---- eth0(WAN) <----?NAT?----> wlan0/wlan1

Any suggestion is welcome (due concept or implementation).

share|improve this question
This is surely doable with a Debian installation, I have done this in the past. But consider using [pfSense](pfsense.org), which is based on FreeBSD and has a nice GUI and is much simpler to set up than doing everything from scratch. And BTW, for two distinct WLANs you don't necessarily need two network adapters, many Atheros chips allow multiple networks (up to 5?) on a single chip. – Marco Dec 20 '13 at 20:27
Related: How to turn my Linux netbook into WiFi AP – Marco Dec 20 '13 at 20:30
Thank you for quick replay @Marco. I've never used BSD before, but I'll try pfSence (hope it has similar CLI syntax as GNU/Linux). I wanted to this with debian in first place. I've been reading pfSence forum and there is buncha useful info(like there is codex that everything should be exlained in details). Thanx again for the tip. – cyberbrain Dec 21 '13 at 11:57

Possible and IMO easiest solution for the router:

[INTERNET] ppp0 <--- NAT --> br0 <-- --> wlan0/1

br0 has an assigned local IP, and wlan0,wlan1 are managed by bridge. You can add them with post-up brctl addif br0 wlan0 for wlan0.

So, you need to edit your /etc/network/interfaces for ppp0, br0, wlan0, wlan1. After ppp0 (or whatever you have) is up apply these

echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o ppp0 -s -j MASQUERADE

But! For production environment you need a good firewall.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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