• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

nameservers

Checking Nameservers

January 15, 2023

Handy little script to see if nameserver is on an array.

#!/bin/bash
declare -a servers=("127.0.0.53" "127.0.0.52" "127.0.0.51")
client=$(cat /etc/resolv.conf | grep nameserver)
for i in "${servers[@]}"
do
  if [[ $client =~ $i ]]
  then 
    using_unbound="true"
    break
  else
    using_unbound="false"
  fi
done
echo $using_unbound "|" $client

#!/bin/bash declare -a servers=("127.0.0.53" "127.0.0.52" "127.0.0.51") client=$(cat /etc/resolv.conf | grep nameserver) for i in "${servers[@]}" do if [[ $client =~ $i ]] then using_unbound="true" break else using_unbound="false" fi done echo $using_unbound "|" $client

Filed Under: Linux Tagged With: check, nameservers

Troubleshoot Nameservers with Dig

April 8, 2021

Here’s how to troubleshoot nameservers with dig.

dig hostname
dig domain.com

dig hostname dig domain.com

To test a specific nameserver.

dig @nameserver hostname
dig @nameserver ip-address

dig @nameserver hostname dig @nameserver ip-address

Other options.

dig hostname.domain.com +short
dig hostname.domain.com +noall +answer
dig @nameserver MX domain.com
dig @nameserver AAAA domain.com

dig hostname.domain.com +short dig hostname.domain.com +noall +answer dig @nameserver MX domain.com dig @nameserver AAAA domain.com

Filed Under: Linux Tagged With: dig, nameservers, test, troubleshoot

Resolv.conf

January 7, 2019

Resolv.conf is a computer file used by various operating systems as a DNS resolver. The file is in plain text. It’s usually generated by the system administrator or a network program. The file is located in the /etc/ directory and contains the search domain as well a list of nameservers.

Here’s an example of the /etc/resolv.conf file.

search domain.com local.lan
nameserver 1.1.1.1
nameserver 8.8.8.8
nameserver 9.9.9.9

search domain.com local.lan nameserver 1.1.1.1 nameserver 8.8.8.8 nameserver 9.9.9.9

If you have problems resolving domain names, check this file first.

Filed Under: Linux Tagged With: dns, nameservers, network, resolv.conf

  • Home
  • About
  • Archives

Copyright © 2023