- 1 Resource
- 2 Records
- 3 DNSCrypt
- 4 Network commands
- 5 DNS server
- 6 DNSmasq (DNS + DHCP server)
- 7 DNS providers
- 8 Change DNS setting
- 9 DNS tricks
- 10 DNStracer
- 11 Dyndns and ddclient
- 12 no-ip
Managing DNS Essential Training from lynda.com
- How to Create, Edit, and Delete DNS Records
- How can I set up an A (address) record for my domain (namecheap)?, How to edit DNS records on Namecheap?
- dnscrypt-proxy 2 - A flexible DNS proxy, with support for encrypted DNS protocols
- Install and Enable DNSCrypt Proxy 2 in Ubuntu 18.04 Or 18.10 / Debian Unstable Or Testing
- curl - ping alternative. It is useful if the server blocks ping requests]
- nc and telnet - How to Test Port TCP/UDP Connectivity from a Linux Server
Setup on Linux/Ubuntu
- Build your own DNS name server on Linux. General discussion, not specific to Ubuntu.
- How To Configure DNS Server On Ubuntu 18.04 / Ubuntu 16.04, How to install a DNS server on Ubuntu 19.04
sudo apt install bind9 sudo nano /etc/bind/named.conf.options # update 'forwarders' key to use 1,1,1,1; 22.214.171.124; # add 'forward only;' sudo systemctl restart bind9 # open port 53, or let ufw to allow bind9
dig @192.168.1.2 linkedin.com # Suppose the DNS server ips is 192.168.1.2
- Pay attention to the Query time result. If we run the same command again, the query time will be reduced to 0 because of the cache in the DNS server.
- Wifi on Mobile
- Go to wi-fi setting and select your connected network (so each wifi network has its own DNS setting).
- Change Configure DNS from Automatic to Manual so that you can set your primary DNS server to Pi-hole. Then add the IP of your DNS server. You can add a backup server too (such as the IP address of your gateway router) so you can still visit websites when Pi-hole is offline.
- Mobile network
What is my DNS server /etc/resolv.conf or /etc/network/interfaces
PS. dig command can show my DNS server as part of its output.
Even I can change my DNS setting using the Network Manager (IPv4 -> disable Automatic -> Enter 126.96.36.199 -> Apply -> Toggle On/Off), the name solving does not work. Testing https://188.8.131.52 works but not https://brb.nci.nih.gov
Note: we are not supposed to edit /etc/resolv.conf file. See here on how to add DNS servers.
The real DNS servers IPs can be found by the network manager GUI or using the command line
nmcli dev show | grep 'IP4.DNS'
On my home computer, it just shows one line nameserver 127.0.1.1. On work computer, it shows
# 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 nameserver 127.0.1.1 search XXX.XXX.gov
On the VM of my work computer, it shows
nameserver 127.0.0.53 search XXX.XXX.gov
It seems the /etc/resolv.conf file changes with the file on the host.
After any change, we can restart the network by using sudo service networking restart.
- nameserver Name-server-IP-address: Point out to your your own nameserver or to ISP’s name server. Up to 3 name servers may be listed.
- search domain.com: The search list is normally determined from the local domain name; by default, it contains only the local domain name. So when you type nslookup www, it will be matched to www.cyberciti.biz
You can also use Public Name Servers
nameserver 184.108.40.206 nameserver 220.127.116.11
On Ubuntu 18.04, it uses netplan. See
- Netplan – How To Configure Static IP Address in Ubuntu 18.04 using Netplan
- How to set DNS nameservers in Ubuntu Server 18.04
dig Command Examples
dig (domain information groper) is a DNS lookup utility.
- 12 Dig Command Examples To Query DNS In Linux
$ dig google.com ANY $ dig r-project.org ANY ... ;r-project.org. IN ANY ;; ANSWER SECTION: r-project.org. 7199 IN NS ns2.urbanek.info. r-project.org. 7199 IN NS ns1.urbanek.info. r-project.org. 7199 IN NS ns2.wu-wien.ac.at. r-project.org. 7199 IN NS ns3.urbanek.info. r-project.org. 7199 IN NS ns4.urbanek.info. r-project.org. 7199 IN NS ns1.wu-wien.ac.at. r-project.org. 7199 IN A 18.104.22.168 r-project.org. 7199 IN MX 5 mc1.ethz.ch. r-project.org. 7199 IN MX 5 mc4.ethz.ch. r-project.org. 7199 IN MX 5 mc3.ethz.ch. r-project.org. 7199 IN MX 5 mc2.ethz.ch. r-project.org. 7199 IN TXT "v=spf1 ip4:22.214.171.124/32 ~all" r-project.org. 7199 IN SOA ns0.wu-wien.ac.at. postmaster.wu-wien.ac.at.
DNSmasq (DNS + DHCP server)
- Man page and Setup
- Dnsmasq For Easy LAN Name Services
Local forwarding server
dnsmasq program is running on my Ubuntu and Linux/Mint machines.
$ ps -ef | grep -i dnsmasq $ sudo netstat -anp | grep -i dnsmasq
- DNS Resolvers Performance compared: CloudFlare x Google x Quad9 x OpenDNS
- Best free and public DNS servers of 2020
- NextDNS: click 'Try it now for free' button and it will show the current DNS Server IP.
Change DNS setting
- Why Changing DNS Settings Increases Your Internet Speed, 5 DNS Servers Guaranteed to Improve Your Online Safety
- Change DNS Settings on Windows / Mac / Android / IOS / Linux
- Setup CloudFlare DNS On Ubuntu 16.04 / 17.10 / 18.04 Desktop
- Open Ubuntu Network Manager (System settings > Network > Settings > Wired or Wireless or both)
- Select both IPv4 and IPv6 and turn off automatic DNS IP settings… then type the custom Cloudflare DNS IP addresses you want to use…
- You Can Now Use Cloudflare’s 126.96.36.199 DNS on Mobile
Domain Setup & SSL Certificates, HTTPS - NGINX & Docker Compose
Flush DNS cache
How To Set Permanent DNS Nameservers
Test if you are using OpenDNS
I try to change the DNS ip using either Network Connection GUI or modifying /etc/resolv.conf (& calling sudo /etc/init.d/networking restart). But it does not change anything??
DNS-over-HTTPS (DoH) in Firefox
Query DNS server
# Ubuntu >= 15 $ nmcli dev show | grep 'IP4.DNS' $ nmcli device show <interfacename> | grep IP4.DNS # Ubuntu <= 14 $ nmcli dev list iface <interfacename> | grep IP4
$ cat /etc/resolv.conf
Method 3 (macOS):
scutil --dns | grep nameserver # cat /etc/resolv.conf
3 Ways to Check DNS Propagation Status
5 DNS Servers Guaranteed to Improve Your Online Safety
5 Nifty Ways to Use DNS to Your Advantage
Dyndns and ddclient
- https://help.ubuntu.com/community/DynamicDNS#ddclient (works)
- https://help.ubuntu.com/community/DynamicDNS#Namecheap_.26_Python (works)
- Using ddclient with Cloudflare ddclient version 3.9.0 for Ubuntu 18.04.1
protocol=namecheap ssl=yes use=web, web=dynamicdns.park-your-domain.com/getip server=dynamicdns.park-your-domain.com login=yourdomain.com password=a9438540ba8a449fb0ed09c3737b9e32 @
Note that the specification should depend on the domain name registrar (eg namecheap). For namecheap, the login/password is NOT your actual credential from your domain name registrar. The password should be obtained from the domain name registrar website. The last line is about the host. If I am setting it up for a subdomain, I should enter the subdomain name (and skip the domain name part). The ssl=yes is to ensure the connection is made over https instead of http.
And run sudo ddclient -daemon=0 -debug -verbose -noquiet to verify ddclient is working. You shall get a long return with the last line looks like
SUCCESS: updating YOURSUBDOMAIN: good: IP address set to XX.XXX.XXX.XXX
No matter which method we use, we can go to our DNS account (in namecheap, go to Dashboard -> MANAGE button -> Domains -> Advanced DNS) and temporarily change the global IP address to another one, run the update script and then check if the global IP address has been updated to the correct one.
- How do I configure DDClient?
- To create a subdomain, go to Dashboard -> Manage -> Advanced DNS tab. Click + ADD NEW RECORD. In the 'HOST RECORDS' section, pick 'A + dynamic dns record' and enter the subdomain name (HOST) with the IPv4 address (Value). In the 'DYNAMIC DNS' section, we can download the client software too (scroll down to get the download link). See How can I set up an A (address) record for my domain?
- To understand different records (A record, AAAA record, CNAME record, NS record, SRV record, TXT record, URL redirect record) See How do I set up host records for a domain?
- If you've purchased an SSL certificate, you'll want to visit your Account Panel soon to enter your CSR and activate the certificate. Instructions on how to create a CSR and install the certificate on your server.
- Email forwarding
- Add https to your Namecheap Domain hosted on Github Pages
- check the option of Mail Routing: I have mail server with another name and would like to add MX hostname...
- In 'MX hostname' entering aspmx.l.google.com
- In 'Primary' choose 'Yes, use it as my primary mail relay.'
- How to Set Up Email at Your Domain for Free With Zoho Mail July 2019
Similar to Dyndns. It has its own client program. Needs to build it yourself.
Also see the troubleshooting guide.
See http://ducky-pond.com/posts/12 for instruction of setting autostart on Debian system.
See http://www.coulterfamily.org.uk/pages/PCs/Linux/FAQ-LINUX-NO-IP-CLIENT.php for another approach.
Note: If noip2 cannot start automatically or noip2 does not update even it can be seen from ps -ef command, use sudo crontab -e command. For some reason, after I use sudo crontab, noip2 can update IP. So the only problem right now is it cannot update every 30 minutes even sudo noip2 -S says so. The problems may be 1. ps -ef shows the command runs from nobody user 2. sudo noip2 -S says it updates every 30 minutes via /dev/eth0 with NAT enabled.
Update: An alternative is to use ddclient. However, ddclient never updates the IP.
- Allow only one MX record for each host for free no-ip account.
- Click Host/Redirects > Manage Hosts > Modify.