3

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?

3

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 Raspbian; although jessie (v. 8) uses systemd, the pesky daemons are still enabled through SysV scripts.

sudo update-rc.d ifplugd disable
sudo update-rc.d dhcpcd disable

Note that more recent versions of Raspbian may not use ifplugd, in which case, don't worry about it.

The other part is the ifup/down stuff. 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:

update-rc.d -f ifplugd remove
update-rc.d ifplugd defaults
update-rc.d -f dhcpcd remove
update-rc.d dhcpcd defaults

The -f is probable unnecessary, but it won't hurt (note man update-rc.d is demonstrably wrong about some things, but that is another story page). You have to do the "remove" before you can re-enable.

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

1
sudo update-rc.d dhcpcd disable

it worked for me

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.