Determine FQDN when hostname doesn't give it?
It appears that under-the-hood, Puppet uses Facter to evaluate the domain names:
$ facter domain
domain.com
$ facter hostname
kungfumaster
$ facter fqdn
kungfumaster.domain.com
The answer is in the relevant Facter source code.
It does the following in order and uses the first one that appears to contain a domain name:
- hostname -f
- dnsdomainname
- parsing resolv.conf for a "domain" or "search" entry
Probably because your system is part of a domain network that assigns a domain name. For example in my case, my router resolves all hostnames in the form of host.lan
, "lan" being my domain, and "host" the name of my system.
The FQDN most likely comes from your router DNS, just run whatever you like of these commands:
nslookup your-ip-here
dig -x your-ip-here
host your-ip-here
An example using dig
:
dig @10.0.0.1 -x 10.0.0.1
; <<>> DiG 9.9.5-4-Debian <<>> @10.0.0.1 -x 10.0.0.1
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11384
;; flags: qr aa rd ad; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; WARNING: recursion requested but not available
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;1.0.0.10.in-addr.arpa. IN PTR
;; ADDITIONAL SECTION:
1.0.0.10.in-addr.arpa. 86400 IN PTR dsldevice.lan.
;; Query time: 2181 msec
;; SERVER: 10.0.0.1#53(10.0.0.1)
;; WHEN: Thu Jun 19 20:01:32 AST 2014
;; MSG SIZE rcvd: 77
Since I use my own DNS and not the router's I have to set the domain to query in the @
part. I'm querying the routers' own domain name.
You will find that it will return the domain name as your DNS/router sees you. There are various ways to disable this in the router, but I've found that the most easier way is just using other DNS.