irose57
Posts: 2
Joined: Sun Apr 09, 2017 5:24 am

RPI3 acting as DHCP Server

Sun Apr 09, 2017 6:09 am

Hi - I'm new to all this but I have an issue where my Pi is acting as a DHCP server on my network. It's allocating addresses to devices that get turned on rather than my router. I've tried searching for ways to disable this to no avail.

I tried dpkg -l | grep -i dhcp and got the following:

ii dhcpcd5 6.7.1-1+rpi5 armhf DHCv4, IPv6RA and DHCPv6 client with IPv4LL support
ii isc-dhcp-client 4.3.1-6+deb8u2 armhf DHC client for automatically obtaining an IP address
ii isc-dhcp-common 4.3.1-6+deb8u2 armhf common files used by all of the isc-dhcp packages
ii udhcpd 1:1.22.0-9+deb8u1 armhf Provides the busybox DHCP server implementation

Tried sudo update-rc.d udhcpd disable but got the following.

update-rc.d: error: cannot find a LSB script for udhcpd

Help much appreciated!

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: RPI3 acting as DHCP Server

Sun Apr 09, 2017 11:37 am

I haven't tried this, but it should work if you don't want to remove the udhcpd package.
Edit the file /etc/default/udhcpd and change the line:
#DHCPD_ENABLED="no"
to
DHCPD_ENABLED="no"
or add that last line if missing.

epoch1970
Posts: 5203
Joined: Thu May 05, 2016 9:33 am
Location: Paris, France

Re: RPI3 acting as DHCP Server

Sun Apr 09, 2017 11:38 am

Welcome.

I would try this to identify who is serving dhcp leases on the Pi:

Code: Select all

admin@cassis:~ $ sudo lsof -i udp:67
[sudo] password for admin: 
COMMAND  PID    USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
dnsmasq 1950 dnsmasq    4u  IPv4  12457      0t0  UDP *:bootps 
admin@cassis:~ $ ps w 1950
  PID TTY      STAT   TIME COMMAND
 1950 ?        S      0:05 /usr/sbin/dnsmasq -x /var/run/dnsmasq/dnsmasq.pid -u dnsmasq -r /var/run/dnsmasq/resolv.conf -7 /etc/dnsmasq.d,.dpk
As you see in this case it is dnsmasq.

And if you want the deluxe edition:

Code: Select all

admin@cassis:~ $ sudo apt-get install apt-file
...
The system-wide cache is empty. You may want to run 'apt-file update'
as root to update the cache. You can also run 'apt-file update' as
normal user to use a cache in the user's home directory.
admin@cassis:~ $ sudo apt-file update
...
admin@cassis:~ $ sudo apt-file search /usr/sbin/dnsmasq
dnsmasq-base: /usr/sbin/dnsmasq
So if I wanted to remove that executable I would try to "apt-get remove dnsmasq-base".

HTH
"S'il n'y a pas de solution, c'est qu'il n'y a pas de problème." Les Shadoks, J. Rouxel

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: RPI3 acting as DHCP Server

Sun Apr 09, 2017 3:21 pm

irose57 wrote: Tried sudo update-rc.d udhcpd disable but got the following.

update-rc.d: error: cannot find a LSB script for udhcpd

Help much appreciated!
On a recent (Jessie) version of raspbian try using systemctl instead - this should work for systemd services (the modern way of doing things) and legacy init scripts.

Code: Select all

sudo systemctl disable udhcpd
sudo systemctl stop udhcpd
Of course, if you don't need that package installed (I don't think it's installed by default) you could just 'apt-get remove' it
epoch1970 wrote:Welcome.


And if you want the deluxe edition:

Code: Select all

admin@cassis:~ $ sudo apt-get install apt-file
...
So if I wanted to remove that executable I would try to "apt-get remove dnsmasq-base".
For an installed package you don't even need to install apt-file, just use (I've got the isc dhcpd server installed rather than dnsmasq or udhcpd)

Code: Select all

pi@pi2:~ $ dpkg -S /usr/sbin/dhcpd
isc-dhcp-server: /usr/sbin/dhcpd

irose57
Posts: 2
Joined: Sun Apr 09, 2017 5:24 am

Re: RPI3 acting as DHCP Server

Mon Apr 10, 2017 1:27 am

Thanks for the replies.

Will try

sudo systemctl disable udhcpd
sudo systemctl stop udhcpd

Will let you know how I go.

Return to “Troubleshooting”