# hostapd and dnsmasq

## Treborius

i have an "former" gentoo wlan router here and after a world update it stopped working

i really dont have a clue what is going wrong, i will post some logs maybe someone will see the error

the router worked for more then 200 days uptime but after the world world upgrade something broke

i love this little box, so i am begging please help me out

some facts : 

/etc/init.d/hostapd is running without errors, my conf :

```

cat /etc/hostapd/hostapd.conf

interface=wlan0

driver=nl80211

logger_syslog=-1

logger_syslog_level=2

logger_stdout=-1

logger_stdout_level=2

dump_file=/tmp/hostapd.dump

ctrl_interface=/var/run/hostapd

ctrl_interface_group=0

ssid=PonySlaystation

macaddr_acl=0

auth_algs=3

eap_server=0

eap_message=hello

eapol_key_index_workaround=0

own_ip_addr=127.0.0.1

wpa=3

ieee8021x=0

wpa_passphrase=XXXXXXXXXXXXXXX

wpa_key_mgmt=WPA-PSK

wpa_pairwise=CCMP TKIP

hw_mode=g

channel=11

```

when i try to connect to the router, the logs tell me this

```

Jun  4 08:20:31 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 IEEE 802.11: authenticated

Jun  4 08:20:31 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 IEEE 802.11: associated (aid 1)

Jun  4 08:20:31 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 RADIUS: starting accounting session 4DE97CF5-00000020

Jun  4 08:20:31 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 WPA: pairwise key handshake completed (RSN)

Jun  4 08:21:47 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 IEEE 802.11: authenticated

Jun  4 08:21:47 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 IEEE 802.11: associated (aid 1)

Jun  4 08:21:47 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 RADIUS: starting accounting session 4DE97CF5-00000021

Jun  4 08:21:47 ponyslaystation hostapd: wlan0: STA 00:1f:1f:4a:8b:75 WPA: pairwise key handshake completed (RSN)

```

so everything seems ok

now comes dnsmasq into play

```

Jun  4 08:23:39 ponyslaystation dnsmasq-dhcp[4411]: 98656874 available DHCP range: 192.168.115.0 -- 192.168.115.63

Jun  4 08:23:39 ponyslaystation dnsmasq-dhcp[4411]: 98656874 client provides name: Cruncher

Jun  4 08:23:39 ponyslaystation dnsmasq-dhcp[4411]: 98656874 vendor class: dhcpcd-5.2.12:Linux-2.6.36-tuxonice-r3:i686:GenuineIntel

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 DHCPDISCOVER(wlan0) 00:1f:1f:4a:8b:75

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 DHCPOFFER(wlan0) 192.168.115.53 00:1f:1f:4a:8b:75

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 1:netmask, 121:classless-static-route, 33:static-r$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 3:router, 6:dns-server, 12:hostname, 15:domain-nam$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 26:mtu, 28:broadcast, 42:ntp-server, 51:lease-time$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 54:server-identifier, 58:T1, 59:T2, 119:domain-sea$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 tags: known, wlan0

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 next server: 192.168.115.254

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  1 option: 53:message-type  02

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option: 54:server-identifier  192.168.115.254

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option: 51:lease-time  00:00:a8:c0

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option: 58:T1  00:00:54:60

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option: 59:T2  00:00:93:a8

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option:  1:netmask  255.255.255.0

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option: 28:broadcast  192.168.115.255

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option:  3:router  192.168.115.254

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 sent size:  4 option:  6:dns-server  192.168.115.254

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 available DHCP range: 192.168.115.0 -- 192.168.115.63

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 client provides name: Cruncher

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 vendor class: dhcpcd-5.2.12:Linux-2.6.36-tuxonice-r3:i686:GenuineIntel

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 DHCPDISCOVER(wlan0) 00:1f:1f:4a:8b:75

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 DHCPOFFER(wlan0) 192.168.115.53 00:1f:1f:4a:8b:75

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 1:netmask, 121:classless-static-route, 33:static-r$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 3:router, 6:dns-server, 12:hostname, 15:domain-nam$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 26:mtu, 28:broadcast, 42:ntp-server, 51:lease-time$

Jun  4 08:23:42 ponyslaystation dnsmasq-dhcp[4411]: 98656874 requested options: 54:server-identifier, 58:T1, 59:T2, 119:domain-sea$

```

but i dont get an ip

client hostname is cruncher 

i really dont know where the problem lies, 

setting an ip manually like 192.168.115.10 i still cant ping the router

but client and router can communicate as the logs tell me

that there is an active wpa2 connection

----------

## solamour

Have you figured out yet? I'm having pretty much the same problem; hostapd + dnsmasq works as long as I don't use WPA. According to hostapd's output, it looks like the wireless device (my phone) and the access point are talking to each other.

```
# hostapd -dd /etc/hostapd/hostapd.conf

wlan0: STA 5c:da:d4:29:d3:08 IEEE 802.11: authentication OK (open system)

wlan0: STA 5c:da:d4:29:d3:08 MLME: MLME-AUTHENTICATE.indication(5c:da:d4:29:d3:08, OPEN_SYSTEM)

wlan0: STA 5c:da:d4:29:d3:08 MLME: MLME-DELETEKEYS.request(5c:da:d4:29:d3:08)

wlan0: STA 5c:da:d4:29:d3:08 IEEE 802.11: authenticated

wlan0: STA 5c:da:d4:29:d3:08 IEEE 802.11: association OK (aid 1)

wlan0: STA 5c:da:d4:29:d3:08 IEEE 802.11: associated (aid 1)

wlan0: STA 5c:da:d4:29:d3:08 MLME: MLME-ASSOCIATE.indication(5c:da:d4:29:d3:08)

wlan0: STA 5c:da:d4:29:d3:08 MLME: MLME-DELETEKEYS.request(5c:da:d4:29:d3:08)

wlan0: STA 5c:da:d4:29:d3:08 WPA: event 1 notification

wlan0: STA 5c:da:d4:29:d3:08 WPA: start authentication

wlan0: STA 5c:da:d4:29:d3:08 IEEE 802.1X: unauthorizing port

wlan0: STA 5c:da:d4:29:d3:08 WPA: sending 1/4 msg of 4-Way Handshake

wlan0: STA 5c:da:d4:29:d3:08 WPA: received EAPOL-Key frame (2/4 Pairwise)

wlan0: STA 5c:da:d4:29:d3:08 WPA: sending 3/4 msg of 4-Way Handshake

wlan0: STA 5c:da:d4:29:d3:08 WPA: received EAPOL-Key frame (4/4 Pairwise)

wlan0: STA 5c:da:d4:29:d3:08 IEEE 802.1X: authorizing port

wlan0: STA 5c:da:d4:29:d3:08 RADIUS: starting accounting session 4E4EAC07-00000000

wlan0: STA 5c:da:d4:29:d3:08 WPA: pairwise key handshake completed (RSN)

```

```
/etc/hostapd/hostapd.conf

interface=wlan0

driver=nl80211

ssid=mywifi

hw_mode=g

channel=1

wpa=3

wpa_passphrase=SECRET_PASSPHRASE

wpa_key_mgmt=WPA-PSK WPA-EAP

wpa_pairwise=TKIP CCMP

rsn_pairwise=CCMP
```

But the wireless device doesn't get the IP. If I disable WPA (i.e. "wpa=0"), everything works. I'd appreciate any suggestions.

On a related note, where does dnsmasq's log go? I added "log-queries" and "log-dhcp" in "/etc/dnsmasq.conf" file, but I'm not sure which file contains the log info.

__

sol

----------

## solamour

I think the problem with my system is somewhat different. Refer to the following link.

https://forums.gentoo.org/viewtopic-p-6791000.html#6791000

[Edit] My USB WiFi interface is working now. I summarized what worked in the same post.

__

sol

----------

