unable to add multiple NameServer in resolv.conf, after restart lose the changes

Unable to add multiple NameServer in resolv.conf, after restart lose the changes, I am using OpenSuse Leap 42.2 with Gnome Desktop

Add them in Yast:


sudo /sbin/yast lan

Under Hostname (or something like that) add the multiple servers (up to
three) and that should persist.


Good luck.

If you find this post helpful and are logged into the web interface,
show your appreciation and click on the star below…

On Wed 01 Feb 2017 03:26:41 AM CST, ab wrote:

Add them in Yast:

sudo /sbin/yast lan

Under Hostname (or something like that) add the multiple servers (up to
three) and that should persist.

Hi
Or if using NetworkManager, add them via the network icon in
system settings settings wired or wifi…


Cheers Malcolm °¿° SUSE Knowledge Partner (Linux Counter #276890)
openSUSE Leap 42.1|GNOME 3.16.2|4.1.36-44-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Or,
Follow the instructions in the comments embedded in /etc/resolv.conf

Editing the file manually works only for the existing session and will be lost on reboot.

TSU

Thank you ab,

Following your recomendation then Name Servers and Domain Search List are not enabled to edit.

Hello Tsu2,

Thats my problem, I need to add up 8 name servers or dns suffix

So, have you read the comment in the file as tsu2 suggested?

# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''

That’s from 13.2, but I doubt there have been big changes.

Thank’s for tsu2 and wolfi323 for your recommendatios.

I just set NETCONFIG_DNS_POLICY=“” and type my own search servers in /etc/resolv.conf, as soon as I saved the changes and reload Network Manager my changes works, but when I restarted my machine, the resolv.conf change gone and NETCONFIG_DNS_POLICY=“” persist in /etc/sysconfig/network/config.

Hm, that would sound like a bug.
I just had a look at the 42.2 package, and that option is still there.

Just to be sure though: there is also a NETCONFIG_FORCE_REPLACE option, I hope this is not set to “yes”?

And: Have you tried the other way?
I.e. adding your servers to NETCONFIG_DNS_STATIC_SERVERS in /etc/sysconfig/network/config …
I’m not sure of the correct syntax, but “man 8 netconfig” should tell.

I just ran a test modifying the following line in

/etc/sysconfig/network/config

NETCONFIG_DNS_STATIC_SERVERS=""

as follows

NETCONFIG_DNS_STATIC_SERVERS="10.88.88.2 192.168.1.1 8.8.8.8"

Then, rebooted the machine and inspected the contents

cat /etc/resolv.conf

All the DNS servers I specified are there.

TSU

Read the MAN pages for netconfig as suggested in the resolv.conf comments.

Depending on whether you are using Network Manager or not, when you change the NETCONFIG_DNS_POLICY, the result is different(In fact, the MAN pages say you should use NM, not declare your DNS servers elsewhere. The main effect changing policy modifies merging).
If you just want to avoid that complexity, you should not modify the policy, just set your DNS servers as I described in my previous post.

TSU

Tsu2, I am really appreciate your time and responses, thank you very much, I am a newbie in Opensuse Linux world.

Maybe I made a mistake when posting my doubt, I will follow your new recommendations, what’s is my goal, in our organization additional to our DNS server, we need to specify multiple DNS suffix like resort1.local, anotherresort.local, etc…

when I modify resolv.conf results:
search resort1.local
search anotherresort.local
name server 10.1.1.1
name server 10.2.2.2

Thats is my goal, to be able to add those dns suffix.

Regards.

Hi Wolfi323, thak you for your response, yes I reviewed, and the option mentioned is set to NO.

Regards.

I can’t remember when I’ve last configured that, personally.

But…
Take a look at the netconfig MAN pages, you may be able to define that in the option

NETCONFIG_DNS_STATIC_SEARCHLIST=""

This is also described in a SUSE blog at the following address (You may want to skim the article and skip down to the “Summary”)

TSU

TSU, yes I understand, I will read blog and try to modify as your recommendation.

Best Regards.

Thank you again TSU, well, I Followed the blog steps without success, I am near to give up, but I not mentioned one fact, I am using a VirtualBox VM to test Opensuse Leap 42.2 gnome.

I set DNS_POLICY to “”, then populate the related variables in Config File for NAME SERVERS y SEARCH_LIST, then restart and nothing happen.

Also when I go to Yast -> Network Config -> Domain Search and Name Server are disabled.

Why, maybe because is a Virtual Box VM?

I deleted my VM I will try with Leap 42.2 with KDE.

Best regards!!!

Well, that cannot work.
As already explained, DNS_POLICY=“” means that /etc/resolv.conf is not touched at all. The comment in the config file itself says:

Set to “” to disable DNS configuration.

If you want a resolv.conf to be generated from the the NETCONFIG_DNS_STATIC_SERVERS and NETCONFIG_DNS_STATIC_SEARCHLIST values in /etc/sysconfig/network/config, you need to set DNS_POLICY=“auto” (the default).

Also when I go to Yast -> Network Config -> Domain Search and Name Server are disabled.

Why, maybe because is a Virtual Box VM?

No, rather because you use NetworkManager I suppose.
Switch to Wicked, and everything should work as intended.
I’m not sure if NetworkManager respects /etc/sysconfig/network/config.

I deleted my VM I will try with Leap 42.2 with KDE.

Why do you think switching from GNOME to KDE makes a difference?
That’s lower level stuff.

FYI,

https://www.redhat.com/archives/rhl-list/2008-March/msg00841.html

https://serverfault.com/questions/215882/number-of-nameserver-entries-in-resolv-conf

grep MAXNS /usr/include/resolv.h

define MAXNS 3 /* max # name servers we’ll track */

AK

Never attribute to malice that which can be adequately explained by stupidity.
(R.J. Hanlon)

Hi Wolfi323,

I just finished installing OpenSuse Leap 42.2 and reviewing the Connection Editor -> Wired Connection 1 -> IPv4, the dialog shows to me the option to captue Search Domains, Other DNS Servers, this functionality from end user point of view makes the difference, we are reviewing Linux distros, because we are planning to migrate from Windows 8.1 to Linux.

I will open again OpenSuse VM to follow your recommendations again.

I am really appreciate your guidance.

I will post the results for my tests.

Regards.

Hi wolfi323,

I just captured my dns suffix in Edit Connection -> IPv4 -> Search Domains…Restart the machine and resolv.conf conserved the changes, why in KDE works and GNOME no?.

Also /etc/sysconfig/network/config file was not touched at all.

In Yast -> Network Settings -> HostName/DNS -> Modify DNS configuration is disabled and has Use Default Policy, Current Policy Rule is disabled and has empty value, Name Servers and Domain Search List are disabled.

The point is…works as we pretend to use.

Why GNOME no, KDE yes?(It is a retoric question)

Regards.