pinkman
Posts: 8
Joined: Sun Jan 13, 2013 5:54 pm

RPi dnsmasq dhcp issue: devices do not get ip addresses

Fri Feb 08, 2013 11:19 am

Hello dear community,

I am trying to turn the raspberry pi into a wifi access point.
Although there are several tutorials to do so, there is trouble getting the dhcp server of dnsmasq to work.

First of all: hostapd is running well and providing a wlan other devices could connect to.
But while connecting the dhcp request times out - meaning that clients do not get any ip address.

The config file dnsmasq.conf is really simple as it says the standard settings fit most of the needs. I just added the setting to listen only on the interface wlan0 and set the dhcp range like this:

Code: Select all

interface=wlan0
dhcp-range=10.0.0.20,10.0.0.50,255.255.255.0,12h
In /etc/network/interfaces I specified a static ip address for the interface wlan0 within the same subnet:

Code: Select all

auto lo
iface lo inet loopback
iface eth0 inet dhcp
allow-hotplug wlan0
# THIS LINE IS REPLACED BY THE FOLLOWING LINES FOR hostapd
#iface wlan0 inet manual

iface wlan0 inet static
address 10.0.0.10
netmask 255.255.255.0

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
#iface default inet dhcp
Finally, iwconfig gives the following information:

Code: Select all

wlan0     IEEE 802.11bg  ESSID:"RAPID"  Nickname:"<WIFI@REALTEK>"
          Mode:Master  Frequency:2.442 GHz  Access Point: 80:1F:02:82:23:25
          Bit Rate:54 Mb/s   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=2/100  Signal level=2/100  Noise level=0/100
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
Could you please give me a hint why the access point does not give ip addresses to any connecting device?

Thank you for reading! :)

drgeoff
Posts: 10765
Joined: Wed Jan 25, 2012 6:39 pm

Re: RPi dnsmasq dhcp issue: devices do not get ip addresses

Fri Feb 08, 2013 11:30 am

Is the dhcp server running on the RPi?

Can you post a link to the tutorial you have followed and say which OS distribution you are running?

pinkman
Posts: 8
Joined: Sun Jan 13, 2013 5:54 pm

Re: RPi dnsmasq dhcp issue: devices do not get ip addresses

Fri Feb 08, 2013 12:21 pm

Hi drgeoff and thanks for your answer,
drgeoff wrote:Is the dhcp server running on the RPi?
That's a good point. Although dnsmasq was running after a reboot I only get this on service dnsmasq status:

Code: Select all

[ ok ] Checking DNS forwarder and DHCP server: dnsmasq[....] (dead, pid file exists).
I'm confused. Is this now "ok" or is it "dead"?
Can you post a link to the tutorial you have followed and say which OS distribution you are running?
Sure, sorry that I missed this in my first post.
I followed this tutorial: http://sirlagz.net/2012/08/09/how-to-us ... er-part-1/

Because hostapd was not starting at first, I took the driver from here: http://blog.sip2serve.com/post/38010690 ... -rtl8192cu
(May not be relevant for this topic here)

The RPi runs the latest raspbian: 2012-12-16-wheezy-raspbian

webking
Posts: 7
Joined: Mon Feb 25, 2013 1:27 am

Re: RPi dnsmasq dhcp issue: devices do not get ip addresses

Sun Jun 08, 2014 11:49 pm

Hi,

I don't know if this is still relevant, but I think I get what's wrong with your config. Did you shut down isc-dhcp-server? If you have that installed, the dnsmasq won't be able to work as DHCP server. My advice is to completerly remove that package by:

Code: Select all

sudo apt-get --purge remove isc-dhcp-server
Also, be sure that in /etc/dnsmasq.conf you have correctly enabled the DHCP server, by uncommenting one of the dhcp-range commands. For insance you might uuncomment

Code: Select all

#dhcp-range=192.168.0.50,192.168.0.150,12h
in

Code: Select all

dhcp-range=192.168.0.50,192.168.0.150,12h

Then simply start all again:

Code: Select all

sudo service dnsmasq stop

Code: Select all

sudo service dnsmasq start
Let us know if this solves your problem,

Alberto.

Return to “Troubleshooting”