Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [dns]

For questions pertaining to Domain Name System (DNS), a service that provides the resolution of host names to IP addresses. Use this tag when you are troubleshooting DNS issues, configuring a DNS resolver or server, or are trying to understand DNS's involvement in your situation.

Filter by
Sorted by
Tagged with
609 votes
27 answers

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

What's the most concise way to resolve a hostname to an IP address in a Bash script? I'm using Arch Linux.
Eugene Yarmash's user avatar
408 votes
14 answers

What DNS servers am I using?

How can I check which DNS server am I using (in Linux)? I am using network manager and a wired connection to my university's LAN. (I am trying to find out why my domain doesn't get resolved)
Grzenio's user avatar
  • 5,897
365 votes
18 answers

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

Most of the info I see online says to edit /etc/resolv.conf, but any changes I make there just get overridden. $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by ...
Seán Hayes's user avatar
  • 4,551
133 votes
3 answers

Why does /etc/resolv.conf point at

I tried to check what my DNS resolver is and I noticed this: user@ubuntu:~$ cat /etc/resolv.conf nameserver options edns0 I was expecting, which is my default gateway, my ...
HelloWorld's user avatar
  • 1,605
128 votes
4 answers

How to troubleshoot DNS with systemd-resolved?

How would you go about finding the DNS servers used by systemd-resolved, for troubleshooting purposes? Generally I can use dig and test the DNS servers shown in /etc/resolv.conf. (Or windows - ...
sourcejedi's user avatar
  • 50.6k
104 votes
1 answer

Chrome: DNS requests with random DNS names: malware?

Over the years (since 2005), I have seen logs of strange random DNS requests done, on the multiple DNS / BIND servers I have maintained. May 7 12:13:50 named[63742]: client (...
Rui F Ribeiro's user avatar
103 votes
5 answers

What is the point of sshd “UseDNS” option?

I know what it does, but I don't know why. What attack(s) does it prevent? Is it relevant for all kind of authentication methods? (hostbased, password, publickey, keyboard-interactive ...)
user368507's user avatar
  • 2,173
91 votes
3 answers

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

I'm connected to local area network with access to the Internet through gateway. There is DNS server in local network which is capable of resolving hostnames of computers from local network. I would ...
Piotr Dobrogost's user avatar
72 votes
2 answers

dig vs nslookup

Why do the commands dig and nslookup sometimes print different results? ~$ dig ; <<>> DiG 9.9.2-P1 <<>> ;; global options: +cmd ;; Got answer: ;; -&...
pylover's user avatar
  • 3,438
58 votes
4 answers

How to read the local DNS cache contents?

I know that on Windows I can issue ipconfig /displaydns and I see the local DNS's cache content. How can I list the DNS's cache content in Linux? I would like to get as much as cross-distro solution ...
Hanan's user avatar
  • 5,771
56 votes
9 answers

Can I create override dns similar to writing in /etc/hosts without root access

I want to set a dns record that my browser will use, but I don't have root access, so I can't modify /etc/hosts. I need to do this for testing vhosts with apache, whose dns hasn't yet been set up. I ...
xenoterracide's user avatar
50 votes
6 answers

How do I generate SSHFP records?

I need to setup SSHFP records in the DNS for my host. I have done some searching but I haven't found any good example. What are SSHFP records? What does SSHFP records look like? How do I create SSHFP ...
Mikael Dúi Bolinder's user avatar
49 votes
3 answers

curl --resolve appears to do nothing

The --help output for curl lists a --resolve option, which states --resolve <host:port:address> Force resolve of HOST:PORT to ADDRESS I'm not having any luck getting it to work though. The ...
tsuraan's user avatar
  • 593
48 votes
3 answers

What is the purpose of /etc/hosts?

As I understand it, the hosts file is one of several system facilities that assists in addressing network nodes in a computer network. But what should be inside it? When I install Ubuntu by default ...
MikiBelavista's user avatar
44 votes
4 answers

Override Ubuntu 20.04 DNS using systemd-resolved

How do I configure an Ubuntu 20.04 system so it overrides the default DNS? It seems that by default there is a global and per-link DNS setting. I tried a couple of things that did not work: Edit /...
Serge Fonville's user avatar
35 votes
7 answers

How to log all my DNS queries?

How can I create logs of every DNS query that my computer makes along with the responses it gets?
user avatar
35 votes
3 answers

Blocking Websites with /etc/hosts

There's a website,, that I tried to block myself from accessing because it wastes too much of my time. So I configured my /etc/hosts file. I added the following lines, to block the ...
Newb's user avatar
  • 1,092
34 votes
8 answers

How to test DNS speed?

I am using google open DNS. How can I measure the speed of a DNS server?
user4951's user avatar
  • 10.6k
32 votes
1 answer

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

I know we can use dig -x to perform a reverse DNS query. I have a textbook in front of me that says that both dig ptr and dig -x are valid syntax. dig -x definitely works for me, but I'm not getting ...
Juicy's user avatar
  • 3,915
31 votes
8 answers

WSL - DNS not working when connected to VPN

I've used WSL Bash/Ubuntu for several years, but for some reason this problem recently appeared. DNS is unable to resolve any names, both internal and external. The first time I re-installed WSL I ...
Morten's user avatar
  • 461
30 votes
6 answers

How to clear DNS cache on DD-WRT

How can I clear the DNS cache in DD-WRT on my router? DD-WRT uses the dnsmasq daemon.
Bobo's user avatar
  • 403
30 votes
4 answers

Ubuntu: How to configure DNS servers in /etc/network/interfaces correctly for resolvconf?

All examples I have seen of configurations (/etc/network/interfaces) showed that you configure an interface and then underneath that gave the dns-* lines such as: auto eth0 iface eth0 inet static ...
0xC0000022L's user avatar
  • 16.7k
29 votes
2 answers

alternative to nslookup in rhel7?

nslookup does not come preinstalled in RHEL 7 Beta. I noticed even dig and host was not pre installed. I read couple of links which mentions nslookup is dead/deprecated, so is there an alternative for ...
user1527651's user avatar
29 votes
5 answers

Iptables to redirect DNS lookup IP and Port

I have discovered that my ISP (verizon) is intercepting all DNS traffic on port 53. Using iptables, I want to redirect all DNS lookup traffic to a specific IP and Port (5353). Any attempt for my ...
Rucent88's user avatar
  • 1,890
29 votes
4 answers

How to flush local DNS cache in CentOS

I'm looking for a way to flush the local DNS cache on a CentOS 6. The system is not running any DNS server or anything, and I wish to let every DNS query go out to the configured nameserver, even for ...
fy_iceworld's user avatar
28 votes
2 answers

How does dig find my WAN-IP-address? What is "" doing?

I needed to automatically get my own WAN-IP-address from my router. I found this question and, among others, a solution with dig was proposed: dig +short It ...
Beate Bier's user avatar
26 votes
1 answer

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

I use Chromium and have problems with the DNS not being cached for the time that I would expect. Take the domain. According to the DNS settings, this domain should be cached for another ...
user32421's user avatar
  • 337
25 votes
3 answers

How to allow systemd-resolved to listen to an interface other than loopback?

systemd-resolved is a daemon that, among other things, acts as a DNS server by listening IP address on the local loopback interface. I would like to let the daemon listen to another ...
Matthieu Moy's user avatar
25 votes
6 answers

Host lookup that respects /etc/hosts

Utilities like host and dig let you see the IP address corresponding to the host name. There is also the getent utility that can be used to query /etc/hosts or other NSS databases. I am looking for ...
Roman Cheplyaka's user avatar
24 votes
5 answers

ping displays "Name or service not known"

I am running Arch Linux on a Raspberry Pi. Suddenly: I am unable to ping to a website. I am unable to access a website from the browser. I have two more computers (all running Arch Linux) connected ...
15 Volts's user avatar
  • 2,099
23 votes
2 answers

What's the "right way" to effect changes in /etc/resolv.conf with /etc/resolv.conf.d in place?

I the old days, resolv.conf was static and you edited it yourself. Later on, the DHCP client would rewrite it, using some static entries and what it got from the DHCP lease. These days, some ...
einpoklum's user avatar
  • 9,595
23 votes
6 answers

Why can't I ping Google?

I can't ping (unknown host). But I can ping IP addresses. I tried to ping the IP address of Google but it doesn't work. resolv.conf nameserver nameserver ifconfig ...
az93's user avatar
  • 857
22 votes
3 answers

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

In Linux, how do /etc/hosts and DNS work together to resolve hostnames to IP addresses? if a hostname can be resolved in /etc/hosts, does DNS apply after /etc/hosts to resolve the hostname or treat ...
Tim's user avatar
  • 102k
22 votes
3 answers

Can not resolve .local domains internal to my office LAN

On Linux Debian 9 I am able to resolve a specific local domain e.g. my.sample-domain.local using some commands like nslookup or host, but not with some other commands like ping or the Postgres client ...
TPPZ's user avatar
  • 537
22 votes
2 answers

how to extract just the IP address from a DNS query

On Alpine Linux, I'd like to know how to extract just the IP address from a DNS / dig query. The query I'm running looks like this: lab-1:/var/# dig +answer +short smtp.ggs....
dot's user avatar
  • 705
22 votes
4 answers

How to define DNS server in openvpn?

I setup an openvpn server with static key (certificate mode is not usable due to DPI at the national gateway), but I cannot successfully change the DNS automatically after the connection. I searched ...
Siyuan Ren's user avatar
  • 1,372
21 votes
4 answers

Is there a way to get the Public DNS address of an instance?

I have a project wherein I need to update configuration files each time an EC2 instance is booted with the Public DNS address of the current instance. I'll be using Perl or Sed for this, so that's ...
Naftuli Kay's user avatar
  • 39.9k
21 votes
1 answer

How to let `named` (bind9) forward certain domains to a different nameserver?

In dnsmasq, it's possible to forward domains to different nameservers. How can I do that in named? server=/ server=/
Cheng's user avatar
  • 6,671
21 votes
6 answers

Busybox ping IP works, but hostname nslookup fails with "bad address"

I am compiling my own 3.14 kernel. I fear I may have left out some important networking feature to get DNS working. I can't resolve domain names. I can ping my DNS server. I can resolve using that ...
AllenKll's user avatar
  • 708
20 votes
2 answers

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

There is something terribly wrong with my current Debian install. Most programs like firefox, nslookup, dig etc. are ignoring entries in /etc/hosts file, actually I use this file for Ad-blocking. an ...
Arnab's user avatar
  • 1,591
20 votes
1 answer

No domain defined in /etc/resolv.conf

I see more and more servers that have no domain defined in the /etc/resolv.conf file. Only a search entry. In what cases is this setup used ? Are there any cases where it must not be used ? ...
Emmanuel's user avatar
  • 4,187
20 votes
1 answer

What is the difference between resolvconf, systemd-resolve, and avahi?

I'm currently working on a project that has required some DNS troubleshooting. However I am fairly new to the wonderful world of networking and I'm at a bit of a loss as to where to begin. My specific ...
Toshi Taperek's user avatar
19 votes
5 answers

How to flush the DNS cache in Debian?

How can I flush the DNS cache in Debian 9.1 with KDE?
mYnDstrEAm's user avatar
  • 4,340
19 votes
3 answers

Who reads /etc/resolv.conf?

My Centos 7 server doesn't resolve domain names properly. From what I see, in modern Linux systems /etc/resolv.conf is often generated with dhclient, dnsmasq or Network Manager. Thus I have a ...
Boris Burkov's user avatar
  • 3,990
19 votes
2 answers

Specifying DNS settings to override those of DHCP

Every 6 months or so I cannot access the DNS on whatever router I'm using. usually have to add the nameserver by hand to the /etc/resolv.conf file. I've tried adding Google free DNS to the file and it ...
John Coder's user avatar
18 votes
5 answers

How to set DNS resolver in Fedora using network-manager?

I want to try out Google public DNS. For this I need to change the nameserver address. I know it's in the file /etc/resolv.conf, but whenever I start network-manager, it overwrites the values in that ...
wvxvw's user avatar
  • 617
18 votes
5 answers

Why doesn't systemd-resolved use my local DNS server?

I'm using a local BIND9 server to host some local dns records. When trying to dig for a local domain name I can't find it if I don't explicitly tell dig to use my local BIND9 server. user@heimdal:~$ ...
Civing's user avatar
  • 409
17 votes
3 answers

How to test /etc/hosts

What's the best way to confirm that your /etc/hosts file is mapping a hostname to the correct IP address? Using a tool like dig queries an external DNS directly, bypassing the hosts file.
Jay's user avatar
  • 273
17 votes
2 answers

What are DNS server, resolver and stub resolver? says Additionally, systemd-resolved provides a local DNS stub listener on IP address on the ...
Tim's user avatar
  • 102k
17 votes
1 answer

How can I override the /etc/hosts file at user level? [duplicate]

Possible Duplicate: Can I create a user-specific hosts file to complement /etc/hosts? In short: I would like to know if it is possible to get a ~/hosts file that could override the /etc/hosts ...
yves Baumes's user avatar

2 3 4 5