debian 11 设置dns 禁止覆盖

查看 28|回复 1
作者:KDE   
# 设置 DNS
rm -f /etc/resolv.conf
cat  /etc/resolv.conf
#nameserver 1.1.1.1
#nameserver 1.0.0.1
nameserver 2606:4700:4700::1111
nameserver 2606:4700:4700::1001
EOF

# 禁止修改 /etc/resolv.conf
echo 'make_resolv_conf() { :; }' > /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chmod 755 /etc/dhcp/dhclient-enter-hooks.d/leave_my_resolv_conf_alone
chattr +i /etc/resolv.conf

参考
https://wiki.debian.org/resolv.conf

conf, gt, EOF

zxxx   
支持技术大佬的技术贴
您需要登录后才可以回帖 登录 | 立即注册

返回顶部