Since Ubuntu 16.10, the developers switched to using systemd-networkd by default on the server editions, moving away from ifupdown. On their Ubuntu Desktop editions, NetworkManager is still used. Having to determine and differentiate between two different networking configurations became confusing. Thus, Netplan was born in Ubuntu 18.04 and continues to be used. Netplan reads .yaml files within the /etc/netplan/ directory, and then automatically creates network configuration files for /run/systemd/network/ or /run/NetworkManager/ depending on the system configuration.
Check that Netplan is installed:
dpkg -l | grep netplan.io
List all network devices:
ip link
To show your current configuration from the system state:
netplan get
To show a detailed overview of your system’s current network configuration:
netplan status --all
List all your Netplan config files:
ls /etc/netplan/
If there is more than one file, you only have one ethernet card, you are having networking issues, and you’ve saved a backup, I recommend deleting all but one .yaml and keep networking within one file for simplicity.
View the Netplan config:
cat /etc/netplan/00-Public_network.yaml
If you’re having issues on a server with Ubuntu 22.04 you can try replacing your config with this default config (using a text editor such as nano or vim):
network:
ethernets:
ens192:
dhcp4: true
accept-ra: true
version: 2
If you had a different ethernet name from the ip link
output then replace it.
Now apply your new configuration:
netplan apply
Confirm that the IP is being read correctly:
ip addr
If this did not work, IPs are not being read, or the DHCP server is unavailable, you can try a static IP configuration instead:
network:
ethernets:
ens192:
dhcp4: false
dhcp6: false
addresses:
– 74.208.82.33/32
– fe80::a00:10a/64
gateway4: 10.255.255.1
gateway6: fe80::a00:101
nameservers:
addresses:
– 212.227.123.16
– 212.227.123.17
routes:
– to: default
via: 10.255.255.1
– to: default
via: fe80::1
Of course replace 74.208.82.33 with your server’s public IP, and /32 with the subnet provided by your host. Same thing for the IPv6 and /64. The gateway and nameserver provided are default for IONOS Cloud, otherwise they should be changed according to your provider.
If the command dpkg -l | grep netplan.io
returned no output, or netplan
returns command not found, it means Netplan is not being used to manage your networking.
If the netplan.io package is not installed and the /etc/netplan directory does not exist, netplan has not been installed. In this case, do not install netplan, but follow the steps described in the following article:
Adding a Public IPv4 and IPv6 Address to a Cloud Server or Virtual Private Server (IONOS)