DNS之主服务器正向区域部署流程
正向区域:将域名解析为IP
搭建步骤
1)定义区域
2)编写区域解析库文件
3)添加记录
环境介绍
[root@dns ~]# cat /etc/centos-release
CentOS release 6.6 (Final)
[root@dns ~]# hostname -i
192.168.30.149
安装部署
[root@dns ~]# yum install -y bind bind-libs bind-utils
[root@dns ~]# cp /etc/named.conf{,.bak}
[root@dns ~]# vim /etc/named.conf
options {
// listen-on port 53 { 127.0.0.1; }; # 或【listen-on port 53 { 192.168.30.149; 127.0.0.1; };】
// listen-on-v6 port 53 { ::1; };
directory "/var/named";
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";
// allow-query { localhost; }; # 或【allow-query { any; };】
recursion yes;
// dnssec-enable yes;
// dnssec-validation yes;
/* Path to ISC DLV key */
// bindkeys-file "/etc/named.iscdlv.key";
// managed-keys-directory "/var/named/dynamic";
};
zone "liming.com" IN { # zone定义段亦可放置于【/etc/named.rfc1912.zones】中
type master;
file "liming.com.zone";
};
[root@dns ~]# /etc/init.d/named start
[root@dns ~]# ss -lntup4|grep named
略
[root@dns ~]# cp /var/named/named.localhost /var/named/liming.com.zone
[root@dns ~]# vim /var/named/liming.com.zone
[root@dns ~]# named-checkzone "liming.com" /var/named/liming.com.zone
[root@dns ~]# ps -ef|grep named # named的运行用户是named
略
[root@dns ~]# ll /etc/named.conf
略
[root@dns ~]# ll /var/named/named.* /var/named/liming.com.zone
略
[root@dns ~]# chown .named /var/named/liming.com.zone # 注意权限与属主属组
略
[root@dns ~]# /etc/init.d/named reload # 解析库不会立即生效,需要reload重读解析库,或者执行【/usr/sbin/rndc reload】
[root@dns ~]# rndc status # 查看状态
version: 9.8.2rc1-RedHat-9.8.2-0.62.rc1.el6_9.5
CPUs found: 1
worker threads: 1
number of zones: 19
debug level: 0
xfers running: 0
xfers deferred: 0
soa queries in progress: 0
query logging is OFF
recursive clients: 0/0/1000
tcp clients: 0/100
server is up and running
验证DNS
1、host验证
[root@dns ~]# cat /etc/resolv.conf
nameserver 192.168.30.149
[root@dns ~]# host ns1.liming.com
ns1.liming.com has address 192.168.30.149
[root@dns ~]# host mx1.liming.com
mx1.liming.com has address 192.168.30.156
[root@dns ~]# host www.liming.com
www.liming.com has address 192.168.30.158
[root@dns ~]# host bbs.liming.com
bbs.liming.com is an alias for www.liming.com.
www.liming.com has address 192.168.30.158
2、dig验证
[root@dns ~]# dig -t NS liming.com|grep ";; ANSWER SECTION:" -A 2
;; ANSWER SECTION:
liming.com. 86400 IN NS ns1.liming.com.
liming.com. 86400 IN NS ns2.liming.com.
[root@dns ~]# dig -t MX liming.com|grep ";; ANSWER SECTION:" -A 2
;; ANSWER SECTION:
liming.com. 86400 IN MX 20 mx2.liming.com.
liming.com. 86400 IN MX 10 mx1.liming.com.
[root@dns ~]# dig -t A www.liming.com|grep ";; ANSWER SECTION:" -A 1
;; ANSWER SECTION:
www.liming.com. 86400 IN A 192.168.30.158
[root@dns ~]# dig -t CNAME bbs.liming.com|grep ";; ANSWER SECTION:" -A 1
;; ANSWER SECTION:
bbs.liming.com. 86400 IN CNAME www.liming.com.
轮询调度
[root@dns ~]# vim /var/named/liming.com.zone
[root@dns ~]# /etc/init.d/named reload
[root@dns ~]# host www.liming.com
www.liming.com has address 192.168.30.200 # 此IP是真正返回的,其为位参考,以实现轮询
www.liming.com has address 192.168.30.158
www.liming.com has address 192.168.30.170
[root@dns ~]# dig -t A www.liming.com|grep ";; ANSWER SECTION:" -A 3
;; ANSWER SECTION:
www.liming.com. 86400 IN A 192.168.30.170
www.liming.com. 86400 IN A 192.168.30.200
www.liming.com. 86400 IN A 192.168.30.158
DNS轮询调度存在的问题:
1)解析结果会被缓存,导致负载不均
2)无法对主机做健康检查
泛域名解析
[root@dns ~]# dig -t A hello.liming.com|grep ";; ANSWER SECTION:"|wc -l
0
[root@dns ~]# tail -1 /var/named/liming.com.zone
* IN A 192.168.30.149
[root@dns ~]# rndc reload
[root@dns ~]# dig -t A hello.liming.com|grep ";; ANSWER SECTION:"|wc -l
1
[root@dns ~]# dig -t A hello.liming.com|grep ";; ANSWER SECTION:" -A 1
;; ANSWER SECTION:
hello.liming.com. 86400 IN A 192.168.30.149
说明:
1)泛域名解析:利用【*】来做次级域名,以实现所有的次级域名均指向同一IP地址
2)可以让域名支持无限的子域名,这也是泛域名解析最大的用途
3)防止用户错误输入导致的网站不能访问的问题
4)可以让直接输入网址登陆网站的用户输入简洁的网址即可访问网站
5)泛域名在实际使用中作用是非常广泛的,比如实现无限二级域名功能,提供免费的URL转发,在IDC部门实现自动分配免费网址,在大型企业中实现网址分类管理等等,都发挥了巨大的作用
DNS之主服务器正向区域部署流程的更多相关文章
- 架构师成长之路6.3 DNS服务器搭建(部署单台DNS)
点击返回架构师成长之路 架构师成长之路6.3 DNS服务器搭建(部署单台DNS) 1.安装bind yum -y install bind-utils bind bind-devel bind-chr ...
- Linux的DNS正向解析部署
前面介绍了DNS的作用及其相关的结果.Linux服务之DNS介绍 下面开始有关DNS的服务部署.<DNS正向解析示例> 工具:虚拟机 centos7 配置:Linux IP 192.1 ...
- dns服务器正向解析配置
DNS服务器的配置 一.安装软件 1.安装bind.bind-utils软件,起服务,设置开机启动. bind-utils软件用于提供nslookup功能,用于测试dns是否搭建成功,能够正常解析. ...
- 架构师成长之路6.4 DNS服务器搭建(部署主从DNS)
点击返回架构师成长之路 架构师成长之路6.3 DNS服务器搭建(部署主从DNS) 部署主DNS : 点击 部署从DNS : 如下步骤 1.与主DNS一样,安装bind yum -y install ...
- 使用Mybatis Generator插件自动生成映射文件(cmd无法进入文件,dns服务器对区域没有权威等问题)遇到问题
使用Mybatis Genertor插件自动生MyBatis所需要的DAO接口,实体模型类,Mapping映射文件,将生成的代码赋值到项目工程中即可. 有命令行,Eclipse插 ...
- 【配置阿里云 I】申请配置阿里云服务器,并部署IIS和开发环境,项目上线经验
https://blog.csdn.net/vapaad1/article/details/78769520 最近一年在实验室做web后端开发,涉及到一些和服务器搭建及部署上线项目的相关经验,写个帖子 ...
- CentOS6下OpenLDAP+PhpLdapAdmin基本安装及主从/主主高可用模式部署记录
下面测试的部署机ip地址为:192.168.10.2051)yum安装OpenLDAP [root@openldap-server ~]# yum install openldap openldap- ...
- 【史上最全】申请配置阿里云服务器,并部署IIS和开发环境,项目上线经验
最近一年在实验室做web后端开发,涉及到一些和服务器搭建及部署上线项目的相关经验,写个帖子和小伙伴们分享,一同进步! 首先谈一下,为什么越来越多中小型公司/实验室,部署项目的趋势都是在云服务器而不是普 ...
- Vsphere笔记06 Vcenter 部署流程 1
Vcenter 部署流程 1 一.环境需求 1.需要两台装着WIN2K8 R2 64X的服务器 2.启用一台要添加活动目录角色,并且配置DC,DC的参数如下: 域名:justech-dc. ...
随机推荐
- spring mybatis circular reference
摘要: Error creating bean with name 'XXX': Requested bean is currently in creation: Is there an unreso ...
- Retrieving data from a server
A system includes a server and a controller embedded in a device. Both the server and the embedded c ...
- 开启win10下Ubuntu子系统的SSH服务
原文:开启win10下Ubuntu子系统的SSH服务 版权声明:本文为博主原创文章,未经博主允许不得转载. http://blog.csdn.net/zhouzme https://blog.csdn ...
- 在WPF中添加3D特性
原文:在WPF中添加3D特性 35.4 在WPF中添加3D特性 本节介绍WPF中的3D特性,其中包含了开始使用该特性的信息. 提示: WPF中的3D特性在System.Windows.Media.M ...
- Haroopad 安装到 Mac OSX
打开Terminal 控制台 粘贴运行代码安装换cask: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/ ...
- 2-17-MySQL读写分离-mysql-proxy
实验环境: mysql-proxy服务端: xuegod1 IP:192.168.10.31 mysql服务器(主,负责写)服务端:xuegod2 ...
- XF 按钮控件
<?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http:/ ...
- JDK源码阅读——Vector实现
1 继承结构图 Vector同样继承自AbstractList,与ArrayList.LinedList一样,是List的一种实现 2 数据结构 // 与ArrayList一样,也是使用对象数组保存元 ...
- Delphi7程序调用C#写的DLL解决办法
近来,因工作需要,必须解决Delphi7写的主程序调用C#写的dll的问题.在网上一番搜索,又经过种种试验,最终证明有以下两种方法可行: 编写C#dll的方法都一样,首先在vs2005中创建一 ...
- 【shell】gerrit同步备份脚本的实现
本期分享下gerrit如何实现备份,由于之前的一台代码服务器直接down掉,所以为了以防万一,开始备份gerrit数据,有人说,gerrit不过是个审查代码的工具,备份这个做什么,git是分布式代码管 ...