Are "dns-nameservers x.x.x.x" and "nameserver" on multiple lines the same thing?

0

Does anyone know if there's any difference between this:

dns-nameservers 8.8.8.8 8.8.4.4

and

nameserver 8.8.8.8
nameserver 8.8.4.4

To my understanding, they're the exact same thing, but I could be wrong. This is coming from /etc/resolv.conf

LewlSauce

Posted 2016-03-16T17:21:32.370

Reputation: 133

Answers

1

They are similar, but only nameserver will work in /etc/resolv.conf, and each DNS server must be on a line by itself. You can see the manual page for resolv.conf(5) for what keywords are allowed in that file. A line usingdns-nameservers will not work in this file. The file resolv.conf is standard on virtually all Unix systems and has been for a long time.

dns-nameservers is used in another (similar) context, the /etc/network/interfaces file, which is mainly used on Debian-based Linux systems (such as Ubuntu). Other Unix operating systems, and even other "flavors" of Linux usually do not use this file. But in this case, nameserver (singular) will not work, but dns-nameservers will. See https://wiki.debian.org/NetworkConfiguration for more info on this.

M. T.

Posted 2016-03-16T17:21:32.370

Reputation: 38

Sweet! Makes perfect sense man. Thanks so much for this explanation! – LewlSauce – 2016-03-16T22:33:14.003