I did setup hostapd
and udhcpd
for my wlan0. After startup, the hostapd
is running and I see the ssid with another device, but I don't receive a dhcp address. Well, I can't, because the udhcpd is not running, and systemctl status udhcpd.service
claims:
● udhcpd.service - LSB: Start busybox udhcpd at boot time
Loaded: loaded (/etc/init.d/udhcpd)
Active: active (exited) since Thu 2017-03-16 14:24:06 CET; 7min ago
Process: 611 ExecStart=/etc/init.d/udhcpd start (code=exited, status=0/SUCCESS)
Mar 16 14:24:06 testo-mx6 systemd[1]: Starting LSB: Start busybox udhcpd at boot time...
Mar 16 14:24:06 testo-mx6 systemd[1]: Started LSB: Start busybox udhcpd at boot time.
Mar 16 14:24:06 testo-mx6 udhcpd[611]: Starting very small Busybox based DHCP server: udhcpd.
Active, but exited? And why did it exit? I tried a bunch of restarts and interface resets and finally found this script to be reliable:
#!/bin/sh
systemctl stop udhcpd.service
systemctl stop hostapd.service
ifdown wlan0
ifup wlan0
sleep 1
systemctl start udhcpd.service
Now everything is running as expected. But using this script is a nasty workaround. I want the services to start up as supposed.
My /etc/udhcpd.conf
looks like
start 192.168.42.20 #default: 192.168.0.20
end 192.168.42.254 #default: 192.168.0.254
interface wlan0 #default: eth0
max_leases 2 #default: 254
siaddr 192.168.42.42 #default: 0.0.0.0
sname foobar #default: (none)
option domain local
option lease 864000 # 10 days of seconds
And /etc/network/interfaces
auto wlan0
iface wlan0 inet static
hostapd /etc/hostapd/hostapd.conf
address 192.168.42.42
netmask 255.255.255.0
And in case it is relevant also the /etc/hostapd/hostapd.conf
:
interface=wlan0
driver=nl80211
channel=1
hw_mode=g
wmm_enabled=0
max_num_sta=1
ssid=foobar
I tried to put a sleep
in the /etc/init.d/udhcpd
startup (seemed to have helped in another posting I found), but to no avail.