0

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
10.128.2.0/24 dev eth0 proto kernel scope link src 10.128.2.151
10.128.2.0/24 dev wlan0 proto kernel scope link src 10.128.2.161
10.128.2.1 dev eth0 proto dhcp scope link src 10.128.2.151 metric 1024
10.128.2.1 dev wlan0 proto dhcp scope link src 10.128.2.161 metric 1024
169.254.0.0/16 dev eth0 proto kernel scope link src 169.254.228.181 metric 202
169.254.0.0/16 dev wlan0 proto kernel scope link src 169.254.229.219 metric 303

and route -n this:

root@raspi# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     202    0        0 eth0
0.0.0.0         0.0.0.0         0.0.0.0         U     303    0        0 wlan0
10.128.2.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.128.2.0      0.0.0.0         255.255.255.0   U     0      0        0 wlan0
10.128.2.1      0.0.0.0         255.255.255.255 UH    1024   0        0 eth0
10.128.2.1      0.0.0.0         255.255.255.255 UH    1024   0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     202    0        0 eth0
169.254.0.0     0.0.0.0         255.255.0.0     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.
hostname

# Use the hardware address of the interface for the Client ID.
clientid
# 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.
#duid

# Persist interface configuration when dhcpcd exits.
persistent

# 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=192.168.0.10/24
#static ip6_address=fd51:42f8:caae:d92e::ff/64
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1 8.8.8.8 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=192.168.1.23/24
#static routers=192.168.1.1
#static domain_name_servers=192.168.1.1

# 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
1

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 agree to our terms of service, privacy policy and cookie policy

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