Thanks to the comments, I found out that the issue was related to an incorrect DNS Server configuration, which I could check by temporarily changing the /etc/resolv.conf
file. I tested this on Ubuntu Impish (21.10) but I suppose that applies other Ubuntu releases too. You can check your real ISP DNS Server on the router page to be sure (i.e. for me it's TelecomItalia DNS).
To make this change permanent, I prefer not to use a Netplan configuration file since it cannot be used globally but needs a a separate nameservers configuration for each network interface, plus a new configuration needs to be added everytime a new wifi network comes up to the game.
I found that the easiest way is using the lightweight resolvconf
package, which can be installed by:
sudo apt install resolvconf
Add the nameservers configuration to the /etc/resolv.conf
file and the /etc/resolvconf/resolv.conf.d/head
file first, for instance in my case:
nameserver 85.38.28.0 # Telecom DNS
nameserver 85.38.28.1 # Telecom DNS
nameserver 8.8.8.8 # Google DNS
nameserver 8.8.4.4 # Google DNS
nameserver 208.67.222.222 # OpenDNS
nameserver 208.67.222.220 # OpenDNS
Then restart the services by:
sudo systemctl restart resolvconf.service
sudo systemctl restart systemd-resolved.service
After reboot the changes should be persisted.