Disable DHCP completely

I’ve configured my EmonPI with a static IP address

> [email protected](ro):~$ cat /etc/network/interfaces
> # interfaces(5) file used by ifup(8) and ifdown(8)
> # Please note that this file is written to be used with dhcpcd
> # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
> # Include files from /etc/network/interfaces.d:
> source-directory /etc/network/interfaces.d
> auto lo
> iface lo inet loopback
> #iface eth0 inet manual
> auto eth0
> iface eth0 inet static
> 	address
> 	netmask
> 	gateway
> #allow-hotplug wlan0
> #iface wlan0 inet manual
> #    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
> #iface wlan0 inet dhcp
> # GSM 3G Hi_Link USB modem
> #allow-hotplug eth1
> #iface eth1 inet dhcp

There are no other network configs.

[email protected](ro):~$ ls -l /etc/network/interfaces.d/
total 0

My DHCP server doesn’t have the option to assign IP addresses based on MAC address. It’s a poor man’s DHCP built into the Internet router.
About 30 seconds after startup, I can no longer reach the device via the static IP. I can still login via the DHCP IP though. I can reach the static intermittently (for 3 seconds every minute or so).

>                              My traceroute  [v0.85]
> jupiter (                                      Thu May  2 21:56:44 2019
> Keys:  Help   Display mode   Restart statistics   Order of fields   quit
>                                     Packets               Pings
>  Host                             Loss%   Snt Drop  Last   Avg  Best  Wrst Drop
>  1.                   60.2%   182  109   0.6   0.5   0.3   0.6  109

I want to completely disable DHCP. I see no dhcp client processes nor any related config files. How can I disable DHCP so it no longer interferes with the network settings on the emonpi?

Are you using a static IP address OUTSIDE of the range of the routers DHCP range?

For instance if your router is using range to then you should be using or above.

Thank you Stuart for your reply. I’m using a static IP address INSIDE the range of the routers DHCP range. For the simple reason that the only control I have on the DHCP server is on/off. No more advanced settings like controlling the DHCP IP range.

I ended up purging the isc-dhcp-client package which, for now, seems to have resolved the issue.

sudo dpkg --purge isc-dhcp-client

A bit drastic I know, but not wanting to use the DHCP client on the EmonPI anyway :slight_smile:
I then manually removed the DHCP assigned IP to clean things up.

ip a d dev eth0

Maybe I should simply disable the whole DHCPD server on the Internet router and use the EmonPI’s DHCPD server in stead. But I guess that’s off topic here.

It doesn’t really do that.

If you have a spare Pi around, I’d use Pi-Hole (on DietPi as the install is even easier) as you get adblocking as well :grin:.

What ISP is the router from?

Just be aware that if DHCP on the router gives the same address to something else emonPI will stop working due to the conflict.

What router is it by the way?

A “proper” DHCP daemon pings an IP address before assigning it. Exactly to avoid duplicate IP situation.

Contrary to what I said earlier, the router does allow to configure predefined IP address assignments. So just to be double sure, I reserved the IP address for the emonpi.

Router is from ISP Scarlet.

Thank you for your help!

1 Like