Hot answers tagged

146 votes
Accepted

Chrome: DNS requests with random DNS names: malware?

I found a series of posts/bug reports about random DNS requests made by Chrome. The conclusion is those random DNS requests are neither generated by malware nor by plugins or add-ons. The requests ...
user avatar
145 votes

What DNS servers am I using?

On systems running systemd use: systemd-resolve --status Or: resolvectl
user avatar
  • 1,614
94 votes

How to troubleshoot DNS with systemd-resolved?

Very helpful for troubleshooting is also: journalctl -u systemd-resolved -f There you can see what systemd-resolved is really doing. In my case it was not contacting the DNS servers that were ...
user avatar
  • 1,573
89 votes

How do I set my DNS when resolv.conf is being overwritten?

I am also interested in this question and I tried the solution proposed @sim. To test it, I put nameserver 8.8.8.8 in /etc/resolvconf/resolv.conf.d/base and nameserver 8.8.4.4 in /etc/resolvconf/...
user avatar
  • 1,041
80 votes

What DNS servers am I using?

Just do an, nslookup. Part of its results include the server that it's using. In the example below, it shows that the DNS server used is at 8.8.8.8. $ nslookup google.com Server: 8.8.8.8 ...
user avatar
  • 801
78 votes
Accepted

How do I set my DNS when resolv.conf is being overwritten?

I found out that you can change the nameservers that dnsmasq uses by adding the following lines to /etc/dnsmasq.conf: server=8.8.8.8 server=8.8.4.4 I didn't have a /etc/dnsmasq.conf file though, ...
user avatar
  • 4,451
77 votes
Accepted

Why does /etc/resolv.conf point at 127.0.0.53?

You are likely running systemd-resolved as a service. systemd-resolved generates two configuration files on the fly, for optional use by DNS client libraries (such as the BIND DNS client library in C ...
user avatar
  • 62.9k
68 votes
Accepted

How to troubleshoot DNS with systemd-resolved?

Use resolvectl status (systemd-resolve --status when using systemd version earlier than 239) to show your global and per-link DNS settings.
user avatar
68 votes
Accepted

How to configure systemd-resolved and systemd-networkd to use local DNS server for resolving local domains and remote DNS server for remote domains?

In the configuration file for local network interface (a file matching the name pattern /etc/systemd/network/*.network) we have to either specify we want to obtain local DNS server address from DHCP ...
user avatar
62 votes

Is `dig ptr` a valid way to perform a reverse DNS query?

dig -x is a form of "syntactic sugar" that was added to the program later. Reverse DNS records, or PTR records, for IPv4 addresses are stored in the DNS in the reversed format that you see in the ...
user avatar
32 votes
Accepted

Why does Chromium not cache DNS for more than a minute?

Chromium/Chrome does not cache DNS requests more than a minute indeed. Interestingly enough, from bugs-chromium - Issue 164026 - DNS TTL not honored from Apr 21 2011 The only DNS cache in the system ...
user avatar
31 votes
Accepted

ping displays "Name or service not known"

Although I've never had problem with my other x86_64 PC all running Arch Linux, this frequently happens till date with Arch Linux ARM when running NetworkManager. The problem is like you are connected ...
user avatar
  • 1,664
29 votes
Accepted

Can not resolve .local domains internal to my office LAN

host and nslookup perform DNS lookups, however most applications use glibc's Name Service Switch to decide how host names are looked up. Your /etc/nsswitch.conf might enable mDNS, which might cause ...
user avatar
  • 13.4k
28 votes
Accepted

How do `/etc/hosts` and DNS work together to resolve hostnames to IP addresses?

This is dictated by the NSS (Name Service Switch) configuration i.e. /etc/nsswitch.conf file's hosts directive. For example, on my system: hosts: files mdns4_minimal [NOTFOUND=return] dns Here, ...
user avatar
  • 51.3k
27 votes

How can I resolve a hostname to an IP address in a Bash script?

Simple but useful: getent ahostsv4 www.google.de | grep STREAM | head -n 1 | cut -d ' ' -f 1 getent ahostsv6 www.google.de | grep STREAM | head -n 1 | cut -d ' ' -f 1 getent hosts google.de | head -n ...
user avatar
26 votes

How do I set my DNS when resolv.conf is being overwritten?

For static IP situations, the Ubuntu Server Guide says to change the file /etc/network/interfaces, which may look like this: iface eth0 inet static address 192.168.3.3 netmask 255.255.255.0 gateway ...
user avatar
  • 261
26 votes

Override Ubuntu 20.04 DNS using systemd-resolved

Update /etc/systemd/resolved.conf [Resolve] DNS=1.1.1.1 8.8.8.8 FallbackDNS=8.8.4.4 Restart system resolved: service systemd-resolved restart Run systemd-resolve --status the output should look ...
user avatar
  • 2,374
25 votes

How to read the local DNS cache contents?

Prior to systemd, there was almost no OS-level DNS caching Prior to systemd there was no OS-level DNS caching on Linux (and probably most Unix), unless nscd or dnsmasq was installed and running. ...
user avatar
25 votes

Specifying DNS settings to override those of DHCP

You can add the following line to /etc/dhcp/dhclient.conf: prepend domain-name-servers <working DNS IP(s) here>; This adds the DNS IP address(es) you specify before that/those provided by the ...
user avatar
  • 37.6k
25 votes
Accepted

Who reads /etc/resolv.conf?

DNS client libraries do. C libraries contain DNS clients that wrap up name-to-address lookups in the DNS protocol and hand them over to proxy DNS servers to do all of the grunt work of query ...
user avatar
  • 62.9k
22 votes

What DNS servers am I using?

With the new network-manager command nmcli, do this: nmcli --fields ipv4.dns,ipv6.dns con show [connection_name] On newer versions of network-manager (such as in Ubuntu 16.04), the field names are ...
user avatar
  • 381
22 votes
Accepted

how to extract just the IP address from a DNS query

I believe dig +short outputs two lines for you because the domain you query, smtp.mydomain.net is a CNAME for smtp.ggs.mydomain.net, and dig prints the intermediate resolution step. You can probably ...
user avatar
  • 14.7k
20 votes

How do I set my DNS when resolv.conf is being overwritten?

Search ' Network Connection' Open it                      Then select either WiFi or Ethernet, or whatever you are using, and click on edit. You'll get this:                Select ipv4 in tabs ...
user avatar
  • 317
20 votes
Accepted

How to test /etc/hosts

I tried this out and it seems to work as expected: echo "1.2.3.4 facebook.com" >> /etc/hosts Then I ran: $ getent ahosts facebook.com 1.2.3.4 STREAM facebook.com 1.2.3.4 ...
user avatar
  • 3,082
20 votes

nslookup, dig, firefox ignoring /etc/hosts file entries

nslookup, dig, and host are tools for querying DNS name servers. If your configuration is not provided by a name server (like the information given in /etc/hosts) those tools will not show them, ...
user avatar
  • 20.2k
20 votes

What are DNS server, resolver and stub resolver?

Confusing names that people often get wrong. In the terminology of RFC 1034, there are "resolvers" and there are "name servers". "resolver" describes the entire subsystem ...
user avatar
  • 62.9k
19 votes

How do I set my DNS when resolv.conf is being overwritten?

A quick and dirty workaround that wasn't mentioned yet is setting the immutable flag on the resolv.conf file right after editing it. $ sudo nano /etc/resolv.conf Add this and save: nameserver 8.8.8....
user avatar
19 votes
Accepted

apache won't restart after adding VirtualHost conf file, why not?

The logs are causing the errors because apache cannot write to the root of your website. Even if you were to fix the file permissions, you'd still be blocked by SELinux; which only allows apache to ...
user avatar
  • 31.9k
19 votes

WSL - DNS not working when connected to VPN

Resolved. Ubuntu subsystem (WSL) could not resolve corporate and non corporate domains while on or off vpn. Fixed. Must create /etc/wsl.conf file and add an entry to kill the resolv.conf file from ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible