Awesome! Now, let’s get your internet working with systemd.
1. Check If Your Network Interface Exists
Run:
ip link
You should see something like:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
2: enp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default
- If you see something like
enp3s0,eth0, oreno1, that’s your network interface. - If no Ethernet interface appears, check:This will show if the Ethernet adapter is recognized.
lspci -nnk | grep -A3 -i ethernet
2. Enable and Start systemd-networkd
First, ensure systemd-networkd is enabled:
sudo systemctl enable --now systemd-networkd
Check if it’s running:
sudo systemctl status systemd-networkd
If it’s active (green), it’s working.
3. Configure a Network File
Create a config file for your Ethernet connection:
sudo nano /etc/systemd/network/20-wired.network
Add the following:
[Match]
Name=enp3s0 # Replace with your actual interface name
[Network]
DHCP=yes
Save and exit (Ctrl+X, then Y, then Enter).
Then restart systemd-networkd:
sudo systemctl restart systemd-networkd
4. Enable systemd-resolved for DNS
Systemd uses systemd-resolved for DNS resolution. Enable it:
sudo systemctl enable --now systemd-resolved
Then create a symlink to use its resolv.conf:
sudo ln -sf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
Check DNS resolution:
ping -c 3 8.8.8.8 # Tests if network is up
ping -c 3 google.com # Tests if DNS is working
5. Verify Everything
Check if you have an IP address:
ip a
Check if you can reach the internet:
ping -c 3 8.8.8.8
If everything works, your internet is set up via systemd!
Failed to create symbolic link, file exists.
That means /etc/resolv.conf already exists. Let’s fix it:
1. Check What’s Inside /etc/resolv.conf
Run:
cat /etc/resolv.conf
If it contains something like:
# Generated by dhcpcd
nameserver 192.168.1.1
It means another service (like dhcpcd) is managing it.
2. Remove the Existing File and Recreate the Symlink
Force remove the existing file:
sudo rm /etc/resolv.conf
Then recreate the symlink:
sudo ln -s /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
3. Restart Services
sudo systemctl restart systemd-resolved
sudo systemctl restart systemd-networkd
Then test DNS resolution:
ping -c 3 google.com