The Raspberry Pi uses
dhcpcd to configure TCP/IP across all of its network interfaces. The dhcpcd daemon was written by Roy Marples and is intended to be an all-in-one ZeroConf client for UNIX-like systems. This includes assigning each interface an IP address, setting netmasks, and configuring DNS resolution via the Name Service Switch (NSS) facility.
By default, Raspberry Pi OS attempts to automatically configure all network interfaces by DHCP, falling back to automatic private addresses in the range 169.254.0.0/16 if DHCP fails. This is consistent with the behaviour of other Linux variants and of Microsoft Windows.
Static IP address
If you wish to disable automatic configuration for an interface and instead configure it statically, add the details to
/etc/dhcpcd.conf. For example:
interface eth0 static ip_address=192.168.0.4/24 static routers=192.168.0.254 static domain_name_servers=192.168.0.254 188.8.131.52
You can find the names of the interfaces present on your system using the
ip link command.
Previous versions of Raspberry Pi OS used the file
/etc/network/interfaces for network interface configuration: if an interface is listed in this file, any settings there will take precedence over what is in
Note that if you have several Raspberry Pis connected to the same network, you may find it easier instead to set address reservations on your DHCP server. In this way, each Pi will keep the same IP address, but they will all be managed in one place, making reconfiguring your network in the future more straightforward.
On Raspberry Pi systems where the graphical desktop is installed, a GUI tool called
lxplug-network is used to allow the user to make changes to the configuration of
dhcpcd, including setting static IP addresses. The
lxplug-network tool is based on
dhcpcd-ui, which was also developed by Roy Marples.