Chez moi, dig localhost ne fait pas d'erreur, mais ne renvoie rien, car effectivement localhost n'est pas défini. J'ai les DNS google dans ce cas, 8.8.8.8 et 8.8.4.4.
ubuntu-srv:~$ dig localhost
; <<>> DiG 9.10.3-P4-Ubuntu <<>> localhost
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 38370
;; flags: qr rd ra ad; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
;; QUESTION SECTION:
;localhost. IN A
;; AUTHORITY SECTION:
. 42469 IN SOA a.root-servers.net. nstld.verisign-grs.com. 2017042101 1800 900 604800 86400
;; Query time: 7 msec
;; SERVER: 8.8.8.8#53(8.8.8.8)
;; WHEN: Sat Apr 22 10:06:04 CEST 2017
;; MSG SIZE rcvd: 113