[Voyage-linux] DHCP server not working using dnsmasq config and nat.sh scripts

Kim-man 'Punky' TSE (spam-protected)
Fri Aug 14 10:15:29 HKT 2015


My always working config are like this:  Wlan0 connects to another AP for outbound, wlan1 as AP and DHCP server (dnsmasq)

auto wlan0
iface wlan0 inet dhcp
         wpa-ssid <>
         wpa-psk <>

auto wlan1
iface wlan1 inet static
         address 10.1.20.1
         netmask 255.255.255.0
         broadcast 10.1.20.255
         hostapd /etc/hostapd/hostapd.wlan1.conf
         up nat.sh wlan1 eth0 "10.1.20.0/24"

/etc/dnsmasq.more.conf
dhcp-range=wlan0,10.1.10.10,10.1.10.250,24h
dhcp-range=eth1,10.1.20.10,10.1.20.250,24h
dhcp-range=eth2,10.1.30.10,10.1.30.250,24h
dhcp-range=eth3,10.1.40.10,10.1.40.250,24h
dhcp-leasefile=/var/tmp/dnsmasq.leases

The different is I don't use WEP but WPA/WPA2.  I use most of default settings in /etc/hostapd/hostapd.wlan0.conf.  Or 
perhaps you missed the first tag (eth1 or whatever) in "dhcp-range=eth1,10.1.20.10,10.1.20.250,24h"?

Regards,
Punky


On 8/13/2015 12:45 AM, Jorge Peña wrote:
> I am copy pasting the files so the mail list can read:
>
> /etc/network/interfaces.d/wlan0.conf
>
> auto wlan0
>
> iface wlan0 inet static
>
>         address 192.168.1.247
>
>         netmask 255.255.255.0
>
>         gateway 192.168.1.1
>
>         dns-nameservers 192.168.1.1 80.58.61.250
>
>         #wpa-driver wext
>
>         wpa-ssid My_SSID
>
>         wpa-psk xxxxxxxxxxxxxxx
>
>         wpa-key-mgmt WPA-PSK
>
>         ## for WPA
>
>         wpa-pairwise TKIP
>
>         wpa-group TKIP
>
>         wpa-proto WPA
>
>         ## for WPA2
>
>         #wpa-pairwise CCMP TKIP
>
>         #wpa-group CCMP TKIP
>
>         #wpa-proto RSN
>
>         #wireless-mode Managed
>
>
> /etc/network/interfaces.d/wlan1.conf
>
> auto wlan1
>
> iface wlan1 inet static
>
>         address 192.168.3.1
>
>         netmask 255.255.255.0
>
>         broadcast 192.168.3.255
>
>         hostapd /etc/hostapd/hostapd.wlan1.conf
>
>         up nat.sh wlan1 wlan0 "192.168.3.0/24"
>
>
> /etc/hostapd/hostapd.wlan1.conf
>
> interface=wlan1
>
> driver=nl80211
>
> ssid=testing
>
> channel=11
>
> hw_mode=g
>
> auth_algs=3
>
> ignore_broadcast_ssid=0
>
> wep_default_key=1
>
> wep_key1="abcde"
>
> wep_key_len_broadcast="5"
>
> wep_key_len_unicast="5"
>
> wep_rekey_period=300
>
>
> /etc/dnsmasq.more.conf
>
> interface=wlan1
>
> dhcp-range=192.168.3.10,192.168.3.250,12h
>
> dhcp-leasefile=/var/tmp/dnsmasq.leases
>
>
> iptables --list
>
> Chain INPUT (policy ACCEPT)
>
> target     prot opt source destination
>
>
> Chain FORWARD (policy ACCEPT)
>
> target     prot opt source destination
>
> wlan1-INBOUND  all  --  anywhere 192.168.3.0/24
>
> wlan1-FORWARD  all  --  192.168.3.0/24 anywhere
>
>
> Chain OUTPUT (policy ACCEPT)
>
> target     prot opt source destination
>
>
> Chain wlan1-FORWARD (1 references)
>
> target     prot opt source destination
>
> ACCEPT     all  --  192.168.3.0/24       anywhere
>
>
> Chain wlan1-INBOUND (1 references)
>
> target     prot opt source destination
>
> ACCEPT     all  --  anywhere 192.168.3.0/24
>
>
> tail -f /var/log/syslog (on client auth)
>
> Aug 10 21:33:27 localhost dnsmasq[3062]: reading /var/run/dnsmasq/resolv.conf
>
> Aug 10 21:33:27 localhost dnsmasq[3062]: using nameserver 80.58.61.250#53
>
> Aug 10 21:33:27 localhost dnsmasq[3062]: using nameserver 192.168.1.1#53
>
> Aug 10 21:34:50 localhost hostapd: wlan1: STA 4c:74:03:21:d4:42 IEEE 802.11: authenticated
>
> Aug 10 21:34:50 localhost hostapd: wlan1: STA 4c:74:03:21:d4:42 IEEE 802.11: associated (aid 1)
>
> Aug 10 21:34:50 localhost hostapd: wlan1: STA 4c:74:03:21:d4:42 RADIUS: starting accounting session 55C91884-00000000
>
>
> Routing table
>
> Kernel IP routing table
>
> Destination     Gateway         Genmask Flags Metric Ref    Use Iface
>
> 0.0.0.0         192.168.1.1     0.0.0.0 UG    0      0        0 wlan0
>
> 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan0
>
> 192.168.3.0     0.0.0.0         255.255.255.0   U     0      0        0 wlan1
>
>

-- 
Regards,
Kim-man "Punky" Tse

* Open Source Embedded Solutions and Systems
   - Voyage Linux (http://linux.voyage.hk)
   - Voyage MPD   (http://linux.voyage.hk/voyage-mpd)
   - Voyage MuBox (http://mubox.voyage.hk)
* Voyage Store   (http://store.voyage.hk)




More information about the Voyage-linux mailing list