I hope some can help me. I installed dhcpcd (to be able to use WiFi) on a custom Debian build for a Raspberry (so I can have a 64 bit OS). It seems to work all fine. The WiFi link is getting established as it should and the ethernet link works too. but it seems like dhcpcd doesn't add the default gateway. Disabling gets me default gateway for eth0 but wlan0 won't work then. I tried my best to reverse engineer Raspbian but at this point I'm stuck.

I haven't touched the /etc/dhcpcd.conf and even removing/renaming (because the file doesn't exist on Raspbian from what I can tell turns out it exists and ext2explore just couldn't properly read the SD card. Though the files are identical, after I checked it on a live system) didn't make any difference.

ip r gives me this output:

root@raspi# ip r
default dev eth0 proto kernel scope link metric 202
default dev wlan0 proto kernel scope link metric 303 dev eth0 proto kernel scope link src dev wlan0 proto kernel scope link src dev eth0 proto dhcp scope link src metric 1024 dev wlan0 proto dhcp scope link src metric 1024 dev eth0 proto kernel scope link src metric 202 dev wlan0 proto kernel scope link src metric 303

and route -n this:

root@raspi# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         U     202    0        0 eth0         U     303    0        0 wlan0   U     0      0        0 eth0   U     0      0        0 wlan0 UH    1024   0        0 eth0 UH    1024   0        0 wlan0     U     202    0        0 eth0     U     303    0        0 wlan0

For reference, this is the /etc/dhcpcd.conf:

# 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
# Most distributions have NTP support.
option ntp_servers
# Respect the network MTU. This is applied to DHCP routes.
option interface_mtu

# A ServerID is required by RFC2131.
require dhcp_server_identifier

# Generate Stable Private IPv6 Addresses instead of hardware based ones
slaac private

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

# It is possible to fall back to a static IP if DHCP fails:
# define static profile
#profile static_eth0
#static ip_address=
#static routers=
#static domain_name_servers=

# fallback to static profile on eth0
#interface eth0
#fallback static_eth0

If you need more information, please let me know and I'll be happy to supply them.

Also adding the default gateway manually makes it work, but that's the job of the DHCP.

I found these questions, but they either use a static configuration, which is not what I want, have other unrelated issues, or are unsolved.

Also the image itself has been created with a slightly customized version of: https://github.com/drtyhlpr/rpi23-gen-image

  • because the file doesn't exist on Raspbian from what I can tell - you're mistaken, it's very much there and very important – Jaromanda X Jan 22 at 8:19
  • @JaromandaX Then it seems ext2explore can't seem to correctly read the filesystem. I'll boot up my old copies and see if I can get the correct file then. Thank you! – BrainStone Jan 22 at 8:22
  • @JaromandaX I just checked and the file on Raspbian is the same as on my custom Debian. (I even checked with a diff tool) – BrainStone Jan 22 at 8:31
  • so it exists - not sure what your issue is though, I was just clarifying your error – Jaromanda X Jan 22 at 9:08

As it turns out the issue was my /etc/network/interfaces file.

On my system it was just:

# Debian switched to systemd-networkd configuration files.
# please configure your networks in '/etc/systemd/network/'

So I changed it to be identical to the Raspbian one:

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

Note the last line source-directory /etc/network/interfaces.d. Even though the directories are empty on both, not having that line breaks dhcpcd.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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