Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Hostapd & dnsmasq delayed getting IP
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Chewbacca Rampage
n00b
n00b


Joined: 08 Nov 2007
Posts: 12

PostPosted: Thu Nov 08, 2007 2:15 am    Post subject: Hostapd & dnsmasq delayed getting IP Reply with quote

Strange problem. I have
    iptables
    dnsmasq
    madwifi
    hostapd
Everything works fine. I added Hostapd and it works fine, but dnsmasq does not give an IP address immediately. The strange thing is, if I leave the client machine on, at random, it will get an IP address eventually. I've tested this a couple of times and I get it ranging from 3 minutes to 1 hour of waiting.

Checking the logs on the server, I see this repeated at lot:
Code:

Nov  7 19:56:24 itx hostapd: ath0: STA 00:13:e8:25:7a:91 IEEE 802.11: associated
Nov  7 19:56:24 itx hostapd: ath0: STA 00:13:e8:25:7a:91 WPA: pairwise key handshake completed (WPA)                                                            Nov  7 19:56:25 itx hostapd: ath0: STA 00:13:e8:25:7a:91 WPA: group key handshake completed (WPA)                                                               Nov  7 19:57:05 itx dnsmasq[4129]: DHCPDISCOVER(ath0) 00:13:e8:25:7a:91
Nov  7 19:57:05 itx dnsmasq[4129]: DHCPOFFER(ath0) 192.168.0.95 00:13:e8:25:7a:91                                                                               Nov  7 19:57:32 itx dnsmasq[4129]: DHCPDISCOVER(ath0) 00:13:e8:25:7a:91
Nov  7 19:57:32 itx dnsmasq[4129]: DHCPOFFER(ath0) 192.168.0.95 00:13:e8:25:7a:9
.... above repeats for a long time until:
Nov  7 20:50:43 itx hostapd: ath0: STA 00:13:e8:25:7a:91 WPA: group key handshake completed (WPA)
Nov  7 20:53:25 itx dnsmasq[4129]: DHCPDISCOVER(ath0) 00:13:e8:25:7a:91
Nov  7 20:53:25 itx dnsmasq[4129]: DHCPOFFER(ath0) 192.168.0.95 00:13:e8:25:7a:91
Nov  7 20:53:32 itx dnsmasq[4129]: DHCPDISCOVER(ath0) 00:13:e8:25:7a:91
Nov  7 20:53:32 itx dnsmasq[4129]: DHCPOFFER(ath0) 192.168.0.95 00:13:e8:25:7a:91
Nov  7 20:53:32 itx dnsmasq[4129]: DHCPREQUEST(ath0) 192.168.0.95 00:13:e8:25:7a:91
Nov  7 20:53:32 itx dnsmasq[4129]: DHCPACK(ath0) 192.168.0.95 00:13:e8:25:7a:91 V2S

Once DHCPACK is called, the client machine will get the ip address.

If I manually set the ip after boot with ifconfig, everything works fine. It'd just be nice to have a dhcp server up and running for friends that come over.

Couldn't find any information regarding this strange situation, but would anyone happen to know what the cause is?
Back to top
View user's profile Send private message
gerdesj
l33t
l33t


Joined: 29 Sep 2005
Posts: 622
Location: Yeovil, Somerset, UK

PostPosted: Thu Nov 08, 2007 11:39 pm    Post subject: Re: Hostapd & dnsmasq delayed getting IP Reply with quote

I am not an expert on hostapd but I am familiar with dhcp.

Have you got it set to ping an address to see if it is free before allocation. Try turning it off if it is on. The repeated requsts indicate something like this.

Another thing I've just found: From http://www.thekelleys.org.uk/dnsmasq/docs/FAQ

Q: This new DHCP server is well and good, but it doesn't work for me.
What's the problem?

A: There are a couple of configuration gotchas which have been
encountered by people moving from the ISC dhcpd to the dnsmasq
integrated DHCP daemon. Both are related to differences in
in the way the two daemons bypass the IP stack to do "ground up"
IP configuration and can lead to the dnsmasq daemon failing
whilst the ISC one works.

The first thing to check is the broadcast address set for the
ethernet interface. This is normally the adddress on the connected
network with all ones in the host part. For instance if the
address of the ethernet interface is 192.168.55.7 and the netmask
is 255.255.255.0 then the broadcast address should be
192.168.55.255. Having a broadcast address which is not on the
network to which the interface is connected kills things stone
dead.

The second potential problem relates to firewall rules: since the ISC
daemon in some configurations bypasses the kernel firewall rules
entirely, the ability to run the ISC daemon does not indicate
that the current configuration is OK for the dnsmasq daemon.
For the dnsmasq daemon to operate it's vital that UDP packets to
and from ports 67 and 68 and broadcast packets with source
address 0.0.0.0 and destination address 255.255.255.255 are not
dropped by iptables/ipchains.

There is also this but I think it is rubbish!

Q: Why does my Gentoo box pause for a minute before getting a new
lease?

A: Because when a Gentoo box shuts down, it releases its lease with
the server but remembers it on the client; this seems to be a
Gentoo-specific patch to dhcpcd. On restart it tries to renew
a lease which is long gone, as far as dnsmasq is concerned, and
dnsmasq ignores it until is times out and restarts the process.
To fix this, set the dhcp-authoritative flag in dnsmasq.


Cheers
Jon
Back to top
View user's profile Send private message
Chewbacca Rampage
n00b
n00b


Joined: 08 Nov 2007
Posts: 12

PostPosted: Tue Nov 13, 2007 4:07 am    Post subject: Reply with quote

I think I found the problem, but how to solve it?

Code:
wlan0: authentication frame received from XX:XX:XX:XX:XX:XX, but not in authenticate state - ignored

keep getting these messages in dmesg. Once it finally get authenticated, I can grab an IP address from the DHCP server.

I figure it's not authenticating, so then it ignores the DHCP requests. Any idea what to do next?
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum