LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-11-2015, 05:24 AM   #1
blueAlien
Member
 
Registered: May 2005
Location: Seattle, WA
Distribution: Slackware 13
Posts: 88

Rep: Reputation: 15
Question dnsmasq works on wlan1, but not wlan0 (with hostapd & iptables)


My goal is to use hostapd, dnsmasq, and iptables to create a software access point on a laptop to share Internet access from one wireless card to another. I have everthing working, but just not on the correct wireless cards. Currently everything works with wlan0 (broadcom, laptop internal) connecting to the Internet and wlan1 (atheros, usb external) broadcasting as the AP; eth0 can even share from wlan0. The problem is that I would much rather use the bigger antenna on the external wireless card for connecting to the Internet. Both cards support AP (master) mode.

Clients can connect to the AP SSID on either wireless card, but only receive an ip address on when wlan1 is configured as the AP. The Internet works regardless of whether clients can connect or not. Below is the configuration that does not work, but if I change wlan0 to wlan1 and vice versa everything is peachy.

Does anyone know why swapping the wireless cards in the config would stop this from working? Thanks in advanced for any help!

ifconfig
Code:
mon.wlan0 Link encap:UNSPEC  HWaddr 00-22-5F-27-E6-A7-00-00-00-00-00-00-00-00-00-00  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5978 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:721668 (704.7 KiB)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 10:4f:5c:2b:50:68  
          inet addr:172.16.0.1  Bcast:172.16.0.255  Mask:255.255.255.0
          inet6 addr: fe80::124f:5cff:fe2b:5068/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:76618 errors:0 dropped:0 overruns:0 frame:0
          TX packets:78427 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:70281954 (67.0 MiB)  TX bytes:16873535 (16.0 MiB)

wlan1     Link encap:Ethernet  HWaddr d4:17:df:ae:ab:f6  
          inet addr:**DHCP**  Bcast:172.20.20.255  Mask:255.255.255.0
          inet6 addr: fe80::d617:dfff:feae:abf6/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:57132 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52202 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:26388119 (25.1 MiB)  TX bytes:30749140 (29.3 MiB)
/etc/hostapd/hostapd.conf
Code:
interface=wlan0
driver=nl80211
ssid=PineAppleYum
channel=1
/etc/dnsmasq.conf
Code:
log-facility=/var/log/dnsmasq.log
interface=wlan0
interface=eth0
dhcp-range=172.16.0.10,172.16.0.30,255.255.255.0,12h
dhcp-option=3,172.16.0.1
dhcp-option=6,172.16.0.1
no-resolv
no-poll
server=8.8.8.8
server=8.8.4.4
#log-queries
log-dhcp
initAP.sh
Code:
ifconfig wlan0 up
ifconfig wlan0 172.16.0.1/24

iptables -t nat -F
iptables -F
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o wlan1 -j ACCEPT
echo '1' > /proc/sys/net/ipv4/ip_forward

service dnsmasq start
service hostapd start
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Swapping wlan0 and wlan1 hongman Linux - Newbie 2 10-19-2014 05:51 PM
[SOLVED] dnsmasq, iptables, hostapd problem IRIGHTI Linux - Networking 1 09-12-2012 10:17 PM
[SOLVED] change wlan1 back to wlan0 zapo Linux - Networking 2 02-06-2012 08:19 AM
network-manager scanning for wifi's on wlan1 but won't scan when on wlan0? BlackHawk Linux - Networking 2 12-26-2011 07:56 PM
Create a WAP with wlan0 and share/access WI-FI with wlan1? Cyberman Linux - Wireless Networking 1 04-22-2009 07:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration