[TriLUG] How ssh et al resolves domain names...

Igor Partola igor at igorpartola.com
Tue Aug 27 11:54:46 EDT 2013


What is the FQDN for mirawall? In your /etc/resolv.conf you have the
following line:

search nc.rr.com

If the rest of the options are left as their defaults, any domain name you
try to resolve that has less than one dot in it will be appended the value "
nc.rr.com". In other words, when you do `ssh mirawall`, it effectively gets
translated to `ssh mirawall.nc.rr.com` (NOTE: not literally. The only time
this translation happens is inside of libc which is doing the DNS
resolution).

Try the following command:

$ dig mirawall

You will get output like below:

; <<>> DiG 9.8.1-P1 <<>> trilug.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 64080
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 5, ADDITIONAL: 9

;; QUESTION SECTION:
;trilug.org. IN A

;; ANSWER SECTION:
trilug.org. 7195 IN A 64.244.27.136

....

;; Query time: 13 msec
;; SERVER: 192.168.1.2#53(192.168.1.2)
;; WHEN: Tue Aug 27 11:36:42 2013
;; MSG SIZE  rcvd: 335

Note the SERVER line (third from bottom). This line tells you which server
resolved it.

I am not familiar with how DHCP-assigned hostnames are resolved, but I know
that the most reliable way to do this is to (a) set your "search" option in
/etc/resolv.conf to your domain (you could use "lan" as your local domain
if you don't have a global one registered), (b) run your own copy of bind9
or similar on a server on in your LAN and (c) set the /etc/resolv.conf's
first nameserver option to the IP of that LAN server.

Igor


More information about the TriLUG mailing list