I need to configure my network connection using some low level commands, but I believe the autoconfiguration in Raspbian is complicating this.

How can I disable it? And if I do, can I easily restore it again?

2 Answers 2


And if I do, can I easily restore it again?

Yes. I'll describe the disabling part first, and a simple method for manually connecting to a network using either ethernet or encrypted wifi.

This should work on all versions of systemd powered versions of Raspbian:

sudo systemd dhcpcd disable

Next edit /etc/network/interfaces and delete everything after these two lines:

auto lo

iface lo inet loopback

That's all. You should keep a backup copy of your current version, without which restoring things afterward will be difficult.

This will leave you with no active hardware interface when you reboot. I'll describe how to make sure you get connected if you are running headless. If you aren't (i.e. you have a screen and keyboard) you can use the commands inside parentheses below directly from the commandline, in order, prefaced w/ sudo.

Presuming ethernet and DHCP, add the following to /etc/rc.local to reconnect. Pay attention to the structure of the last line, particularly the final &, unless you are doing this directly from the command line, in which case you can ignore that (you want only what is inside the parentheses and not the parentheses themselves -- you'll also have to use sudo in this case):

    ip link set eth0 up
    dhclient -v eth0
) &> /var/log/local_inet.log &

This will leave you with output in /var/log/local_inet.log; it will get ovewritten at each boot. If you are using a wifi adapter, DHCP, and WPA, instead try:

    ip link set wlan0 up
    wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
    dhclient -v wlan0
) &> /var/log/local_inet.log &

Again, if you are doing this from the command line you are interested only in what is inside the parentheses. The above presumes you have /etc/wpa_supplicant/wpa_supplicant.conf set up correctly (and that the kernel module for your wifi adapter loads automatically, which it should).

To reverse the above and put everything back to the way it was:

apt enable dhcpcd

Next, since you kept a backup of /etc/network/interfaces, put it back and reboot.

sudo update-rc.d dhcpcd disable

it worked for me

  • The command you have given is only emulated by systemd. You should better use sudo systemctl disable dhcpcd which is called by the old command.
    – Ingo
    Oct 27, 2019 at 18:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.