目录

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.

Linux_DNS服务器的更多相关文章

  1. linux服务器wget无法成功解析域名及程序获取外网数据不稳定问题

    1.问题描述: 1.1 最近发现通过linux服务器wget下载远程文件经常提示无法解析域名问题,要重复多次才能成功,成功率比较低. 1.2 PHP用file_get_contents()函数获取淘宝 ...

  2. App开发:模拟服务器数据接口 - MockApi

    为了方便app开发过程中,不受服务器接口的限制,便于客户端功能的快速测试,可以在客户端实现一个模拟服务器数据接口的MockApi模块.本篇文章就尝试为使用gradle的android项目设计实现Moc ...

  3. 闰秒导致MySQL服务器的CPU sys过高

    今天,有个哥们碰到一个问题,他有一个从库,只要是启动MySQL,CPU使用率就非常高,其中sys占比也比较高,具体可见下图. 注意:他的生产环境是物理机,单个CPU,4个Core. 于是,他抓取了CP ...

  4. 闲来无聊,研究一下Web服务器 的源程序

    web服务器是如何工作的 1989年的夏天,蒂姆.博纳斯-李开发了世界上第一个web服务器和web客户机.这个浏览器程序是一个简单的电话号码查询软件.最初的web服务器程序就是一个利用浏览器和web服 ...

  5. SignalR系列续集[系列8:SignalR的性能监测与服务器的负载测试]

    目录 SignalR系列目录 前言 也是好久没写博客了,近期确实很忙,嗯..几个项目..头要炸..今天忙里偷闲.继续我们的小系列.. 先谢谢大家的支持.. 我们来聊聊SignalR的性能监测与服务器的 ...

  6. 使用 Nodejs 搭建简单的Web服务器

    使用Nodejs搭建Web服务器是学习Node.js比较全面的入门教程,因为要完成一个简单的Web服务器,你需要学习Nodejs中几个比较重要的模块,比如:http协议模块.文件系统.url解析模块. ...

  7. 通过ProGet搭建一个内部的Nuget服务器

    .NET Core项目完全使用Nuget 管理组件之间的依赖关系,Nuget已经成为.NET 生态系统中不可或缺的一个组件,从项目角度,将项目中各种组件的引用统统交给NuGet,添加组件/删除组件/以 ...

  8. 谈谈如何使用Netty开发实现高性能的RPC服务器

    RPC(Remote Procedure Call Protocol)远程过程调用协议,它是一种通过网络,从远程计算机程序上请求服务,而不必了解底层网络技术的协议.说的再直白一点,就是客户端在不必知道 ...

  9. 游戏服务器菜鸟之C#初探一游戏服务

    本人80后程序猿一枚,原来搞过C++/Java/C#,因为工作原因最后选择一直从事C#开发,因为读书时候对游戏一直比较感兴趣,机缘巧合公司做一个手游的项目,我就开始游戏服务器的折腾之旅. 游戏的构架是 ...

随机推荐

  1. wordpress添加index页面跳转链接

    1. 制作page页面 1.1 在themes下的主题目录新建一个page页面 1.2 在wordpress后台新建页面跟在目录页面中相同名字的页面文件 1.3 复制后台页面中的古定链接 1.4 在i ...

  2. github配置及使用

    安装git 对于linux系统,不同发行版本的安装方法不一样,请参考https://git-scm.com/download/linux.以ubuntu为例: sudo add-apt-reposit ...

  3. JVM 常量池、运行时常量池、字符串常量池

    常量池: 即class文件常量池,是class文件的一部分,用于保存编译时确定的数据. 保存的内容如下图: D:\java\test\out\production\test>javap -ver ...

  4. Hadoop之MapReduce 本机windows模式运行

    hadoop在windows本机运行 (1)在 windows环境下编译好的hadoop放到没有中文和空格的路径下 (2)编译好的hadoop内的hadoop.all文件要放到windows机器的wi ...

  5. Django【第8篇】:Django之查询知识点总结

    关于查询知识点总结 models.Book.objects.filter(**kwargs): querySet [obj1,obj2]models.Book.objects.filter(**kwa ...

  6. Python中的网络扫描大杀器Scapy初探

    Python中的网络扫描大杀器Scapy初探     最近经历了Twisted的打击,这个网络编程实在看不懂,都摸不透它的内在逻辑,看来网络编程不是那么好弄的.还好,看到了scapy,这种网络的大杀器 ...

  7. Apache+Mysql+PHP 套件

    Apache+Mysql+PHP 套件   最近要装个Apache+Mysql+PHP的一个环境. google下后,发现现在的安装变得越来越简单了.不再需要麻烦的配置安装,只需简单执行个sh就搞定了 ...

  8. Hive 笔试题

    Hive 笔试题 考试时间: 姓名:____________ 考试成绩:____________ 考试时长:180 分钟 注意事项: 1. 自主答题,不能参考任何除本试卷外的其它资料. 2. 总成绩共 ...

  9. 【leetcode】1155. Number of Dice Rolls With Target Sum

    题目如下: You have d dice, and each die has f faces numbered 1, 2, ..., f. Return the number of possible ...

  10. LeetCode--015--三数之和(python)

    给定一个包含 n 个整数的数组 nums,判断 nums 中是否存在三个元素 a,b,c ,使得 a + b + c = 0 ?找出所有满足条件且不重复的三元组. 先对nums进行排序,再用双指针,L ...