I'm trying to speed up boot time on my PI. systemctl-analyze tells me it takes 7.7s to start dhcpcd.service. This seems a bit much, all I need is a static ip address for eth0 (for a local network only, no dns, etc).

How can i set a static ip-addres and disable the dhcpcd.service?

raspberry PI 3 model B, raspbian stretch


Although this question is a year old, it popped up in my Google search results, after I acquired a Raspberry Pi 4. I don't believe the other answers addressed the question, even though their results provide a similar behavior.

Here is how I disabled dhcpcd and set a static IP on my Raspberry Pi 4 on Raspbian Buster Lite (should be the same on any version of the RPI, using Raspbian Buster Lite).

Disable dhcpcd:

systemctl stop dhcpcd
systemctl disable dhcpcd
apt remove dhcpcd5

Set static IP:

vi /etc/network/interfaces.d/eth0


auto eth0
allow-hotplug eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask 255.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
dns-nameservers xxx.xxx.xxx.xxx
dns-search domain-name

Note: dns-nameservers and dns-search will allow resolvconf to auto configure /etc/resolv.conf. If excluded, you will need to manually set your DNS configration.

Test new IP configuration (assuming your static IP address is different than your dynamic IP, if any):

ifup eth0

Your new IP should now ping, alongside the dynamic one (which will be lost a next reboot).

How to test resolvconf is working:

service networking restart


systemctl restart networking

Check /etc/resolv.conf:

cat /etc/resolv.conf
# Generated by resolvconf
search domain-name
nameserver xxx.xxx.xxx.xxx

Reboot to ensure it survives:


I never use the stock networking config system on linux; over the years I've developed my own scripts to do everything I want. I don't even know how to do anything properly, in fact, because it has been so long since I did so (which is why I rarely answer networking questions here). This isn't something I'm recommending to others, but just to point out that you do not have to use any existing system services in order to arrange a network connection.

First the obvious:

sudo systemctl disable dhcpcd

There may be other stuff you need to disable, but note the base networking service is not one of them. What I also do is remove all references to any interface except lo (local loopback) from /etc/network/interfaces. I notice now Debian/Raspbian simply source stuff from a interfaces.d but looking at an image it appears empty. Anyway, if it isn't, empty it.

You can also remove everything from the if-up/down directories if you want -- it probably isn't necessary, but it won't negatively impact anything if you want to make your own arrangements instead.

The only part I'm uncertain about is the static address since I only use those on hotspot networks and not with a normative ISP provided router. However, if you have that configured to use a static IP with the Pi's MAC I don't think any kind of lease negotiation is required, so it is just a matter of:

sudo ip link set eth0 up
sudo ip addr add dev eth0
sudo ip route add default via

Obviously using whatever static address in place of and your router's address in place of Note it is important to use an explicit CIDR (/24) because the default is /32, which indicates a network of one.

You also probably need to add your ISP's nameservers to /etc/resolv.conf (and beware DHCP tools like to overwrite that), or else use Google's ( and

If it turns out you need to do DCHP negotiation with the router even though you will be assigned a static address, the situation is even simpler:

sudo ip link set eth0 up
sudo dhclient -v eth0

The latter will remain in the foreground until it gets a lease then fork to the background. There can only be one instance running at a time. To stop it, sudo dhclient -r.

You do not need to configure any routing or nameservers when using dhclient, meaning it might be preferable anyway if your router properly assigns the static address.

  • thank you, this gets my static ip working after entering the commands manually, but not automatically at boot – user3216577 Jan 29 '18 at 15:46

Check: How do I set up networking/WiFi/static IP address?

How can i set a static ip-addres

sudo nano /etc/dhcpcd.conf

interface eth0
static ip_address=     # The IP you want
static routers=             # The gateway IP
static domain_name_servers= # DNS-Server

and disable the dhcpcd.service

sudo systemctl disable dhcpcd

raspbian stretch

  • Thanks for your answer. But now eth0 doesn't come 'up' after booting. – user3216577 Jan 29 '18 at 15:23
  • Have you tried to leave dhcpd enabled and checked the time it takes you to boot when you have a static ip assigned? To enable it sudo systemctl enable dhcpd. If you check goldilocks answer you will see, that he brings up eth0 manually. You could try the same with sudo ip link set eth0 up, but i am not sure if your dhcpd.conf will be read doing it this way. – AlexOnLinux Jan 29 '18 at 15:30
  • It seems dhcpcld.conf is not read when dhcpcd is disabled. Running the ip link, ip add and ip route commands manually does bring up eth0. Where can i add these so there are run at boot? (i'm still kind if new to systemd) – user3216577 Jan 29 '18 at 15:46
  • I would not recommend to disable dhcpcd and do it manually. To do it manually you have to write a script.sh with the command that you want to be executed, one by one. The scrip.sh needs to be executed (oneshot) from systemd. How to do that you will find explained here in detail: unix.stackexchange.com/questions/47695/… – AlexOnLinux Jan 29 '18 at 15:55
  • In /etc/dhcpcd.conf you configure dhcpcd to use a static ip address for eth0 and then you disable dhcpcd. This cannot work. – Ingo Jan 6 '20 at 8:49

I provide an answer below to the question actually asked, although it is based on a number of false premises.

systemd services run asynchronously, so a saving in one services may have little impact on boot time.

dhcpcd may not even be on the critical-chain, and even if it is any savings will be reduced by other networking services (as the comments make it apparent Ethernet is wanted).

Run systemd-analyze critical-chain to see detail for your system.

How to set up Static IP Address shows 2 methods. I recommend dhcpcd, but if using /etc/network/interfaces you should provide a stanza for Ethernet e.g. iface eth0 inet dhcp

PS I wonder what those determined to minimise boot actually do with the few seconds saved. I am content to wait the <15 seconds it takes my Pi to boot (on those rare occasions when I shut it down).

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.