CentOS7 9 搭建DNS伺服器

2021-10-13 23:03:28 字數 3664 閱讀 4838

centos7 搭建dns伺服器,實現區域網網域名稱訪問,內網網域名稱解析

dns服務		       192.168.199.170

vm-dev001.wowo.com 192.168.199.171

vm-dev002.wowo.com 192.168.199.172

vm-dev003.wowo.com 192.168.199.173

yum install bind
在主配置檔案中實現或主配置檔案輔助配置檔案中實現:/etc/named.conf或者/etc/named.rfc1912.zones

zone "zone_name" in ;

file "zone_name.zone";

};

# 下面新增etc/named.rfc1912.zones

zone "wowo.com" in ;

1.在/var/named/目錄下建立區域資料檔案;

[root@vm-wowo-dev0-base named]# pwd

/var/named

[root@vm-wowo-dev0-base named]# cat wowo.com.zone

$ttl 1d

@ in soa dns.wowo.com admin.wowo.com. (

123 ; serial

1d ; refresh

1h ; retry

1w ; expire

3h ) ; minimum

@ in ns dns

@ in mx 5 mail

dns in a 192.168.199.170

mail in a 192.168.199.170

www in a 192.168.199.170

vm-dev001 in a 192.168.199.171

vm-dev002 in a 192.168.199.172

vm-dev003 in a 192.168.199.173

2.修改區域檔案的許可權及屬組

[root@vm-wowo-dev0-base named]# chown :named wowo.com.zone
3.檢查配置檔案和區域檔案是否有語法錯誤

或者systemctl reload named.service

listen-on port 53 ;

下面這些都注釋掉,至於為啥不知道

// dump-file "/var/named/data/cache_dump.db";

// statistics-file "/var/named/data/named_stats.txt";

// memstatistics-file "/var/named/data/named_mem_stats.txt";

// recursing-file "/var/named/data/named.recursing";

// secroots-file "/var/named/data/named.secroots";

// allow-query ;

// dnssec-enable yes;

// dnssec-validation yes;

#啟動dns服務(說明:dns服務的守護程序為named)

[root@vm-wowo-dev0-base named]# systemctl start named.service

#將dns設為開機自啟動

[root@vm-wowo-dev0-base named]# systemctl enable named.service

#檢視dns服務的狀態

[root@vm-wowo-dev0-base named]# systemctl status named.service

#nslookup一下

[root@vm-wowo-dev001 ~]# nslookup -qt=ns vm-dev001.wowo.com

*** invalid option: qt=ns

server: 192.168.199.170

address: 192.168.199.170#53

name: vm-dev001.wowo.com

address: 192.168.199.171

[root@vm-wowo-dev0-base named]# dig -t a www.wowo.com @192.168.199.170

; <<>> dig 9.11.4-p2-redhat-9.11.4-26.p2.el7_9.3 <<>> -t a www.wowo.com @192.168.199.170

;; global options: +cmd

;; got answer:

;; ->>header<

;; flags: qr aa rd ra; query: 1, answer: 1, authority: 1, additional: 2

;; opt pseudosection:

; edns: version: 0, flags:; udp: 4096

;; question section:

//;www.wowo.com. in a

;; answer section:

www.wowo.com. 86400 in a 192.168.199.170

;; authority section:

wowo.com. 86400 in ns dns.wowo.com.

;; additional section:

dns.wowo.com. 86400 in a 192.168.199.170

;; query time: 0 msec

;; server: 192.168.199.170#53(192.168.199.170)

;; when: 二 1月 05 00:28:49 cst 2021

2021學習交流q群號:939627878

CentOS 7 9基礎命令

centos上手第一件事 一 檢視系統版本 核心版本 系統版本 cat etc redhat release 方法1.uname 命令 硬體平台 uname i 機器硬體名 uname m 節點名稱 uname n 作業系統 uname o 系統處理器的體系結構 uname p 作業系統的發行版本 ...

Centos7 9安裝Gluster儲存

操作節點為192.168.8.137 yum y install centos release gluster y yum y install glusterfs server y systemctl start glusterd.service systemctl enable glusterd....

CentOS 7 9 從原始碼安裝PyTorch

系統自帶的4.8.5的gcc不滿足編譯要求,所以需要公升級一下。我直接從原始碼編譯安裝gcc 7.5.0 tar xzf gcc 7.5.0.tar.gz cd gcc 7.5.0 mkdir build cd build configure enable languages c,c disable...