2022-02-14 09:42:06 +00:00
# Usage
2022-02-03 11:12:31 +00:00
2022-03-29 13:03:09 +00:00
Copy the device files that you need to `/etc/systemd/network/` .
2022-02-03 11:12:31 +00:00
2022-02-14 09:42:06 +00:00
Be sure the file-names, folders and configuration values (within the files) are changed to match your devices ([note 1](#Notes)). Wifi (wlan) devices also need wpa_supplicant configured to work.
2022-02-03 11:12:31 +00:00
2022-02-14 09:42:06 +00:00
## Example
2022-02-03 11:12:31 +00:00
2022-02-14 09:42:06 +00:00
Say I have eth0 and want network access (and an IP via DHCP) from my router; I would do the following...
2022-02-03 11:12:31 +00:00
```
sudo -s # Drop to root.
2022-05-09 19:22:59 +00:00
cp -rv 10-eth0* /etc/systemd/network/ # Copy the files.
2022-02-03 11:12:31 +00:00
systemctl enable --now systemd-networkd # Enable networkd now.
networkctl reload # Reload the configuration.
networkctl status # Check the log for any errors.
2022-02-14 09:42:06 +00:00
```
2022-02-03 11:12:31 +00:00
2022-02-14 09:42:06 +00:00
If there are NO **and I mean NO errors** from the commands above...
2022-02-03 11:12:31 +00:00
2022-02-14 09:42:06 +00:00
```
2022-02-03 11:12:31 +00:00
networkctl reconfigure eth0 # Tell networkd to reconfigure the device.
mv /etc/network/ /etc/network.disabled/ Move the old network configuration.
reboot # Restart to be sure.
```
2022-02-14 09:42:06 +00:00
## Enabling systemd-resolved
2022-02-03 11:12:31 +00:00
I like to use systemd-resolved for DNS..
```
sudo -s # Drop to root.
2022-02-14 09:42:06 +00:00
2022-02-03 11:12:31 +00:00
ln -sfv /var/run/systemd/resolve/stub-resolv.conf /etc/resolv.conf # Create a symlink.
2022-02-14 09:42:06 +00:00
2022-02-03 11:12:31 +00:00
systemctl enable --now systemd-resolved # Enable resolved now.
```
2022-02-14 09:42:06 +00:00
## Notes
2022-02-03 11:12:31 +00:00
2022-03-29 13:03:09 +00:00
**1**: This is very important otherwise things won't work. For example, if you have eth1 and not eth0 you'll have to copy and/or rename `eth0.network` to `eth1.network` . Check, and then check again.