0

I'm trying to write a script that starts hostapd when called on raspbian, but I don't manage to get rid of the dhcp client process:

start-hostapd.sh

echo 'stopping wpa supplicant'
systemctl stop wpa_supplicant.service
sudo dhcpcd -k wlan0
echo 'bringing interface down'
ifdown wlan0
ifconfig wlan0 192.168.1.1
ifconfig wlan0 netmask 255.255.255.0
echo 'tarting hostapd'
systemctl start hostapd.service
ifup wlan0
systemctl start isc-dhcp-server.service

When I run it howerver the dhcp client gets active and blocks everything:

sudo sh start-hostapd.sh
stopping wpa supplicant
dhcpcd[1181]: sending commands to master dhcpcd process
bringing interface down
Killed old client process
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/b8:27:eb:b8:86:33
Sending on   LPF/wlan0/b8:27:eb:b8:86:33
Sending on   Socket/fallback
DHCPRELEASE on wlan0 to 10.0.1.1 port 67
tarting hostapd
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/b8:27:eb:b8:86:33
Sending on   LPF/wlan0/b8:27:eb:b8:86:33
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 3
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 5
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 10.0.1.1
DHCPACK from 10.0.1.1
bound to 10.0.1.15 -- renewal in 33866 seconds.

How do I keep dhcpd from doing this?

0

Whatever is causing this, it's certainly not the dhcp server doing it, that just listens for requests and responds. BTW, I've been running hostapd and isc-dhcp-server on my wlan0 for years - a dhcp server is pretty nearly essential for an AP.

It looks like you have a dhclient running on wlan0. Maybe you have iface wlan0 inet dhcp in /etc/network/interfaces. if so, change it to:

iface wlan0 inet static
  address 192.168.1.1
  netmask 255.255.255.0
  broadcast 192.168.1.255

or maybe you're running network manager. nuke it from orbit.

Also, you should run ifup wlan0 before starting hostapd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.