CentOS7 dns自動覆蓋

2022-03-21 18:34:36 字數 1192 閱讀 7476

centos7 阿里雲ecs系統重啟後,/etc/resolv.conf 會被dhclient 或者networkmanager還原為預設配置/清空

1. peerdns=yes|no 允許|禁止/etc/resolv.conf 重啟/更新網路 被覆蓋

2. 當開啟networkmanager.service 時, peerdns是不生效的,通過設定dns=none解決

3. 阿里雲ecs內部服務不要開啟networkmanager, 可能導致網路不可用

系統初始化時:

1. /etc/resolv.conf template乙份

2. 通過ansible的lineinfile 只增加一行peerdns=no

系統初始化時:

1. /etc/resolv.conf template乙份

2. 通過ansible的lineinfile 只增加一行peerdns=no

- block:

- name: modify /etc/resolv.conf

template:

src: resolv.conf.j2

dest: /etc/resolv.conf

mode: 0644

owner: root

group: root

- name: install common operate utils

yum:

name: "}"

update_cache: yes

with_items: ["htop", "iftop", "nload", "iptraf", "dstat", "iotop", "screen", "hping3"]

- name: modify ifcfg-etho to forbid autoupdate dns

lineinfile:

dest: /etc/sysconfig/network-scripts/ifcfg-eth0

state: present

line: 'peerdns=no'

mode: 0644

owner: root

group: root

when: ansible_distribution == "centos"

tags: update_dns

CentOS 7 DNS服務配置

這裡已將對應的依賴關係的元件都安裝好了 進入etc資料夾中查詢named檔案 root localhost etc ls named named chroot.files named.iscdlv.key named.root.key named.conf named.rfc1912.zones n...

CentOS 7 DNS伺服器的配置

一 安裝 yum y install bind bind utils 二 修改配置檔案 主配置檔案 etc named.conf etc named.rfc1912.zones 資料庫配置檔案 var named named.alantop.com var named named.47.103.12...

CentOS7下配置DNS解析

當出現 name or service not known 錯誤時,很有可能是伺服器的dns解析沒有配置,對於centos7設定dns解析有專門的命令列工具 nmcli cat etc resolv.conf nmcli connection show nmcli con mod eth0 ipv4...