dhclient hook not overwritten /etc/resolv.conf

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


Thanks.
I have tried append prepend and supersede option. They are ok for ipv4 name server. But It doesn’t work for ipv6 name server.

Zhengyu

2019年12月19日 下午6:16,Philippe Maechler <pmaechler-ml at glattnet.ch<mailto:pmaechler-ml at glattnet.ch>> 写道:

Hi Zhengyu Pan

Have you tried to put this nameserver address in dhclient.conf?

From man dhclient.conf
     append { [option declaration] [, ... option declaration] }
             If for some set of options the client should first use the values
             supplied by the server, if any, and then use values you supply,
             these values can be defined in the append statement.  The append
             statement can only be used for options which allow more than one
             value to be given.  This restriction is not enforced - if you
             ignore it, the behaviour will be unpredictable.

I haven’t use the ap- or prepend options, but the supersede option work like a charm (at least on FreeBSD)

/BR
Philippe

From: bind-users <bind-users-bounces at lists.isc.org<mailto:bind-users-bounces at lists.isc.org>> On Behalf Of Zhengyu Pan(???????????????)
Sent: Thursday, December 19, 2019 10:01 AM
To: bind-users at lists.isc.org<mailto:bind-users at lists.isc.org>
Subject: dhclient hook not overwritten /etc/resolv.conf

Hi,


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 “nameserver 1.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?


Zhengyu
Best Wishes
如果您错误接收了该邮件,请通过电子邮件立即通知我们。请回复邮件到 hqs-spmc at chinaunicom.cn,即可以退订此邮件。我们将立即将您的信息从我们的发送目录中删除<mailto:hqs-spmc at chinaunicom.cn%EF%BC%8C%E5%8D%B3%E5%8F%AF%E4%BB%A5%E9%80%80%E8%AE%A2%E6%AD%A4%E9%82%AE%E4%BB%B6%E3%80%82%E6%88%91%E4%BB%AC%E5%B0%86%E7%AB%8B%E5%8D%B3%E5%B0%86%E6%82%A8%E7%9A%84%E4%BF%A1%E6%81%AF%E4%BB%8E%E6%88%91%E4%BB%AC%E7%9A%84%E5%8F%91%E9%80%81%E7%9B%AE%E5%BD%95%E4%B8%AD%E5%88%A0%E9%99%A4>。 If you have received this email in error please notify us immediately by e-mail. Please reply to hqs-spmc at chinaunicom.cn<mailto:hqs-spmc at chinaunicom.cn> ,you can unsubscribe from this mail. We will immediately remove your information from send catalogue of our.

如果您错误接收了该邮件,请通过电子邮件立即通知我们。请回复邮件到 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20191219/3459015f/attachment-0001.htm>


More information about the bind-users mailing list