I just installed Raspbian Jessie on my new Raspberry Pi 2. I’m using an Edimax EW-7811Un USB WiFi-adapter as a primary network device which I want to configure cleanly within my dis
tribution. Cleanly, in the sense of changing as little as possible the system’s configuration-files and scripts.
Of course I found several nice tutorials (1 2 3) which indeed helped me to figure how to do it properly
and gave me a good start (especially for wpa_supplicant.conf, which I won’t detail here) . However, the original content of the config-files mentioned there, wasn’t matching with what I found on my installation. Maybe it is because Jessie is still quite new as of writing this.
Starting with the /etc/network/interfaces-file. It mentions eth0 (the wired ethernet port) and two wlan-devices and it says they are all configured manual.
auto lo iface lo inet loopback iface eth0 inet manual iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf iface wlan1 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Manual in this context means that the ifplugd takes over the network configuration. Ifplugd detects a physical connection and launches a dhcp-client to complete the interface-configuration. As of writing this, it does not properly take care of wlan-devices, however this it is how ifplugd is configured (from /etc/default/ifplugd).
INTERFACES="auto" HOTPLUG_INTERFACES="all" ARGS="-q -f -u0 -d10 -w -I" SUSPEND_ACTION="stop"
My RPI2 will be used mainly via WiFi, but for debugging reasons I might plug the wire. Hence I’d like the system to always (try to) configure the WiFi-device and optionally the wired if a cable is plugged. To achieve this, here is what I did.
First I changed the way wlan0 is configured in interfaces, telling it to automatically be configured when the networking-service is started (at boot-time):
auto wlan0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Then I told ifplugd to no more using all devices but only eth0. I ran:
sudo dpkg-reconfigure ifplugd
And during the follow dialog asking me for “static interfaces to be watched by ifplugd’ I replaced auto by eth0. This makes /etc/default/ifplugd look as follows:
INTERFACES="eth0" HOTPLUG_INTERFACES="all" ARGS="-q -f -u0 -d10 -w -I" SUSPEND_ACTION="stop"
This does exactly what I want with very few changes to the system’s files, thus clean.
I just did an apt-get update of my jessie installation and noticed that upstream has changed the interface-file. It now contains the allow-hotplug-lines I added to my interfaces. However, this does not change anything regarded the problematic I had on my system.