dhclient hook not overwritten /etc/resolv.conf

Zhengyu Pan(联通集团联通云数据有限公司本部) panzy16 at chinaunicom.cn
Thu Dec 19 10:41:42 UTC 2019


I  only want to prepend only a IPv6 nameserver. Other ns are added by users.

Zhengyu
Thanks.

> 2019年12月19日 下午6:32,Reindl Harald <h.reindl at thelounge.net> 写道:
>
>
>
> 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
> _______________________________________________
> Please visit https://lists.isc.org/mailman/listinfo/bind-users to unsubscribe from this list
>
> bind-users mailing list
> bind-users at lists.isc.org
> https://lists.isc.org/mailman/listinfo/bind-users

如果您错误接收了该邮件,请通过电子邮件立即通知我们。请回复邮件到 hqs-spmc at chinaunicom.cn,即可以退订此邮件。我们将立即将您的信息从我们的发送目录中删除。 If you have received this email in error please notify us immediately by e-mail. Please reply to hqs-spmc at chinaunicom.cn ,you can unsubscribe from this mail. We will immediately remove your information from send catalogue of our.


More information about the bind-users mailing list