CentOS 7 DNS服務配置

2021-10-07 16:42:42 字數 4504 閱讀 3897

這裡已將對應的依賴關係的元件都安裝好了

進入etc資料夾中查詢named檔案

[root@localhost etc]

# ls named*

named-chroot.files named.iscdlv.key named.root.key

named.conf named.rfc1912.zones

named:

編輯named.conf檔案,將原本的監聽埠改為any

注釋logging區域

/*

logging ;}

;*/

在檔案最後新增我們的正反向解析檔案

zone "0.in-addr.arpa" in ;}

;zone "example.com" in ;}

;zone "25.168.192.in-addr.arpa" in ;}

;

將named.localhost複製出兩個檔案,分別對應正反區域檔案「example.com"和192.168.26.zone「,這樣省下了編輯soa的一些常規引數

[root@localhost named]

# cp -a named.localhost example.com

[root@localhost named]

# cp -a named.localhost 192.168.26.zone

正向檔案配置

vim example.com
$ttl 1d

@ in soa example.com. rname.invalid. (

0 ; serial

1d ; refresh

1h ; retry

1w ; expire

3h )

; minimum

@ ns master.example.com.

mater a 192.168.26.128

aaaa ::1

www cname master

ftp cname master

smtp a 192.168.26.11

mail a 192.168.26.12

@ mx 10 mail

~

反向檔案配置

vim 192.168.26.zone
$ttl 1d

@ in soa master.exmaple.com. rname.invalid. (

0 ; serial

1d ; refresh

1h ; retry

1w ; expire

3h )

; minimum

@ ns master.example.com.

128 ptr master.example.com.

11 ptr smtp.example.com.

12 ptr mail.example.com.

配置好我們的dns伺服器

vim /etc/sysconfig/network-scripts/ifcfg-ens33
type=

"ethernet"

proxy_method=

"none"

browser_only=

"no"

bootproto=

"static"

defroute=

"yes"

ipv4_failure_fatal=

"no"

ipv6init=

"yes"

ipv6_autoconf=

"yes"

ipv6_defroute=

"yes"

ipv6_failure_fatal=

"no"

ipv6_addr_gen_mode=

"stable-privacy"

name=

"ens33"

uuid=

"c5fe79f2-77d7-4431-9814-79f6646b6083"

device=

"ens33"

onboot=

"yes"

ipaddr=

"192.168.26.128"

netmask=

"255.255.255.0"

gateway=

"192.168.26.2"

dns1=

"192.168.26.128"

dns2=

"8.8.8.8"

這裡檢查一下我們的配置有沒有出錯

這裡example.com檔案出錯了,發現是master寫成來了mater,改過來之後重啟dns服務

systemctl restart named

測試前主機的dns伺服器位址記得設定成剛寫好的位址

[root@master ~]

# nslookup

> www.example.com

server: 192.168.26.128

address: 192.168.26.128#53

www.example.com canonical name = master.example.com.

name: master.example.com

address: 192.168.26.128

name: master.example.com

address: ::1

> ftp.example.com

server: 192.168.26.128

address: 192.168.26.128#53

ftp.example.com canonical name = master.example.com.

name: master.example.com

address: 192.168.26.128

name: master.example.com

address: ::1

> 192.168.128

server: 192.168.26.128

address: 192.168.26.128#53

在win2003上測試 一下,先關centos的防火牆service firewalld stop

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自動覆蓋

centos7 阿里雲ecs系統重啟後,etc resolv.conf 會被dhclient 或者networkmanager還原為預設配置 清空 1.peerdns yes no 允許 禁止 etc resolv.conf 重啟 更新網路 被覆蓋 2.當開啟networkmanager.servi...

CentOS7下配置DNS解析

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