博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Linux_DNS服务器
阅读量:5943 次
发布时间:2019-06-19

本文共 4221 字,大约阅读时间需要 14 分钟。

目录

DNS

DNS(Domain Name System,域名系统),在Internet上作为域名和IP地址映射的一个分布式数据库,能够使用户更直观、更方便的访问互联网(域名更便于记忆),而不用去记住能够被机器直接读取的IP地址。通过主机名,最终得到该主机名对应的IP地址的过程叫做域名解析(或主机名解析)。所以DNS服务器的功能既是:域名、IP映射,DNS协议运行在UDP协议之上,使用端口号53。

hostname到IPaddress映射有两种方式
1) 静态映射,每台设备上都配置主机到IP地址的映射(hosts),各设备独立维护自己的映射表,而且只供本设备使用;
2) 动态映射,建立一套域名解析系统(DNS),只在专门的DNS服务器上配置主机到IP地址的映射,网络上需要使用主机名通信的设备,首先需要到DNS服务器查询主机所对应的IP地址。
注意:在解析域名时,可以首先采用静态域名解析的方法,如果静态域名解析不成功,再采用动态域名解析的方法。可以将一些常用的域名放入静态域名解析表中,这样可以大大提高域名解析效率。

DNS Server

ServerSite

vim named.conf

opeions {    #    listen-on port 53 { 127.0.0.1; }; #Monitoring computer IP. General Comment.    #    listen-on-v6 post 53 { ::1; };  #As above        directory     "/etc/named";  #specify directory of store domain data coinfig file        allow-query { any; };  #specify DNSServer response network segment, 'any' mean that all network segment.    };    zone "." IN {        type hint;        file "name.ca"; #record 13 root DNSServerIP    }

Master DNS Server

step1.

yum install -y bind bind-chroot

step2. Edit the config file.

vim /etc/named.conf

opeions {        #    listen-on port 53 { 127.0.0.1; }; #monitoring computer IP, General comments.        #    listen-on-v6 post 53 { ::1; }; #Idem            directory     "/etc/named";  #specify directory of store domain data coinfig file            allow-query { any; };   #specify DNSServer response network segment, any mean that all network segment.        };

Forward Domain

vim /etc/name.rf1912.zone

zone "fan.com" IN {                type master;                file "fan.com.zone";  #need create in the /var/named/fan.com.zone by manual                allow-update { none; };            };

Create zone config file:

cp -p /var/named/named.localhost /var/named/fan.com.zone

vim fan.com.zone

@        NS    hostname.domain.   #one NS flag have to mapping one A flay            hostname    A    192.168.1.144            www        A    192.168.1.145            ftp        A    192.168.1.146            @        MX    10    mail.fan.com.

Reverse Resolution

vim /etc/name.rf1912.zone

zone "1.168.192.in-addr.arpa" IN {                type master;                file "192.168.1.zone";                allow-update { none; };            };

Create zone config file:

cp -p /var/named/named.localhost /var/named/192.168.1.zone

vim 192.168.1.zone

@        NS     hostname.domain.            145        PTR  www.fan.com.            146        PTR     ftp.fan.com.

step3. Start named service

service named restart

Slave DNS Server

step1. Edit Slave dns server’s named.conf file same as master server

step2. Edit the named.rf1912.zones

Forward lookup:

vim /etc/named.rf1912.zones

zone "fan.com" IN {                type slave;                masters { MasterServerIP; };                file "slaves/fan.com.zone.slave";  #in the /var/names/slaves/ directory            };

Reverse lookup:

vim /etc/named.rf1912.zones

zone "1.168.192.in-addr.arpa" IN {                type slave;                masters { MasterServerIP; };                file "slaves/192.168.1.zone.slave";            };

step3.

service named restart

Split DNS Server

step1. Edit the DNSServer main config file

vim /etc/named.conf

#Comment the root node and line of 'include "/etc/named.rf1912.zone"'        #zone "." IN {        #       type hint;        #       file "named.ca";        #};        #include "/etc/named.rf1912.zone"

step2. Add view for public network and private network

Attention:First setting LAN then setting WAN .
vim /etc/named.conf
privateNetwork

view "lan(viewName)" {            match-clients { 1992.168.1.0/24; };   #specify split uplook domain networkSepment.            zone "fan.com" IN {       #define the uplook domain                type master;                file "fan.com.zone"                notify yes;     #allow tthe DNSServer update                also-notify { 192.168.1.2; };    #assign to the dns slave server            };        };

publicNetwork

view "wan" {            match-clients { any; };            zone "fan.com" IN {                type master;                file "fan.com.zone"            };        };

step3. Create the domain date file in directory with “/var/named” and restart named service.

转载于:https://www.cnblogs.com/jmilkfan-fanguiju/p/7533761.html

你可能感兴趣的文章
pxc群集搭建
查看>>
JS中加载cssText延时
查看>>
常用的脚本编程知识点
查看>>
XILINX_zynq_详解(6)
查看>>
计算机网络术语总结4
查看>>
新手小白 python之路 Day3 (string 常用方法)
查看>>
soapUI的简单使用(webservice接口功能测试)
查看>>
框架 Hibernate
查看>>
python-while循环
查看>>
手机端上传图片及java后台接收和ajaxForm提交
查看>>
【MSDN 目录】C#编程指南、C#教程、ASP.NET参考、ASP.NET 4、.NET Framework类库
查看>>
jquery 怎么触发select的change事件
查看>>
angularjs指令(二)
查看>>
(原創) 如何建立一个thread? (OS) (Linux) (C/C++) (C)
查看>>
<气场>读书笔记
查看>>
领域驱动设计,构建简单的新闻系统,20分钟够吗?
查看>>
web安全问题分析与防御总结
查看>>
React 组件通信之 React context
查看>>
ZooKeeper 可视化监控 zkui
查看>>
Linux下通过配置Crontab实现进程守护
查看>>