Score:0

DNS resolve not working on linux ubuntu 22.04

br flag

when I try to change my DNS to any other DNS, nothing works as expected its like I set up nothing as DNS but i did!

when i open browser and try to open websites i get this error:

ERR_NAME_NOT_RESOLVED


I tried changing my DNS in :

sudo nano /etc/resolv.conf

like this:

nameserver 178.22.122.100
nameserver 185.51.200.2

but after that when i open browser and try to open websites i get this error:

ERR_NAME_NOT_RESOLVED


And also I tried changing my DNS here :

sudo nano /etc/systemd/resolved.conf

like this:

DNS=178.22.122.100 185.51.200.2

and after/before that i done a systemd-resolved restart with this command:

sudo systemctl restart systemd-resolved

but after that when i open browser and try to open websites i get this error:

ERR_NAME_NOT_RESOLVED


I also tried this command :

sudo resolvectl dns wlp3s0 178.22.122.100 185.51.200.2

which sets shecan DNS directly to wlp3s0(my network adaptor), when i check resolvectl status it shows the following :

Link 3 (wlp3s0)
Current Scopes: DNS
     Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
   DNS Servers: 178.22.122.100 185.51.200.2

but the DNS is not working as expected. when i open browser and try to open websites i get this error:

ERR_NAME_NOT_RESOLVED


When I try to ping these IPs they work:

$ping 185.51.200.2 -c 4
PING 185.51.200.2 (185.51.200.2) 56(84) bytes of data.
64 bytes from 185.51.200.2: icmp_seq=1 ttl=53 time=101 ms
64 bytes from 185.51.200.2: icmp_seq=1 ttl=53 time=101 ms (DUP!)
64 bytes from 185.51.200.2: icmp_seq=2 ttl=53 time=55.1 ms
64 bytes from 185.51.200.2: icmp_seq=3 ttl=53 time=99.0 ms
64 bytes from 185.51.200.2: icmp_seq=4 ttl=53 time=54.9 ms

--- 185.51.200.2 ping statistics ---
4 packets transmitted, 4 received, +1 duplicates, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 54.940/82.227/101.074/22.213 ms

$ping 178.22.122.100 -c 4
PING 178.22.122.100 (178.22.122.100) 56(84) bytes of data.
64 bytes from 178.22.122.100: icmp_seq=1 ttl=51 time=68.9 ms
64 bytes from 178.22.122.100: icmp_seq=2 ttl=51 time=123 ms
64 bytes from 178.22.122.100: icmp_seq=3 ttl=51 time=66.3 ms
64 bytes from 178.22.122.100: icmp_seq=4 ttl=51 time=105 ms

--- 178.22.122.100 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 66.326/90.860/122.741/24.041 ms

EDIT: output of ls -al /etc/resolv.conf:

lrwxrwxrwx 1 root root 37 May 25 15:24 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
Bodo avatar
pt flag
Please [edit] your question and add details about your network and IP addresses. Can you ping the specified servers?
mahdi avatar
br flag
@Bodo thanks for reply, i got ping from them and edited question, what kind on network information is necessary ? let me know and ill put them
Bodo avatar
pt flag
Maybe a diagram of your local system, the DNS servers and your local network in between showing the IP addresses of the relevant systems. You wrote "the DNS is not working as expected". How exactly do you check this and what error or wrong result do you get?
mahdi avatar
br flag
@Bodo bro i dont know much about linux, just say commands and ill execute, lol. i check dns not working issue with openning browser and trying to use websites, websites not working and it shows ERR_NAME_NOT_RESOLVED
mahdi avatar
br flag
@Bodo is this fine now? can you leave me more replys please
chili555 avatar
cn flag
Please edit your question to show the result of the terminal command: `ls -al /etc/resolv.conf` Welcome to Ask Ubuntu.
mahdi avatar
br flag
@chili555 thanks for reply, just added your request. do you want something else ?
Bodo avatar
pt flag
Show the command and resulting output `host -v some.host.domain.tld` where you use a DNS name that cannot be resolved. You wrote "when I try to change my DNS to *any other* DNS, nothing works as expected". Did it work before your change? What was your DNS server before? You still didn't show or describe your network structure.
Bodo avatar
pt flag
There is no command to show your network structure. I would expect something like this: My local computer has IP address X, it is connected via Ethernet to a router model ABC which has an internal IP address Y and external IP address Z, DNS server 178.22.122.100 is somewhere in the internet. There is a proxy / no proxy in my local network.
mpboden avatar
do flag
We're assuming this is a desktop installation and not a server installation, because you reference using a browser. What browser? On the surface, it appears your network is functional except DNS, but the problem could be one of many things, including the browser itself. In addition to describing your network layout requested by @Bodo, please update your question with the output of each of the following commands: `ip a`, `ip route`, `resolvectl`, `systemctl status systemd-resolved`, `systemctl status systemd-networkd`, `systemctl status network-manager`, `dig google.com`, `cat /etc/netplan/*`.
tink avatar
aw flag
Other possible causes: those DNS servers (the name of one of them resolves to `dns.shecan.ir`) don't serve your IP, possibly limited to their own customers. Does `dig @185.51.200.2 google.com` or `dig @178.22.122.100 google.com` work on the commandline? If you `nmap -O 178.22.122.100`, does port 53 show as open?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.