1. Check 2 files /etc/hostname and /etc/hosts
sudo nano /etc/hostname
samuelsudo nano /etc/hosts
127.0.0.1 localhost localhost.localdomain samuel 127.0.1.1 samuel-ubuntu 127.0.1.1 samuel
2. Make sure the name is the same in both files
3. Check content in /etc/resolv.conf file
nano /etc/resolv.conf
4. Add nameserver to the resolv.confnameserver 8.8.8.8
5. Restart servicesudo systemctl restart systemd-resolved.service