Network configuration

Imagine you work with your Raspberry Pi in the studio in your own network, then your router should give your Pi an IP address via DHCP, all is fine.

The big day comes and you take your Pi to the exhibition, stage, whatever and want to SSH in it with your shiny laptop. No DHCP no IP address so you have to prepare with a static one in the configuration on the PI. Usual documentations show an either or solution which is suboptimal for the mobile artist. How about giving a dynamic and static in the same configuration and forget about it? So the Raspberry takes a DHCP address dynamically and still is reachable under the static address. You could either make it happen in the dhclient.conf or in the /etc/network/interfaces where you add eth0:1 to your network, it gives a second ip address to your very same eth0 interface, the whole would look like that, at least for me on Raspberian distribution, I give the IP but you can chose your own:


auto lo

iface lo inet loopback
iface eth0 inet dhcp

auto eth0:1
iface eth0:1 inet static

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp