Try running:
sudo cat /etc/resolv.conf
There should be a few name servers listed in there, local, default or Google/Cloudflare.
If there are none, you can add them manually:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
# 127.0.0.53 is the systemd-resolved stub resolver.
# run "resolvectl status" to see details about the actual nameservers.
nameserver 1.1.1.1
nameserver 1.0.0.1
Do note that changes to this file are only temporary, to permanently set alternative DNS servers try this: https://www.ricmedia.com/tutorials/set-permanent-dns-nameservers-ubuntu-debian-resolv-conf