RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
DNS设定(一)

###DNS设定###
#在开始之前先设定好网络服务环境
client设定
vim /etc/resolv.conf    ##编辑配置文件
nameserver 172.25.254.109    ##添加服务端
server设定
yum install bind -y    ##安装bind服务
systemctl status named     ##查看
rpm -qc bind
systemctl enable named    ##开机自启
systemctl start named     ##开启服务
firewall-cmd --permanent --add-service=dns   ##永久添加dns服务
firewall-cmd --reload
netstat -antulpe | grep named            ##查看开放端口
vim /etc/name.conf
 listen-on port 53 { any; };             ##设定开放端口。any表示对所有的interface都开放
 allow-query     { any; };               ##回答所有人提问
 forwarders      {172.25.254.250;};
dnssec-validation no;
systemctl restart named

目前成都创新互联公司已为近千家的企业提供了网站建设、域名、网页空间、网站托管、服务器租用、企业网站设计、沙市网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

####正向解析####
##正向解析就是将域名解析为ip
vim /etc/name.conf
##删除forwarders      {172.25.254.250;};
vim /etc/named.rfc1912.zones    ##进入配置文件
zone "westos.com" IN {
        type master;
        file "westos.com.zone";
        allow-update { none; };
};
cd /var/named/ 
cp -p named.localhost westos.com.zone  ##带权限复制
vim westos.com.zone
$TTL 1D
@       IN SOA dns.westos.com. root.westos.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      dns.westos.com.
dns     A       172.25.254.109
www     A       172.25.254.251
~
##@表示的是zone 如果不加.表示自动补充域名。
systemctl restart named                 ##重启服务


####反向解析####
vim /etc/named.rfc1912.zones
zone "254.25.172.in-addr.arpa" IN {
        type master;
        file "westos.com.ptr";
        allow-update { none; };
};

cd /var/named/
cp -p named.loopback westos.com.ptr
vim westos.com.ptr
$TTL 1D
@       IN SOA  dns.westos.com. root.westos.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      dns.westos.com.
        A       172.25.254.109
109     PTR     www.westos.com.
110     PTR     www.hello.com.
~              
####双向解析####
cd /var/named         
cp -p westos.com.zone westos.com.inter  ##加权限复制文件
vim westos.com.inter ##编辑外网配置文件
$TTL 1D
@       IN SOA dns.westos.com. root.westos.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
                NS      dns.westos.com.
dns             A       172.25.0.109
www             A       172.25.0.251
www             A       172.25.0.252
bbs             CNAME   www.westos.com.
westos.com.     MX 1    172.25.0.109
~      ##将所有的网段改为0网段
cp -p /etc/named.rfc1912.zones /etc/named.rfc1912.zones.inter
vim /etc/named.rfc1912.zones.inter
zone "westos.com" IN {
        type master;
        file "westos.com.inter";
        allow-update { none; };
};
vim /etc/named.conf     ##编辑主配置文件
/*
zone "." IN {
        type hint;
        file "named.ca";
};

include "/etc/named.rfc1912.zones";
include "/etc/named.root.key";
*/        ##注销
view localnet{
            match-clients {172.25.254.109; };
zone "." IN {
        type hint;
        file "named.ca";
};
include "/etc/named.rfc1912.zones";
};   ##添加内网客户端 (可以man 5 named.conf)
view internet{
            match-clients {any; };
zone "." IN {
        type hint;
        file "named.ca";
};
include "/etc/named.rfc1912.zones.inter";
};     ##添加外网客户端
systemctl restart named                 ##重启服务


文章标题:DNS设定(一)
分享链接:http://lswzjz.com/article/jhipoc.html