No DHCP Server in AP mode after RESET

Hi Everybody,

I am having problems accessing my yun in its AP-mode, after either a WLAN_RST or calling /etc/bin/wifi-reset-and-reboot directly. I have also tried powering the yun off/reset after switching to AP-mode.

While I can still see and connect to the interface (eg. Arduino Yun-MACXXX), but the yun won’t give me a IP address. I suspect an openwrt dhcp server problem.

This is because I can still manually configure an IP address (eg. IP=192.168.240.2 SUBNET=255.255.255.0 GATEWAY=192.168.240.1) to see the yun at its default IP (eg. 192.168.240.1)

Any ideas?

Ok. so I just tried resetting openwrt's dhcp server by excuting "/etc/init.d/dnsmasq restart" ...

And everything works great for like 2 mins, new clients are able to connect and get leases. However after 2 mins they get kicked off / dropped ...

what gives? :frowning:

Reset to factory default settings, will bring Yun into AP mode (static IP and no dhcp service). Backup your own data!
http://www.ibuyopenwrt.com/index.php/8-yun-compatible/104-reset-to-factory-settings

Turn on AP encryption and Setup Wifi DHCP Service
http://www.ibuyopenwrt.com/index.php/2-uncategorised/201-turn-on-ap-encryption-and-setup-wifi-dhcp-service

Thanks @sonnyyu. I took your advice and reset-to-factory, and debugged my project from there.

In the case it might help somebody, my problem was a cron script for checking internet connectivity. It would reset the network service if it couldn't ping the yun's default gateway, which of course isn't defined in it's ap-mode

Here's the final correct code

#!/bin/ash

# ping default wifi gateway and direct stdout stderr to null
# check exit status: $?. note whitespace in conditionals important

# IF ap-mode do not check default gateway because
#    will always fail and network will endlessly be reset 
WIFIMODE=$(uci get wireless.@wifi-iface[0].mode)
if [ $WIFIMODE == 'ap' ]; then
   exit 0
fi

# determine and attempt to ping default gateway
DEFAULT_GATEWAY=$(route | awk '/default/ { print $2 }')
ping -c 1 $DEFAULT_GATEWAY &>/dev/null

if [ $? -eq 0 ]; then

  # wifi ok

else

  # wifi down  
  # restart
  /etc/init.d/network restart
fi