0

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

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 get 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

I'm not sure if this is a bug, but when you run sudo dhcpcd -k [interface] first it always returns sending commands to master dhcpcd process until you use without -k.

Observe:

pi@raspberrypi:~ $ sudo dhcpcd -k eth0
dhcpcd[1351]: sending commands to master dhcpcd process
pi@raspberrypi:~ $ sudo dhcpcd -k eth0
dhcpcd[1359]: sending commands to master dhcpcd process
pi@raspberrypi:~ $ sudo dhcpcd -k eth0
dhcpcd[1367]: sending commands to master dhcpcd process
pi@raspberrypi:~ $ sudo dhcpcd -k eth0
dhcpcd[1375]: sending commands to master dhcpcd process
pi@raspberrypi:~ $ sudo dhcpcd eth0
dhcpcd[1383]: sending commands to master dhcpcd process
pi@raspberrypi:~ $ sudo dhcpcd -k eth0
dhcpcd[1396]: control_open: Connection refused
dhcpcd[1396]: dhcpcd not running
pi@raspberrypi:~ $ sudo dhcpcd eth0
dhcpcd[1690]: control_open: Connection refused
dhcpcd[1690]: version 6.7.1 starting
dhcpcd[1690]: eth0: adding address fe80::4dda:139d:e51f:b89c
dhcpcd[1690]: DUID 00:01:00:01:1f:cb:3a:e3:b8:27:eb:d0:d8:c7
dhcpcd[1690]: eth0: IAID eb:d0:d8:c7
dhcpcd[1690]: eth0: soliciting an IPv6 router
dhcpcd[1690]: eth0: soliciting a DHCP lease
dhcpcd[1690]: eth0: offered 10.0.0.3 from 10.0.0.1
dhcpcd[1690]: eth0: leased 10.0.0.3 for 86400 seconds
dhcpcd[1690]: eth0: adding route to 10.0.0.0/24
dhcpcd[1690]: eth0: adding default route via 10.0.0.1
dhcpcd[1690]: forked to background, child pid 1732
pi@raspberrypi:~ $

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.