This answer was not help full for me, so I struggled a lot with this.
I have an Ubuntu server running Nextcloud small size server.
I was started out from somewhere before version 16.04 lts before that version it run on X.10 or X.04 (X for version number)
In the past the network handler has changed.
When I upgrade (do-release-upgrade) from 20.04 LTS to 22.04 LTS it didn't go well with the network.
After a lot of google and use of the new chatbot.
If you at this point (and before doing anything else) have network (ping your gateway) but not being able to ping ubuntu.com
You need to add your dns server to this file:
nano /etc/resolvconf/resolv.conf.d/tail
nameserver 192.168.1.1
After that you can continue to the finale solution:
I got to this small and simple config:
The name i used for config: /etc/netplan/00-installer-config.yaml
# config start
# This is the network config written by 'subiquity'
network:
ethernets:
ens3:
dhcp4: no
addresses: [192.168.1.22/24]
gateway4: 192.168.1.1
nameservers:
addresses:
[192.168.1.1]
search: []
version: 2
# config end
just to make sure that the netplan is all working, you should do this command:
apt reinstall netplan.io
netplan.io is the packet for netplan ...
and you can remove network manager:
apt purge network-manager
and you can remove you interface config file, I renamed it to interface.old just in case ...
And remove the tail file you created before.
And now you should be able to reboot and on you go ...
That did it for me, and now I am running with the appropriated network config file for a small and simple server running Ubuntu 22.04 LTS with Nextcloud.