# wifiApTest not connecting clients

**URL:** <https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797>\
**Category:** Uncategorized\
**Created:** [November 17, 2017, 8:50am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797 "2017-11-17T08:50:58Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 17, 2017, 8:50am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/1 "2017-11-17T08:50:58Z")

</div>

Hi all,

I have started exploring wifi applications of legato. The WiFi client and client test seems to be working fine; but access point is acting up.

In both legato command line and test application I can create a discoverable WiFi access point; but when I try to connect with the access point with a device it is remaining at “connecting…” and is not proceeding further. I have set up the etc/dnsmasq.d/wifiAP.conf as specified by the wifiApTest.c.

Also while using command line to set up the wifi I execute the commands as specified in [wifi - Legato Docs](http://legato.io/legato-docs/latest/wifi_toolsTarget_wifi.html).

I am using a MangOH Green board with wp8548.

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [November 20, 2017, 11:07pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/2 "2017-11-20T23:07:39Z")

</div>

Hi @codegit001,

So you’re trying to connect to the (mangOH) AP from a device (Another mangOH? PC? Smartphone?) and the device shows “Connecting …” ?

I wonder if the DHCP server is working properly. What’s the content of {{/etc/dnsmasq.d/wifiAP.conf}}?  
Is dnsmasq running? With which args?

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 21, 2017, 4:44am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/3 "2017-11-21T04:44:28Z")

</div>

I am trying to connect using my mobile phone.

I used logread -f | grep wifi and it says peer didnot ack 100 packets and is disconnecting. I have the logs, but it seems I cannot attach files to my comments yet.

From the logs dnsmasq is up and running with the values from wifiAp.conf; which contains:  
dhcp-range=wlan0,192.168.10.10,192.168.10.199,24h

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [November 21, 2017, 8:24pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/4 "2017-11-21T20:24:20Z")

</div>

Have you tried with another device?  
Eventually one where you can set a static IP just to get that out of the way, even though that doesn’t seem to be the problem here.  
Your `wlan0` ip is something like 129.168.10.1 right?

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 23, 2017, 12:17pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/5 "2017-11-23T12:17:27Z")

</div>

wlan0 ip: 192.168.10.1

Made a laptop running Windows 7 as the client with::  
static IP: 192.168.10.2 | mask: 255.255.255.0 | default gateway: 192.168.10.1

The lap says “Connection was unsuccessful The computer currently has limited connectivity to ”

I had run the ‘cm data connect’ with a successfull connection to my service provider and successful ping.

The ‘logread -f’ returns the following:

Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa\_wifi\_ap\_ti.c pa\_wifiAp\_Start() 597 | Start Access Point Cmd: /bin/hostapd /tmp/hostapd.conf  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | WIFIAP\_HOSTAPD\_START  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa\_wifi\_ap\_ti.c pa\_wifiAp\_Start() 606 | WiFi Access Point Command OK:wlan0 WIFIAP\_HOSTAPD\_START  
Nov 23 12:05:20 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/framework T=main | le\_wifiAp\_server.c Handle\_le\_wifiAp\_Start() 512 | Sending response to client session 0x27dfc : 4 bytes sent  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c Testle\_wifiApStart() 212 | Start OK  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: ifconfig wlan0 192.168.10.1 up  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: echo 1 \> /proc/sys/net/ipv4/ip\_forward  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: modprobe ipt\_MASQUERADE  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: iptables -A POSTROUTING -t nat -o rmnet0 -j MASQUERADE  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: iptables -A FORWARD --match state --state RELATED,ESTABLISHED --jump ACCEPT  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: iptables -A FORWARD -i wlan0 --destination 192.168.0.0/24 --match state --state NEW --jump ACCEPT  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c RunSystemCommand() 92 | Success: iptables -A INPUT -s 192.168.0.0/24 --jump ACCEPT  
Nov 23 12:05:20 swi-mdm9x15 user.debug Legato: DBUG | wifiApTest[2299]/framework T=main | le\_wifiAp\_client.c le\_wifiAp\_SetIpRange() 1552 | Sending message to server and waiting for response : 50 bytes sent  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa\_wifi\_ap\_ti.c pa\_wifiAp\_SetIpRange() 1032 | @AP=c0a80a01, @APstart=c0a80a0a, @APstop=c0a80a14  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa\_wifi\_ap\_ti.c pa\_wifiAp\_SetIpRange() 1068 | Creation of dnsmasq configuration file (/tmp/dnsmasq.wlan.conf)  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa\_wifi\_ap\_ti.c pa\_wifiAp\_SetIpRange() 1089 | @AP=192.168.10.1, @APstart=192.168.10.10, @APstop=192.168.10.20  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | stopping DNS forwarder and DHCP server: dnsmasq…  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | no /usr/bin/dnsmasq found; none killed  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | starting DNS forwarder and DHCP server: dnsmasq…  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: started, version 2.71 cachesize 150  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: compile time options: IPv6 GNU-getopt no-DBus no-i18n no-IDN DHCP DHCPv6 no-Lua TFTP no-conntrack ipset auth no-DNSSEC  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCP, IP range 192.168.10.10 – 192.168.10.20, lease time 1d  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCP, IP range 192.168.2.3 – 192.168.2.3, lease time 12h  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCP, IP range 192.168.10.10 – 192.168.10.199, lease time 1d  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: reading /etc/resolv.conf  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | supervisor[469]/supervisor T=main | supervisor.c SigChildHandler() 680 | Reaping unconfigured child process 2368.  
Nov 23 12:05:20 swi-mdm9x15 user.info Legato: INFO | wifiService[2085] | done.  
Nov 23 12:05:20 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/framework T=main | le\_wifiAp\_server.c Handle\_le\_wifiAp\_SetIpRange() 997 | Sending response to client session 0x27dfc : 4 bytes sent  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 192.168.1.41#53  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 192.168.1.40#53  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 8.8.8.8#53  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 218.248.112.65#53  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: using nameserver 218.248.112.1#53  
Nov 23 12:05:20 swi-mdm9x15 daemon.info dnsmasq[2369]: read /etc/hosts - 1 addresses  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa\_wifi\_ap\_ti.c WifiApPaThreadMain() 247 | PARSING:wlan0 (phy #0): mgmt TX status (cookie cea6a540): acked : len:56  
Nov 23 12:05:24 swi-mdm9x15 daemon.info hostapd: wlan0: STA b0:c0:90:bc:9d:d7 IEEE 802.11: authenticated  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa\_wifi\_ap\_ti.c WifiApPaThreadMain() 247 | PARSING:wlan0: new station b0:c0:90:bc:9d:d7 : len:37  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa\_wifi\_ap\_ti.c WifiApPaThreadMain() 250 | FOUND new station  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa\_wifi\_ap\_ti.c WifiApPaThreadMain() 253 | InternalWifiApStateEvent event: 0  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=main | pa\_wifi\_ap\_ti.c FirstLayerWifiApEventHandler() 207 | Event: 0  
Nov 23 12:05:24 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/daemon T=main | le\_wifiAp.c PaEventApHandler() 37 | Event: 0  
Nov 23 12:05:24 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/daemon T=main | le\_wifiAp.c FirstLayerWifiApEventHandler() 60 | Event: 0  
Nov 23 12:05:24 swi-mdm9x15 user.debug Legato: DBUG | wifiService[2085]/framework T=main | le\_wifiAp\_server.c AsyncResponse\_le\_wifiAp\_AddNewEventHandler() 326 | Sending message to client session 0x27dfc : 8 bytes sent  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c myMsgHandler() 163 | WiFi access point event received  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiApTest[2299]/wifiApComponents T=main | wifi\_novice.c myMsgHandler() 169 | LE\_WIFIAP\_EVENT\_CLIENT\_CONNECTED  
Nov 23 12:05:24 swi-mdm9x15 user.info Legato: INFO | wifiService[2085]/daemon T=WifiApPaThread | pa\_wifi\_ap\_ti.c WifiApPaThreadMain() 247 | PARSING:wlan0 (phy #0): mgmt TX status (cookie cc60fb40): acked : len:56  
Nov 23 12:05:24 swi-mdm9x15 daemon.info hostapd: wlan0: STA b0:c0:90:bc:9d:d7 IEEE 802.11: associated (aid 1)  
Nov 23 12:05:24 swi-mdm9x15 daemon.info hostapd: wlan0: STA b0:c0:90:bc:9d:d7 WPA: pairwise key handshake completed (RSN)  
Nov 23 12:06:03 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCPINFORM(usb0) 192.168.2.3 02:d1:26:94:69:55  
Nov 23 12:06:03 swi-mdm9x15 daemon.info dnsmasq-dhcp[2369]: DHCPACK(usb0) 192.168.2.3 02:d1:26:94:69:55 BLR-DTDL3P1MXJ2

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 23, 2017, 12:17pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/6 "2017-11-23T12:17:57Z")

</div>

I have made the change from eth0 to rmnet0 in the code.

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 23, 2017, 12:20pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/7 "2017-11-23T12:20:25Z")

</div>

Also BLR-DTDL3P1MXJ2 is the workstation from which the ssh is connecting to the board. Why is that popping up with reference to dnsmasq-dhcp[2369]: DHCPACK(usb0) and dnsmasq-dhcp[2369]: DHCPINFORM(usb0)

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [November 23, 2017, 10:54pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/8 "2017-11-23T22:54:25Z")

</div>

> [@codegit001](#):
>
> Success: iptables -A INPUT -s 192.168.0.0/24 --jump ACCEPT

I’m really surprised to see some `192.168.0.0/24` in there.  
Seems like the subnet is wrong, as it should be `192.168.10.0/24`.  
It’s the case in the doc but not in `wifiApTest.c`.  
Could you see if that fixes the connectivity issue?

Thanks

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 24, 2017, 6:06am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/9 "2017-11-24T06:06:13Z")

</div>

Now the laptop promptly display “Connected”; but even though I am able to ping data quite easily using my board, the connected device seems unable to do so.

Also this is using static IP. Is there any way I can still use actual DHCP ?

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 24, 2017, 6:48am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/10 "2017-11-24T06:48:54Z")

</div>

The issue is now the fact that the board is not transferring data to its client. How can I use something like TFTP with the existing connection ? I enabled tftp client in my Windows 7 client, but the connections are timing out.

tftp -l file.txt -p 192.168.10.1  
tftp: timeout

---

<div class="post-metadata">

**Author:** ![CoRfr](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.legato.io/corfr/32/69_2.png) [@CoRfr](https://forum.legato.io/u/CoRfr)\
**Post date:** [November 24, 2017, 4:29pm UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/11 "2017-11-24T16:29:56Z")

</div>

Is there a tftp server on your target? There is none by default.

Easiest way would be to use SSH (& SCP), but you would also need to open access to the target ssh port from wlan0.

This would be something like:

```auto
# Allow SSH, PING and DHCP over WiFi interface
LAN_IF=wlan0
iptables -A INPUT -i @LAN_IF@ -p tcp -m tcp --dport 22 -j ACCEPT
iptables -A INPUT -i @LAN_IF@ -p icmp -m icmp --icmp-type 8 -j ACCEPT
iptables -A INPUT -i @LAN_IF@ -p udp --dport 67:68 --sport 67:68 -j ACCEPT

```

(adapted from `meta-swi/meta-swi-mdm9xxx/recipes-core/init-ifupdown/files/rules.v4`)

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [November 27, 2017, 10:18am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/12 "2017-11-27T10:18:18Z")

</div>

Any solutions on why the data cannot reach the client ? I am able to ping sites using the board; but the connected clients declare the Access Point as “No Internet Connection”.

---

<div class="post-metadata">

**Author:** ![codegit001](https://avatars.discourse-cdn.com/v4/letter/c/7c8e57/32.png) [@codegit001](https://forum.legato.io/u/codegit001)\
**Post date:** [January 1, 2018, 9:02am UTC](https://forum.legato.io/t/wifiaptest-not-connecting-clients/2797/13 "2018-01-01T09:02:23Z")

</div>

@CoRfr after some snooping around, dropping the IP Tables just before resetting the modprob masquerade seems to do the trick; I was busy with another project, so I couldn’t pay attention to this. Cheers.
