dhcpcd-discuss

dhcpcd for static addresses on the Raspberry Pi

Richard Urwin

Tue Mar 29 14:52:08 2016

Hi,

I'm a moderator over on the Raspberry Pi forum.

You might be aware of the Raspberry Pi -- a $25 Single Board Computer that
has been very popular over the last few years (over 8 million sold.) Many
of our users are school children or other folk that don't have an indepth
knowledge of or interest in networking -- they just want something that
works and clear instructions. As of the last few months the default
operating system for the Pi is now based on Debian Jessie, with dhcpcd in
control of the configuration of the network interfaces.


For most of our users this works very well and they never need to touch any
configuration files; the Pi gets a DHCP allocation and all is well.

However a small but significant number of users need to allocate a static
IP address and cannot make that allocation on a DHCP server.

The simple way to do that is with a dhcpcd.conf file that looks like:
interface eth0
static ip_address=192.168.1.101/24
static routers=192.168.1.1
However, SBCs are portable by nature and moving one with this configuration
to a different network means it needs reconfiguring with an attached
keyboard and screen. It is far better to use arping lines to recognise the
network that it is attached to and configure itself appropriately, maybe
with a fallback allocation if it doesn't recognise the network and can't
find a DHCP server.

This is all well and good, but when the Pi has two network interfaces --
invariably eth0 and wlan0 -- we don't understand how we can use arping, or
any other method, to allocate a different IP address to the two interfaces.
The profiles seem to be shared between all the interfaces.

I've noticed some very old posts in this list using the MAC address as a
profile name, but no documentation I have found describes this, and it
would only help for a single arping of course.

How should we recommend that our users configure static IP addresses for
two interfaces?

-- 
Richard
(rurwin on www.raspberrypi.org/forums/)

Follow-Ups:
Re: dhcpcd for static addresses on the Raspberry PiRoy Marples
Archive administrator: postmaster@marples.name