The networkd daemon failed to bring up the eth0 interface because its configuration specified a subnet mask that was not a valid CIDR notation.

Common Causes and Fixes

1. Invalid Subnet Mask/CIDR Notation

  • Diagnosis: Check the network configuration file for eth0. Look for an Address= line.
    cat /etc/systemd/network/eth0.network
    
  • Cause: The Address= line expects an IP address followed by a slash and a CIDR prefix length (e.g., 192.168.1.10/24). Incorrect formats like 192.168.1.10/255.255.255.0 or 192.168.1.10 without a prefix will cause networkd to fail.
  • Fix: Edit the file and correct the Address= line to use valid CIDR notation.
    # Example: Change from invalid to valid
    # Original: Address=192.168.1.10/255.255.255.0
    # Corrected: Address=192.168.1.10/24
    
    # Or if no mask was provided:
    # Original: Address=192.168.1.10
    # Corrected: Address=192.168.1.10/24
    
    This works because systemd-networkd strictly enforces the CIDR format for IP address assignment.
  • Restart:
    sudo systemctl restart systemd-networkd
    

2. Missing DHCP=yes or DHCP=ipv4 in [Network] Section

  • Diagnosis: Examine the [Network] section of the eth0.network file.
    cat /etc/systemd/network/eth0.network | grep DHCP
    
  • Cause: If the interface is intended to obtain an IP address via DHCP, but DHCP= is not set to yes or ipv4, networkd will not attempt to request an IP from a DHCP server.
  • Fix: Add or correct the DHCP= line in the [Network] section.
    [Network]
    DHCP=yes
    
    This explicitly tells networkd to use DHCP for IPv4 address assignment on this interface.
  • Restart:
    sudo systemctl restart systemd-networkd
    

3. Incorrect [Match] Section

  • Diagnosis: Verify the [Match] section in eth0.network corresponds to the actual interface name.
    cat /etc/systemd/network/eth0.network | grep Name
    
  • Cause: If the Name= line in the [Match] section does not exactly match the interface name (e.g., eth0 vs. enp0s3), networkd will not apply the configuration to the intended interface. Interface names can change based on hardware and kernel modules.
  • Fix: Update the Name= line to match the actual interface name. You can find the actual name using ip a.
    [Match]
    Name=eth0
    
    This ensures that the configuration block is correctly associated with the physical or virtual network device.
  • Restart:
    sudo systemctl restart systemd-networkd
    

4. Missing or Incorrect [Link] Section for Static Configuration

  • Diagnosis: For static IP configurations, check for the presence and correctness of the [Link] section.
    cat /etc/systemd/network/eth0.network | grep MACAddress
    
  • Cause: While not strictly required for basic static IP assignment, if you’re using MACAddress= in the [Link] section for a specific hardware address, and it’s incorrect or malformed, networkd might fail to initialize the link.
  • Fix: Ensure the MACAddress= is correctly formatted (e.g., 00:11:22:AA:BB:CC) or remove it if not needed.
    [Link]
    MACAddress=00:11:22:AA:BB:CC
    
    This ensures networkd can properly configure the network hardware if a specific MAC address is intended.
  • Restart:
    sudo systemctl restart systemd-networkd
    

5. Unloaded Kernel Module for Network Card

  • Diagnosis: Check if the network card’s driver is loaded.
    lsmod | grep <driver_name>
    # Or check dmesg for errors related to the network card
    dmesg | grep -i eth0
    
  • Cause: The necessary kernel module for your network interface card might not be loaded, preventing the eth0 device from being recognized by the system. This is often seen after kernel updates or if the module is explicitly blacklisted.
  • Fix: Manually load the module or ensure it’s configured to load at boot.
    sudo modprobe <driver_name>
    # To make it persistent, add to /etc/modules-load.d/
    echo "<driver_name>" | sudo tee /etc/modules-load.d/network.conf
    
    Loading the module makes the kernel aware of the hardware and provides the necessary functions for the network interface.
  • Restart:
    sudo systemctl restart systemd-networkd
    

6. Conflicting Network Management Services

  • Diagnosis: Check if other network management daemons are running.
    systemctl status NetworkManager
    systemctl status networking
    
  • Cause: If NetworkManager or the older networking service (from ifupdown) is active and configured to manage eth0, systemd-networkd might conflict or be unable to take control of the interface.
  • Fix: Disable and stop any conflicting services.
    sudo systemctl stop NetworkManager
    sudo systemctl disable NetworkManager
    # If using the older init system:
    # sudo service networking stop
    # sudo update-rc.d networking disable
    
    Disabling other managers ensures systemd-networkd has exclusive control over network interface configuration.
  • Restart:
    sudo systemctl restart systemd-networkd
    

After fixing these issues, you might encounter an error related to DNS resolution if the DNS= line in your .network file is incorrect or missing and you’re not using DHCP to obtain DNS servers.

Want structured learning?

Take the full Computer Networking course →