
In this article, we will explore the reasons why the systemd-networkd
daemon might not start the DHCP client and how to troubleshoot this issue.
Understanding systemd-networkd
systemd-networkd
is a system service that manages network configurations. It detects and configures network devices as they appear, as well as manages network traffic. However, there can be instances where systemd-networkd
might not start the DHCP client as expected.
Network File Configuration
The first thing to check is the network file configuration. This is typically located at /etc/systemd/network/20-dhcp.network
.
The file should contain a [Match]
section and a [Network]
section. The [Match]
section is used to match the network interface that the settings should apply to. For instance, if your network interface is named enp3s0
, the [Match]
section should look like this:
[Match]
Name=enp3s0
The [Network]
section is where you specify that you want to use DHCP. It should look like this:
[Network]
DHCP=ipv4
Here, DHCP=ipv4
instructs systemd-networkd
to use DHCP for IPv4 address configuration.
Checking the resolv.conf File
The /etc/resolv.conf
file is used to configure DNS resolution. If the DHCP client is not starting, it could be due to incorrect DNS configuration in this file. Ensure that the file is correctly configured with the desired DNS information.
Checking the Status of systemd-networkd
Next, check if the systemd-networkd
service is enabled and running. You can do this using the command systemctl status systemd-networkd
.
The systemctl
command is used to control the systemd system and service manager. status
is an option that displays the status of a service.
If systemd-networkd
is not running, you can start it using the command systemctl start systemd-networkd
. The start
option is used to start a service.
To ensure systemd-networkd
starts at boot, enable it using the command systemctl enable systemd-networkd
. The enable
option is used to enable a service to start at boot.
Checking for Conflicting Services
In some cases, NetworkManager
may be active instead of systemd-networkd
. These two services can conflict, so if NetworkManager
is running, you may need to stop and disable it.
You can check the status of NetworkManager
using the command systemctl status NetworkManager
. If it’s running, you can stop it using the command systemctl stop NetworkManager
and disable it using the command systemctl disable NetworkManager
.
Reviewing System Logs
If the issue persists, it can be helpful to review the system logs. You can do this using the command journalctl -u systemd-networkd
.
The journalctl
command is used to query the contents of the systemd journal. The -u
option is used to filter output by unit.
Conclusion
Troubleshooting systemd-networkd
not starting the DHCP client involves checking the network file configuration, verifying the /etc/resolv.conf
file, ensuring systemd-networkd
is running and enabled, checking for conflicting services, and reviewing system logs.
Remember to consult the systemd-networkd documentation for more information and details on how to configure and manage systemd-networkd
.
You can use the command systemctl status systemd-networkd
to check the status of systemd-networkd
.
You can use the command systemctl start systemd-networkd
to start systemd-networkd
.
You can use the command systemctl enable systemd-networkd
to enable systemd-networkd
to start at boot.
You can use the command systemctl status NetworkManager
to check the status of NetworkManager
.
You can use the command systemctl stop NetworkManager
to stop NetworkManager
, and systemctl disable NetworkManager
to disable it.
You can use the command journalctl -u systemd-networkd
to review the system logs for systemd-networkd
.