LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 08-10-2015, 04:30 PM   #1
cotarelo
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Rep: Reputation: Disabled
Question DHCP not working in AP interface


Hi

I have configured my debian 8 i586 with two wireless interfaces. One is in client mode (wlan0) and the other is in AP mode (wlan1). Everything works fine but once the clients are authenticated in the AP network they don't get an IP via DHCP and they can't ping any host on the network.

These are my configuration files

/etc/network/interfaces.d/wlan0.conf
Code:
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
Code:
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
Code:
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
Code:
interface=wlan1
dhcp-range=192.168.3.10,192.168.3.250,12h
dhcp-leasefile=/var/tmp/dnsmasq.leases
nat.sh
Code:
#!/bin/sh

if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] ; then
        echo "$0 <nat device> <output device> <network address>"
        exit
fi

iptables -t nat -N "$1"-NAT 2>/dev/null
iptables -t nat -F "$1"-NAT
iptables -t nat -D POSTROUTING -j "$1"-NAT 2>/dev/null
iptables -t nat -A POSTROUTING -j "$1"-NAT
iptables -t nat -D "$1"-NAT -j MASQUERADE 2>/dev/null
iptables -t nat -A "$1"-NAT -o "$2" -s "$3" -j MASQUERADE

# Testing : used for integration with nocat
iptables -N "$1"-FORWARD 2>/dev/null
iptables -F "$1"-FORWARD
iptables -D "$1"-FORWARD -j ACCEPT -s "$3" 2>/dev/null
iptables -A "$1"-FORWARD -j ACCEPT -s "$3"

iptables -D FORWARD -j "$1"-FORWARD -s "$3" 2>/dev/null
iptables -I FORWARD 1 -j "$1"-FORWARD -s "$3"

iptables -N "$1"-INBOUND 2>/dev/null
iptables -F "$1"-INBOUND
iptables -D "$1"-INBONUD -j ACCEPT -d "$3" 2>/dev/null
iptables -A "$1"-INBOUND -j ACCEPT -d "$3"

iptables -D FORWARD -j "$1"-INBOUND -d "$3" 2>/dev/null
iptables -I FORWARD 1 -j "$1"-INBOUND -d "$3"
What is wrong here?
 
Old 08-10-2015, 04:35 PM   #2
cotarelo
LQ Newbie
 
Registered: Jun 2015
Posts: 8

Original Poster
Rep: Reputation: Disabled
So, what happens is when the client authenticates in the AP no DHCP request is received. Just in case I am attaching here some logs

ifconfig
Quote:
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:2 errors:0 dropped:0 overruns:0 frame:0
TX packets:2 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:201 (201.0 B) TX bytes:201 (201.0 B)

wlan0 Link encap:Ethernet HWaddr 00:19:5b:cc:8f:8e
inet addr:192.168.1.247 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::219:5bff:fecc:8f8e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:297 errors:0 dropped:22 overruns:0 frame:0
TX packets:238 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:28036 (27.3 KiB) TX bytes:29900 (29.1 KiB)

wlan1 Link encap:Ethernet HWaddr 00:0b:cd:5c:bc:97
inet addr:192.168.3.1 Bcast:192.168.3.255 Mask:255.255.255.0
inet6 addr: fe80::20b:cdff:fe5c:bc97/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:1048 (1.0 KiB)
iptables --list
Code:
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)
Code:
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
And my routing table
Code:
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

Last edited by cotarelo; 08-11-2015 at 10:54 AM.
 
Old 08-18-2015, 01:46 AM   #3
NM04
Member
 
Registered: Jan 2011
Distribution: Back Track,Fedora,centos
Posts: 240

Rep: Reputation: 14
Quote:
Originally Posted by cotarelo View Post
Hi

/etc/network/interfaces.d/wlan0.conf
Code:
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
Code:
 I would suggest you to change "iface wlan0 inet static" to "iface wlan0 inet dhcp". Also paste the o/p of "service dhcpd status".
 
  


Reply



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
[SOLVED] CentOS DHCP Interface JJJCR Linux - Networking 26 03-19-2015 12:43 AM
DHCP on wired interface only sometimes working, always working on wireless interface PasBern Linux - Networking 5 06-26-2014 02:36 PM
Create a sub interface with dhcp custangro Linux - Networking 9 04-26-2010 05:06 PM
ATT Uverse DHCP Not Assigning to Red Interface Interface on Smoothwall barleykorn Linux - Networking 2 02-14-2010 05:12 PM
interface ok, dhcp ok, routing gw not ok- help sokar Linux - Wireless Networking 4 02-04-2004 10:39 AM

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

All times are GMT -5. The time now is 05:11 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
Open Source Consulting | Domain Registration