0

I'm running Ubuntu 18.04 on my laptop. I am trying to ping other computers on my local network using their hostname but it's not working.

$ ping ubuntudesktop
ping: ubuntudesktop: Name or service not known

I have the name servers for the wifi adapter set up as follows: Wifi adapter DNS settings

I am snooping the wifi packets using wireshark and I do not see any DNS query when I run the ping command. Why are these nameservers not being used?

On a side note - when I use nslookup for google.com for example I get the following:

$ nslookup google.com
Server:     127.0.0.53
Address:    127.0.0.53#53

Non-authoritative answer:
Name:   google.com
Address: 172.217.14.238
Name:   google.com
Address: 2607:f8b0:400a:803::200e

I am assuming Server is the address of the DNS server? Isn't 127.0.0.53 an address for the loopback interface? Would this mean it's essentially querying itself?

  • Where are you expecting this information to come from? DNS doesn't usually resolve unqualified local network names - mDNS / Bonjour / Avahi may do so for addresses of the form ubuntudesktop.local. Otherwise you will need to use the files mechanism (by adding a suitable entry into your local computer's /etc/hosts file) – steeldriver May 3 at 17:09
  • from the local router – iamthebull May 3 at 17:12
1

127.0.0.53 is the address used by systemd-resolved.service

tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      1224/systemd-resolv 
udp        0      0 127.0.0.53:53           0.0.0.0:*                           1224/systemd-resolv 

Hostnames of other computers will not be resolved trough the DNS service.

You need to specify them in /etc/hosts statically.

Example:

127.0.0.1 localhost
127.0.1.1 mypc

192.168.1.100 ubuntudesktop

You can edit this file trough sudo

sudo editor /etc/hosts
  • I have another computer on my network that does us DNS to resolve hostnames. If I understand it correctly the DNS service will query the router and it will resolve the hostname to the local IP address. – iamthebull May 3 at 16:58
  • So you need to provide your DNS servers at DHCP level or specify them in the systemd-resolved service or though NetworkManager (System settings -> Network). – Comar May 3 at 17:00
  • Do you have the libnss-resolve package installed? That may fix the /etc/nsswitch.conf to actually use dns in some cases. – ubfan1 May 3 at 17:02
  • I have the DNS servers configured in the settings for the wifi adapter (see the screenshot listed on the post). Are these settings being ignored? – iamthebull May 3 at 17:03
  • On the computer that is working (16.04) the /etc/resolv.conf includes a search domain and the one that is not working (18.04) does not. How do I add a search domain in 18.04? It's not available in the network settings of the adapter. – iamthebull May 3 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.