I am struggling getting my rPi to get a fixed IP. I have this /etc/dhcpcd.conf, but that doesn't seem to do anything:

# A sample configuration for dhcpcd.
# See dhcpcd.conf(5) for details.

# Allow users of this group to interact with dhcpcd via the control socket.
#controlgroup wheel

# Inform the DHCP server of our hostname for DDNS.

# Use the hardware address of the interface for the Client ID.
# or
# Use the same DUID + IAID as set in DHCPv6 for DHCPv4 ClientID as per RFC4361.
# Some non-RFC compliant DHCP servers do not reply with this set.
# In this case, comment out duid and enable clientid above.

# Persist interface configuration when dhcpcd exits.

# Rapid commit support.
# Safe to enable by default because it requires the equivalent option set
# on the server to actually work.
option rapid_commit

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# Most distributions have NTP support.
#option ntp_servers

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate SLAAC address using the Hardware Address of the interface
#slaac hwaddr
# OR generate Stable Private IPv6 Addresses based from the DUID
slaac private

# eth0 is our internal net
interface eth0
static ip_address=
static routers=

After a reboot, this is my IP setup:

pi@raspberrypi:/etc/systemd/network$ ip a l
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 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 pfifo_fast state UP group default qlen 1000
    link/ether b8:27:eb:ff:b7:e5 brd ff:ff:ff:ff:ff:ff
    inet brd scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::ba27:ebff:feff:b7e5/64 scope link 
       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 b8:27:eb:aa:e2:b0 brd ff:ff:ff:ff:ff:ff
    inet brd scope global dynamic noprefixroute wlan0
       valid_lft 690622sec preferred_lft 604222sec
    inet6 fe80::ba27:ebff:feaa:e2b0/64 scope link 
       valid_lft forever preferred_lft forever

Then, when looking for more info on this, I see that "under systemd, the network may be configured" using /etc/systemd/network instead. But, when I read those lines correctly, it want an en* interface, but I have an eth0. Also, what does "may be configured" mean? Either it does it, or it doesn't, right?

Update when I manually set the interface with

pi@raspberrypi:~$ sudo ifconfig eth0
pi@raspberrypi:~$ sudo route add -net eth0

I have the setup I want (except for some stray route to

So, how can I configure my network interfaces (from the command line) on Debian 11 running on a Raspberry Pi 3 model B?

  • WRT en* vs. eth* (or eth0), these are just different labels an ethernet interface can end up with, you should use what is appropriate (ie., eth0). WRT systemd and Debian, though, beware that RpiOS differs from Debian in that by default it uses dhcpcd, and not systemd's own facilites. WRT "your internal network", to make sure: The other end of the cable is plugged into a DHCP router, right? If not you should explain what it is.
    – goldilocks
    Nov 29, 2022 at 14:29
  • Finally, WRT static addresses, presuming DHCP is being used: 1) Assigning yourself one does not mean the router will accept it, which is why 2) You should use request not static, see raspberrypi.stackexchange.com/questions/37920/… (if you find a solution there, please leave a comment so this can be closed as a duplicate).
    – goldilocks
    Nov 29, 2022 at 14:29
  • @goldilocks there is no DHCP router. The "internal net" is a switch with three devices, each with a fixed IP address, of which the rPi is one. Nov 29, 2022 at 14:32
  • This question is misleading. You have omitted vital details. You have a wireless network on a different subnet. You are attempting to use a different networking service and mixing conflicting information.
    – Milliways
    Nov 29, 2022 at 21:12
  • @Milliways how is that misleading, if I post all that information? I was attempting all kinds of things, because I couldn't get it working. And I supplied all my tries in the question. I think you can honestly say that networking on the Pi (Debian?) is messy, with many unused files, duplicate configuration, etc. Kind of like the sound situation on most Linuxes. Nov 30, 2022 at 8:08

2 Answers 2


there is no DHCP router. The "internal net" is a switch with three devices, each with a fixed IP address, of which the rPi is one.

If there's no DHCP, using a DHCP client to set up networking seems inappropriate, doesn't it? To be fair, you likely could configure dhcpcd to deal with this, but it is so simple otherwise it is probably not worth the effort, or the potential complications.

So I recommend removing the interface eth0 block in dhcpcd.conf and replacing it with:

denyinterfaces eth0

This way, dhcpcd will ignore it.

Activating the interface on a network of the sort you describe is, again, very simple:

sudo ip link set eth0 up
sudo ip addr add dev eth0

The routing then should be configured automatically; check the output of ip route, which should include: dev eth0 proto kernel scope link src

If not, try:

sudo ip route add via dev eth0

To enable this at boot, put the those first two commands into a text file with a shebang at the top:


ip link set eth0 up
ip addr add dev eth0

Notice, no sudo there. Put this in, eg. /etc/eth0net/interface-up.sh, make it owned root and executable:

sudo chown -R root.root /etc/eth0net
sudo chmod 755 /etc/eth0net/interface-up.sh

Create a file /etc/systemd/system/eth0net.service; you will need superuser permission. In that:

Description=Local ethernet link



And enable it with systemctl enable eth0net.service. You can test run this before reboot with systemctl start eth0net. To check systemctl status eth0net; the output should include active (exited).

  • I agree on the "If there's no DHCP, using a DHCP client to set up networking seems inappropriate, doesn't it?" I just never realised that dhcpcd would talk to a DHCP router if you supply a static address. When setting a static/fixed address in other Linuxes (e.g. NetworkManager), this always worked fine. TIL. Nov 30, 2022 at 8:10
  • I tried to add the denyinterfaces in dhcpcd.conf, but the device is still being configured by dhcpcd. I am using predictive interfaces, so I have denyinterfaces enx3x.... Nov 30, 2022 at 13:27
  • There's a mistake, because denyinterfaces absolutely does work, unless there is something contradictory in the conf or some other network software running (are you sure it is dhcpcd?) -- you might look through /etc/network/* for references to the ethernet interface. But first try denyinterfaces e*, that should cover pretty much anything ethernet but not anything else (unless you are creating virtual interfaces with names beginning with e etc). Not sure if your enx3x was supposed to be literal, but that won't match anything. The pattern is a shell glob and x is not a wildcard.
    – goldilocks
    Nov 30, 2022 at 14:42
  • "never realised that dhcpcd would talk to a DHCP router if you supply a static address'" -> The man page does say it "will not attempt to obtain a lease and will just use the value for the address with an infinite lease time", so it should work. Right now though, it is just giving you a link local address (; that can be disabled with noipv4ll. BTW, this is verbatim the methodology used by me to do much the same thing. If possible, you should try shutting dhcpcd down (along with the other network access it provides), and just go through the steps here to see what happens.
    – goldilocks
    Nov 30, 2022 at 14:54
  • thanks for your help. I decided to ditch dhcpcd eventually. I got everything working how I want it, using systemd-networkd (see also my answer). Nov 30, 2022 at 16:35

I decided to ditch dhcpcd and use systemd-networkd instead. Steps to do so:

  1. Disable dhcpcd: systemctl disable dhcpcd

  2. Enable systemd-networkd: systemctl enable systemd-networkd

  3. Disable wpa_supplicant: systemctl disable wpa_supplicant

  4. Create .link files to create predictable network names based on mac, example 20-usbnic.link:

    Description=USB NIC
  5. Create .network files to set DHCP or fixed address, example:

  6. Create /etc/wpa_supplicant/wpa_supplicant-wlan0.conf to use interface-based wpa_supplicant (see also here https://unix.stackexchange.com/questions/453329/where-is-my-etc-wpa-supplicant-conf-on-systemd)

  7. Enable wpa_supplicant on that interface: systemctl enable wpa_supplicant@wlan0

  8. Reboot for all changes to take effect

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.