dhclient hook not overwritten /etc/resolv.conf

Reindl Harald h.reindl at thelounge.net
Thu Dec 19 10:32:00 UTC 2019

Am 19.12.19 um 10:58 schrieb Zhengyu Pan:
> Sorry. I sent wrong mailing group.
> chattr not worked.  It prompted:
> Shutting down inteface eth0: chattr:Operation not permitted while setting flags on /etc/resolv.conf.

the opposite is true

it proves *that* it worked but waht can#t wrk i when you for whatever
reason need or believe to ned the dynamic nameservers

but that don't make sense anyways

having dozens of namservers in /etc/resolv.conf with your wished ones at
the bottom is useless because it won't be questioned at all as long the
first in teh list are responding

>> 2019年12月19日 下午5:28,Reindl Harald <h.reindl at thelounge.net> 写道:
>> Am 19.12.19 um 10:01 schrieb Zhengyu Pan:
>>> My OS is Centos7. I add a bash script dns.sh in
>>> /etc/dhcp/dhclient-exit-hooks.d . The script content is
>>> #!/bin/bash
>>> echo“nameserver1.1.1.1”>>/etc/resolv.conf
>>> I want to append a nameserver in /etc/resove.conf.
>>> However, when I restart network. /etc/resove.conf not changed.
>>> /etc/resove.conf.save append this line.
>>> Why happens that? How can I append a nameserver in /etc/resove.conf?
>> not a named qurstion at all, however
>> becasue something overwrote /etc/resolv.conf after your script which
>> maybe means your script runs way too early
>> chattr +i /etc/resove.conf under normal conditions
>> chattr -i /etc/resove.conf at the start of your script
>> chattr +i /etc/resove.conf at the end of your script
>> https://www.tecmint.com/chattr-command-examples/
>> this is a supported way to prevent resolv.conf overwritten by whatever
>> stuff running on the system, be it dhclient, networkmanager or another
>> smartass stuff which lives in a authistic world pretend to know what my
>> nameservers are

More information about the bind-users mailing list