Is there a way to disable the DHCP client in Raspbian Linux on a Rasperry Pi?
This scenario sounds really weird because your setup should be working as you describe—and hope for it to work—if there is a static IP set in /etc/network/interfaces
. That said, this discussion on the official Raspberry Pi site focuses on the issue with the user “rpdom” stating this on the post dated “Thu May 28, 2015 6:21 am”:
This happens in the latest updates. It is caused by the new dhcp client ignoring what the interfaces files does and doing its own thing in addition... seems crazy to me. I'd look at how to reconfigure the dhcp client (can't rememeber which it is or how to do it, I'm still on the old one which works for me), disabling it, or removing it (if possible).
Deeper in the thread user “KLL” suggests the following other post in their response dated “Mon Aug 10, 2015 12:59 pm.” According to “knute”:
Somewhere along the way an upgrade modified my
/etc/network/interfaces
file with the 'manual' word instead of dhcp or static and I ended up with two IP addresses, my static one and a dhcp address. I finally had time to play with it and found out thatdhcpcd5
works differently than whatever was in it before. To get just your static address, do not modify/etc/network/interfaces
. Put back the 'manual' word if you changed it and instead modify/etc/dhcpcd.conf
as shown in the example from the docs.
So the idea is that dhcpcd5
’s behavior has changed in one of the upgrades. And suggestion to solve the issue is to remove any changes from /etc/network/interfaces
and instead adjust the settings in /etc/dhcpcd.conf
to get a static IP address; example config below:
static <value>
Configures a static <value>. If you set ip_address then dhcpcd
will not attempt to obtain a lease and just use the value for the
address with an infinite lease time.
Here is an example which configures a static address, routes and
dns.
interface eth0
static ip_address=192.168.0.10/24
static routers=192.168.0.1
static domain_name_servers=192.168.0.1
More info on the contents of dhcpcd.conf
can be found on the official man page for it.
That said, another idea is to retain the settings you have in /etc/network/interfaces
but then edit /etc/dhcpcd.conf
to add the line denyinterfaces eth0
to tell the DHCP daemon to completely ignore eth0
. Either solution should work, but one solution might be a more preferable solution depending on your overall networking needs/requirements.
what worked for me is using a /etc/network/interfaces as in the original question and simply removing the dhcp client:
apt-get remove dhcpcd5 isc-dhcp-client isc-dhcp-common