Date Tags linux

Fixed IP on Debian Buster on Raspberry Pi

I ran into the issue that after rebooting my Pi, the Fritz Box I am using assigned a new IP address every single time. Which destroyed some of the network related setups that run on the device (like HomeBridge or Pi-Hole). Also making the Fritz Box assign the same IP every time did not work.

The solution can be set in the DHCP Client Demon settings, which you will find in /etc/dhcpcd.conf on your machine.

In my case, I just had to change the entry for static IP configuration:

# Example static IP configuration:
interface eth0
static ip_address=192.168.178.96/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
static routers=192.168.178.1
static domain_name_servers=192.168.178.1 8.8.8.8 fd51:42f8:caae:d92e::1

Just remove the comment # and set it according to your setup. To find out what your interface name is, if you have more then one, you can just enter ip a on the command line to get the following dump:

daniel@lithium:~ $ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether dc:a6:32:02:11:da brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.105/24 brd 192.168.178.255 scope global dynamic noprefixroute eth0
       valid_lft 632235sec preferred_lft 632235sec
    inet 192.168.178.96/24 brd 192.168.178.255 scope global secondary noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 2002:4d06:189e:0:3d76:737f:4060:44c4/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 5617sec preferred_lft 2017sec
    inet6 2002:4d06:189e:0:3d88:f62e:5f2c:4533/64 scope global dynamic noprefixroute 
       valid_lft 6817sec preferred_lft 3217sec
    inet6 fe80::fdb3:7917:73bd:8563/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 56:8e:06:53:93:63 brd ff:ff:ff:ff:ff:ff
    inet 192.168.178.96/24 brd 192.168.178.255 scope global noprefixroute wlan0
       valid_lft forever preferred_lft forever
    inet6 2002:4d06:189e:0:8c93:8ac9:5a83:f8ef/64 scope global dynamic mngtmpaddr noprefixroute 
       valid_lft 6817sec preferred_lft 3217sec
    inet6 fe80::3e7c:9a3e:2bfa:cf11/64 scope link 
       valid_lft forever preferred_lft forever

As is usually the case with the built in ethernet port, it is called eth0 on my machine.

You will also need to set the IP of your router as static routers entry and as one of the static domain_name_servers.

After a reboot, everything should be fixed. You can check again with ip a.