Friday, May 3, 2024
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1901  / 3 Years ago, tue, november 16, 2021, 3:20:14

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.


More From » systemd-networkd

 Answers
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.


[#1608] Wednesday, November 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
pardsea

Total Points: 290
Total Questions: 115
Total Answers: 98

Location: Svalbard and Jan Mayen
Member since Sun, Sep 25, 2022
2 Years ago
;