码迷,mamicode.com
首页 > 其他好文 > 详细

DNS

时间:2019-02-18 14:30:32      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:star   nts   mini   ini   emctl   开头   rfc1912   dns主从同步   dns服务器   

DNS服务器

正向解析:将域名解析成IP地址
反向解析:将IP地址解析成域名

yum install bind
named-checkconf
##############################################################################
vi /etc/named.conf
192.168.55.128 和 any

vi /etc/named.rfc1912.zones

zone "dd.com" IN {
type master;
file "dd.com.zone";
allow-update { none; };
};

zone "55.168.192.in-addr.arpa" IN {
type master;
file "dd.com.local";
allow-update { none; };
};

cd /var/named
cp -p named.localhost dd.com.zone
cp -p named.loopback dd.com.local

$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
dns A 192.168.55.128
www A 192.168.55.128
ftp A 192.168.55.128

$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
128 PTR dns.dd.com.
128 PTR www.dd.com.
128 PTR ftp.dd.com.

systemctl start named

vi /etc/resolv.conf
全删加
nameserver 192.168.55.128

##############################################################################

##############################################################################
vi /etc/named.conf
any 和 any

vi /etc/named.rfc1912.zones

zone "dd.com" IN {
type master;
file "dd.com.zone";
allow-update { none; };
};

zone "55.168.192.in-addr.arpa" IN {
type master;
file "dd.com.local";
allow-update { none; };
};

cd /var/named
cp -p named.localhost dd.com.zone
cp -p named.loopback dd.com.local

$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
dns A 192.168.55.1
www A 192.168.55.10
ftp A 192.168.55.20

$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
1 PTR dns.dd.com.
10 PTR www.dd.com.
20 PTR ftp.dd.com.

systemctl start named

vi /etc/resolv.conf
全删加
nameserver 192.168.55.1
nameserver 192.168.55.10
nameserver 192.168.55.20

##############################################################################

DNS服务器分离解析析

分离解析的DNS服务器

#主内外网卡
vi /etc/named.conf
any any

跳到52行,将下面四行删掉
zone "." IN {
type hint;
file "named.ca";
};

named-checkconf

vi /etc/named.rfc1912.zones
#zone开头的全部删掉
view "LAN" {
match-clients { 192.168.55.128/24; };
zone "dd.com" IN {
type master;
file "dd.com.zone.lan";
};
};
view "WAN" {
match-clients { any; };
zone "dd.com" IN {
type master;
file "dd.com.zone.wan";
};
};

named-checkconf
cd /var/named
cp -p named.localhost dd.com.zone.lan
cp -p named.localhost dd.com.zone.wan

vi dd.com.zone.lan
$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
www A 192.168.55.128
dns A 192.168.55.128

vi dd.com.zone.wan
$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
www A 192.168.1.128
dns A 192.168.55.128

named-checkconf

start named

win7 外网一台win7

##############################################################################
DNS主从同步服务器


named-checkconf

#主
vi /etc/named.conf
192.168.55.128 和 any

vi /etc/named.rfc1912.zones

zone "dd.com" IN {
type master;
file "dd.com.zone";
allow-update { 192.168.55.132; };
also-notify { 192.168.55.132; };
};

zone "55.168.192.in-addr.arpa" IN {
type master;
file "dd.com.local";
allow-update { 192.168.55.132; };
also-notify { 192.168.55.132; };
};

cd /var/named
cp -p named.localhost dd.com.zone
cp -p named.loopback dd.com.local

vi dd.com.zone
$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
dns A 192.168.55.128
www A 192.168.55.128
ftp A 192.168.55.128

vi dd.com.local
$TTL 1D
@ IN SOA dns.dd.com. root.dd.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
NS dns.dd.com.
128 PTR dns.dd.com.
128 PTR www.dd.com.
128 PTR ftp.dd.com.

systemctl start named

vi /etc/resolv.conf
全删加
nameserver 192.168.55.128

##############################################################################

#从
vi /etc/named.conf
192.168.55.132 和 any

vi /etc/named.rfc1912.zones
zone "dd.com" IN {
type slave;
masters { 192.168.55.128; };
file "slaves/dd.com.zone";
allow-notify { 192.168.55.128; };
};

zone "55.168.192.in-addr.arpa" IN {
type slave;
masters { 192.168.55.128; };
file "slaves/dd.com.local";
allow-notify { 192.168.55.128; };
};

vi /etc/resolv.conf
nameserver 192.168.55.128

systemctl start named
cd /var/named/slaves/ #查看是否同步了主的dd.com.zone
ls

DNS

标签:star   nts   mini   ini   emctl   开头   rfc1912   dns主从同步   dns服务器   

原文地址:https://www.cnblogs.com/feizhuanye/p/10395204.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!