5

I want to configure networking using bare systemd-networkd. Instructions are here: https://wiki.archlinux.org/title/systemd-networkd#Wired_adapter_using_a_static_IP

I haven't used NetworkManager for years, so I'm halfway there but I suspect that to do it correctly I need to bypass the system startup call to netplan. Ideally I can disable it, but I don't know how to do that. There is a lot of information about returning to ifupdown but I don't see much for what I'm looking for.

https://renediepstraten.nl/?p=51 suggests using apt to remove netplan which is too heavy-handed for my liking particularly when apt remove netplan.io wants to remove ubuntu-minimal.

Update ubuntu-minimal can be safely removed. https://askubuntu.com/questions/1066154/what-is-the-ubuntu-minimal-package-and-do-i-need-it#:~:text=As%20explained%20earlier%2C%20'ubuntu%2D,impact%20on%20currently%20installed%20packages.

2 Answers2

2

I am assuming you have a DHCP.

Remove netplan.io

sudo apt remove --purge netplan.io

Now restart. After restart your pc will have no internet.

Run

sudo systemctl disable network-manager
sudo systemctl stop network-manager
sudo systemctl enable systemd-networkd
sudo systemctl start systemd-networkd
sudo systemctl start systemd-resolved
sudo systemctl enable systemd-resolved
sudo rm /etc/resolv.conf
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf

sudo tee /etc/systemd/network/20-dhcp.network << END [Match] Name=enp5s0

[Network] DHCP=yes END

What the last command doing is, it is appending lines in /etc/systemd/network/20-dhcp.network. To know what value you should use in Name=enp5s0, run ip -c link to get the name of the NIC.

If you do not have DHCP and need to use static IP, Replace

[Network]
DHCP=yes

with your details (do not copy paste, you have to know your IP Address, Gateway and DNS).

[Network]
Address=10.1.10.9/24
Gateway=10.1.10.1
DNS=10.1.10.1

If you are using wifi, you might have to add the line IgnoreCarrierLoss=3s under [Network]

Now Run

sudo systemctl restart systemd-networkd
sudo systemctl restart systemd-resolved

Hopefully, you will get back your internet.

Read systemd-networkd for more details , for example if you have both Wired and wireless adapters etc.

1

To remove netplan.io and keeping its dependency ubuntu-minimal use:

sudo dpkg -r --force-depends netplan.io
GAD3R
  • 3,507
  • Thanks. It turns out though that removing ubuntu-minimal has no effect on an installed system. Its purpose is to point to packages required of a minimal install. – Stephen Boston May 07 '21 at 13:20