Overview
systemd-networkd is a core component of systemd for configuring and managing network interfaces. It operates based on configuration files, helping to manage complex network environments in a consistent and predictable manner.
Key Features
- Declarative Configuration: Define network configurations via `.network` files.
- Support for Various Interfaces: Ethernet, Wi-Fi, bridges, bonding, VLANs, etc.
- Built-in DHCP client/server functionality.
- Support for static IP address and routing configurations.
- Tight integration with systemd services.
Key Options
While systemd-networkd is primarily managed as a service via systemctl, it has a few options that can be used when executed directly.
General Options
Generated command:
Try combining the commands.
Description:
`systemd-networkd` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
systemd-networkd is primarily managed as a service using systemctl commands. Here are some common usage examples.
Enable and Start systemd-networkd Service
sudo systemctl enable systemd-networkd.service
sudo systemctl start systemd-networkd.service
Enable the service to start automatically on system boot and start it immediately.
Check systemd-networkd Service Status
sudo systemctl status systemd-networkd.service
Check the current status of the systemd-networkd service.
Reload Network Configuration After Changes
sudo systemctl reload systemd-networkd.service
After modifying `.network` files, reload the configuration without restarting the service.
Check Network Status with networkctl
networkctl status
networkctl is a utility that displays the status of network interfaces managed by systemd-networkd.
Validate Configuration Files
sudo systemd-networkd --test
Check for syntax errors and other issues in new `.network` files before applying them.
Tips & Notes
Tips and important considerations for effectively using systemd-networkd.
Configuration File Paths
systemd-networkd reads `.network` files from the following directories. Files in directories with lower numbers have higher priority.
- /etc/systemd/network/: User-defined configurations (highest priority)
- /run/systemd/network/: Runtime-generated configurations (e.g., DHCP client)
- /usr/lib/systemd/network/: Distribution default configurations (lowest priority)
Conflicts with Other Network Managers
Enabling systemd-networkd alongside other network managers like NetworkManager or netplan can lead to conflicts. It is generally recommended to have only one network manager active on a system.
- Do not use concurrently with NetworkManager.
- If necessary, disable other network managers (e.g., `sudo systemctl disable NetworkManager.service`).
Debugging and Log Checking
When issues arise, it is crucial to check the logs of systemd-networkd using `journalctl`.
- Check service logs with `journalctl -u systemd-networkd.service`.
- View real-time logs with `journalctl -u systemd-networkd.service -f`.
- For detailed logs, use the `--debug` option or set `LogLevel=debug` in `/etc/systemd/systemd-networkd.conf`.