Solved Delimiter for `name_servers` in `resolvconf.conf`

I want to set two name servers to use for DNS Service redundancy on my system. I have two IP address, say, 172.16.5.1, and 172.16.5.2, to use. I'm looking at resolvconf.conf(5) under the RESOLVCONF OPTIONS section to determine the proper syntax to write those addresses into the resolve.conf file. However, I don't see any mention about how to declare multiple addresses in the man page.

name_servers
Prepend name servers to the dynamically generated list. You
should set this to 127.0.0.1 if you use a local name server
other than libc.

For testing, I used the space [ ], then a comma [,] as a delimiter. For example, using the comma as the delimiter, I entered in the following for the resolvconf.conf file.

Code:
name_servers 172.16.5.1,172.16.5.2

Then, a quick run to update the resolve.conf file
resolvconf -u

To confirm the changes are working, I first output resolv.conf to see if anything was written in:
Code:
# less /etc/resolv.conf
# Generated by resolvconf
search internal.corp.domain
nameserver 172.16.5.1,172.16.5.2

Then:
ping www.google.com

Code:
# ping www.google.com
ping: cannot resolve www.google.com: Name does not resolve

When using a space, resolvconf -u gives:

Code:
# resolvconf -u
/etc/resolvconf.conf: 172.16.5.2: not found

How would I go about adding multiple addresses in this manner? Would I just have to disable resolvconf in resolvconf.conf, and instead configure them as separate lines?

Code:
resolvconf=NO

Code:
# less /etc/resolv.conf
search internal.corp.domain
nameserver 172.16.5.1
nameserver 172.16.5.2
 
It's indeed not mentioned anywhere, all the examples use a single server too.

For testing, I used the space [ ], then a comma [,] as a delimiter.
Try the same as /etc/resolv.conf by giving multiple lines:
Code:
name_servers 172.16.5.1
name_servers 172.16.5.2
 
For testing, I used the space [ ], then a comma [,] as a delimiter. For example, using the comma as the delimiter, I entered in the following for the resolvconf.conf file.

Code:
name_servers 172.16.5.1,172.16.5.2
To quote from resolvconf.conf(5):
Rich (BB code):
DESCRIPTION
     resolvconf.conf is the configuration file for resolvconf(8).  The
     resolvconf.conf file is a shell script that is sourced by resolvconf(8),
     meaning that resolvconf.conf must contain valid shell commands.  Listed
     below are the standard resolvconf.conf variables that may be set.  If the
     values contain whitespace, wildcards or other special shell characters,
     ensure they are quoted and escaped correctly.  See the replace variable
     for an example on quoting.

Try
Code:
name_servers="172.16.5.1 172.16.5.2"

There are also following variables available:
Code:
LIBC OPTIONS
     The following variables affect resolv.conf(5) directly:-

    append_nameservers
             Append name servers to the dynamically generated list.

     prepend_nameservers
             Prepend name servers to the dynamically generated list.
 
SirDice When setting resolvconf.conf with multiple lines as suggested, the following occurs when running resolvconf -u

resolvconf.conf
Code:
search_domains internal.corp.domain
name_servers 172.16.5.1
name_servers 172.16.5.2

Output
Code:
/etc/resolvconf.conf: search_domains: not found
/etc/resolvconf.conf: name_servers: not found
/etc/resolvconf.conf: name_servers: not found
[..] output repeats 7 additional times

T-Daemon I completely glazed over the first part of the man page describing resolvconf.conf as a shell script.

Aside: I didn't have search_domains added in the previous testing. I'm wondering if that also has to be quoted/escaped.

Now, I've edited resolvconf.conf to contain:
Code:
search_domains "internal.corp.domain"
name_servers "172.16.5.1 172.16.5.2"

...and the output:

Code:
/etc/resolvconf.conf: search_domains: not found
/etc/resolvconf.conf: name_servers: not found
[...] output repeats 7 additional times

So I looked into the maintainers' documentation and code to find any additional clues:
And noticed that in the Openresolv libc code, that the formatting is using spaces to separate the values for each key. It also seems that the "=" sign is used, similar to variable assignment in shell.

So I tried:
Code:
search_domains="internal.corp.domain"
name_servers="172.16.5.1 172.16.5.2"

Running resolvconf -u got no output messages.

Upon examination via less /etc/resolv.conf, I can confirm the syntax above creates what I originally expected from my first attempt in my original post.

Code:
# Generated by resolvconf
search internal.corp.domain some.other.domain
nameserver 172.16.5.1
nameserver 172.16.5.2

I have a remnant piece of another search domain still making its way in, so that I'll handle on my own.
 
Back
Top