首页 > 其他分享 >internet域名架构的实现

internet域名架构的实现

时间:2023-04-09 20:01:23浏览次数:42  
标签:named 架构 192.168 域名 file internet var hxg com

环境

根域 :192.168.3.109

com服务器 :192.168.3.110

hxg.com服务器 主:192.168.3.108

​ 从:192.168.3.107

apache主机(www.hxg.com):192.168.3.104

转发服务器 :192.168.3.101

本地DNS服务器: 192.168.3.102

测试客户端:192.168.3.103

配置www.hxg.com 主机

安装apache

$ yum -y install httpd

新建主页

$ echo "这个是www.hxg.com 的主机 192.168.3.104----->/val/www/html/index.html" > /var/www/html/index.html

启服务

$ systemctl start httpd

客户端测试

$ curl 192.168.3.104
这个是www.hxg.com 的主机 192.168.3.104----->/val/www/html/index.html

配置hxg.com主机主服务器

安装bind

$ yum -y install bind

修改配置文件

$ vim /etc/named.conf
options {
//      listen-on port 53 { 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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
//      allow-query     { localhost; };
        allow-transfer  {192.168.3.107;};

修改区域配置文件

$ vim /etc/named.rfc1912.zones
zone "hxg.com" IN {
        type master;
        file "hxg.com.zone";
};

新建区域数据库文件

$ cp -p  /var/named/named.localhost  /var/named/hxg.com.zone
$ vim /var/named/hxg.com.zone
$TTL 1D
@       IN SOA  master  admin  (
                                        3       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      master
        NS      ns1
master  A       192.168.3.108
ns1     A       192.168.3.107
web     A       192.168.3.104
www     CNAME   web
*       CNAME   web
@       A       192.168.3.104

检查语法

$ named-checkconf
$ named-checkzone hxg.com /var/named/hxg.com.zone 
zone hxg.com/IN: loaded serial 0
OK

启服务

$ systemctl start named

客户端测试

$ dig www.hxg.com @192.168.3.108

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.hxg.com @192.168.3.108
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39609
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hxg.com.			IN	A

;; ANSWER SECTION:
www.hxg.com.		86400	IN	CNAME	web.hxg.com.
web.hxg.com.		86400	IN	A	192.168.3.104

;; AUTHORITY SECTION:
hxg.com.		86400	IN	NS	master.hxg.com.
hxg.com.		86400	IN	NS	ns1.hxg.com.

;; ADDITIONAL SECTION:
master.hxg.com.		86400	IN	A	192.168.3.108
ns1.hxg.com.		86400	IN	A	192.168.3.107

;; Query time: 108 msec
;; SERVER: 192.168.3.108#53(192.168.3.108)
;; WHEN: 一 6月 08 18:49:20 CST 2020
;; MSG SIZE  rcvd: 145

配置hxg.com主机从服务器

安装bind

$ yum -y install bind

修改主配置文件

$ vim /etc/named.conf
options {
//      listen-on port 53 { 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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
//      allow-query     { localhost; };
        allow-transfer  {none;};

修改域配置文件

$ vim /etc/named.rfc1912.zones
zone "hxg.com" IN {
        type slave;
        masters {192.168.3.108;};
        file "slaves/hxg.com.zone";
};

启服务

$ systemctl start named

客户端测试

$ dig www.hxg.com @192.168.3.107

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.hxg.com @192.168.3.107
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2803
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hxg.com.			IN	A

;; ANSWER SECTION:
www.hxg.com.		86400	IN	CNAME	web.hxg.com.
web.hxg.com.		86400	IN	A	192.168.3.104

;; AUTHORITY SECTION:
hxg.com.		86400	IN	NS	master.hxg.com.
hxg.com.		86400	IN	NS	ns1.hxg.com.

;; ADDITIONAL SECTION:
master.hxg.com.		86400	IN	A	192.168.3.108
ns1.hxg.com.		86400	IN	A	192.168.3.107

;; Query time: 43 msec
;; SERVER: 192.168.3.107#53(192.168.3.107)
;; WHEN: 一 6月 08 18:55:56 CST 2020
;; MSG SIZE  rcvd: 145

配置com服务器

安装bind

$ yum -y install bind

修改主配置文件

$ vim /etc/named.conf
options {
//      listen-on port 53 { 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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
//      allow-query     { localhost; };
        allow-transfer  {none;};

修改区域配置文件

$ vim /etc/named.rfc1912.zones
zone "com" IN {
        type master;
        file "com.zone";
};

新建区域数据库文件

$ cp -p /var/named/named.localhost /var/named/com.zone
$ vim /var/named/com.zone
$TTL 1D
@       IN SOA  master admin (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      master
hxg     NS      ns1
hxg     NS      ns2
master  A       192.168.3.110
ns1     A       192.168.3.108
ns2     A       192.168.3.107  

启服务

$ systemctl start named

客户端测试

$ dig www.hxg.com @192.168.3.110

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.hxg.com @192.168.3.110
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 61047
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hxg.com.			IN	A

;; ANSWER SECTION:
www.hxg.com.		78108	IN	CNAME	web.hxg.com.
web.hxg.com.		78108	IN	A	192.168.3.104

;; AUTHORITY SECTION:
hxg.com.		86400	IN	NS	ns1.com.
hxg.com.		86400	IN	NS	ns2.com.

;; ADDITIONAL SECTION:
ns1.com.		86400	IN	A	192.168.3.108
ns2.com.		86400	IN	A	192.168.3.107

;; Query time: 63 msec
;; SERVER: 192.168.3.110#53(192.168.3.110)
;; WHEN: 一 6月 08 19:04:10 CST 2020
;; MSG SIZE  rcvd: 142

配置根域

安装bind

$ yum -y install bind

配置主文件

$ vim /etc/named.conf
options {
//      listen-on port 53 { 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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
//      allow-query     { localhost; };
        allow-transfer  {none;};
        
        zone "." IN {
        type master;
        file "root.zone";
};

新建区域数据库文件

$ cp -p /var/named/named.localhost /var/named/root.zone
$ vim /var/named/root.zone
$TTL 1D
@       IN SOA  root  admin  (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      root   
com     NS      ns1
root    A       192.168.3.109
ns1     A       192.168.3.110

启服务

$ systemctl start named

客户端测试

$ dig www.hxg.com @192.168.3.109

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.hxg.com @192.168.3.109
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 33607
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hxg.com.			IN	A

;; ANSWER SECTION:
www.hxg.com.		78263	IN	CNAME	web.hxg.com.
web.hxg.com.		78263	IN	A	192.168.3.104

;; AUTHORITY SECTION:
hxg.com.		78263	IN	NS	ns1.com.
hxg.com.		78263	IN	NS	ns2.com.

;; ADDITIONAL SECTION:
ns2.com.		78263	IN	A	192.168.3.107
ns1.com.		78263	IN	A	192.168.3.108

;; Query time: 47 msec
;; SERVER: 192.168.3.109#53(192.168.3.109)
;; WHEN: 一 6月 08 19:09:10 CST 2020
;; MSG SIZE  rcvd: 142

配置转发服务器

安装bind

$ yum -y install bind

修改主配置文件

$ vim /etc/named.conf
options {
//      listen-on port 53 { 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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
//      allow-query     { localhost; };

        dnssec-enable no;
        dnssec-validation no;

修改根域数据库文件

$ vim /var/named/named.ca
.                       518400  IN      NS      a.root-servers.net.
a.root-servers.net.     518400  IN      A       192.168.3.109

启服务

$ systemctl start named

客户端测试

$ dig www.hxg.com @192.168.3.101

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.hxg.com @192.168.3.101
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 40228
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hxg.com.			IN	A

;; ANSWER SECTION:
www.hxg.com.		78364	IN	CNAME	web.hxg.com.
web.hxg.com.		78364	IN	A	192.168.3.104

;; AUTHORITY SECTION:
hxg.com.		78363	IN	NS	ns2.com.
hxg.com.		78363	IN	NS	ns1.com.

;; ADDITIONAL SECTION:
ns2.com.		83787	IN	A	192.168.3.107
ns1.com.		83787	IN	A	192.168.3.108

;; Query time: 0 msec
;; SERVER: 192.168.3.101#53(192.168.3.101)
;; WHEN: 一 6月 08 19:14:47 CST 2020
;; MSG SIZE  rcvd: 142

配置本地DNS服务器

安装bind

$ yum -y install bind

配置主配置文件

$ vim /etc/named.conf
options {
//      listen-on port 53 { 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";
        recursing-file  "/var/named/data/named.recursing";
        secroots-file   "/var/named/data/named.secroots";
        allow-query     { any; };
        allow-transfer  {none;};
      	
      	forward first ;
        forwarders {192.168.3.101;};

        dnssec-enable no;
        dnssec-validation no;

启服务

$ systemctl start named

客户端测试

$ dig www.hxg.com @192.168.3.102

; <<>> DiG 9.11.4-P2-RedHat-9.11.4-9.P2.el7 <<>> www.hxg.com @192.168.3.102
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11810
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 4096
;; QUESTION SECTION:
;www.hxg.com.			IN	A

;; ANSWER SECTION:
www.hxg.com.		78136	IN	CNAME	web.hxg.com.
web.hxg.com.		78136	IN	A	192.168.3.104

;; AUTHORITY SECTION:
hxg.com.		78135	IN	NS	ns2.com.
hxg.com.		78135	IN	NS	ns1.com.

;; ADDITIONAL SECTION:
ns2.com.		83559	IN	A	192.168.3.107
ns1.com.		83559	IN	A	192.168.3.108

;; Query time: 0 msec
;; SERVER: 192.168.3.102#53(192.168.3.102)
;; WHEN: 一 6月 08 19:18:35 CST 2020
;; MSG SIZE  rcvd: 142

标签:named,架构,192.168,域名,file,internet,var,hxg,com
From: https://www.cnblogs.com/guangdelw/p/17300913.html

相关文章

  • [MAUI 项目实战] 手势控制音乐播放器(一): 概述与架构
    这是一篇系列博文。请关注我,学习更多.NETMAUI开发知识![MAUI项目实战]手势控制音乐播放器(一):概述与架构[MAUI项目实战]手势控制音乐播放器(二):手势交互[MAUI项目实战]手势控制音乐播放器(三):动画[MAUI项目实战]手势控制音乐播放器(四):圆形进度条在之前的博文中提到这个......
  • internet网络服务
                       ......
  • js异步——浅谈Chrome浏览器架构
    前言在讲述事件循环和消息队列之前,需要了解JS的单线程执行机制,JS的执行是从上到下依次执行的,这些便是同步任务,而异步操作类似于系统中断,即当前进程外部的实体(主线程之外的、宿主环境提供的、特殊的线程,如IO线程(HTTP请求)和定时器线程等)可以触发代码执行,然后在异步任务完毕后,执......
  • 分布式存储技术(下):宽表存储与全文搜索引擎的架构原理、特性、优缺点解析
    对于写密集型应用,每天写入量巨大,数据增长量无法预估,且对性能和可靠性要求非常高,普通关系型数据库无法满足其需求。对于全文搜索和数据分析这类对查询性能要求极高的场景也是如此。为了进一步满足上面两类场景的需求,有了宽表存储和搜索引擎技术,本文将对他们的架构、原理缺点做介绍。......
  • 基于TiDB Binlog架构的主备集群部署及数据同步操作手册
    作者:Liuhaoao最近手头有个系统,有需要搭建灾备库的需求(rto要求4小时内,根据实际情况计算)。考虑到生产系统是5版本,TiCDC存在一些兼容性问题,且TiDBBinlog已经有实践案例及经验可供参考,故选择使用TiDBBinlog来实现主集群-->灾备集群的增量数据同步。数据全量初始化采用Dumpling+Ti......
  • VGG16模型-tensorflow实现的架构
    importtensorflowastffromtensorflow.keras.modelsimportSequentialfromtensorflow.keras.layersimportInputLayer,Dense,Flatten,Conv2D,MaxPooling2Dfromtensorflow.keras.optimizersimportAdamdefbuild_vgg16(input_shape,num_classes):model......
  • 用Cloudflare做域名重定向
    在域名提供商处设置域名的DNS解析服务器为Cloudflare的DNS域名服务器。在DNS的Records中先为域名设置一条A记录解析,IPV4地址可以随意填写。因为后续要做定向。在Rules的PageRules中添加一条,URL为“www.yourhost.top/*”,PickaSetting为“ForwardingURL”,Selectst......
  • DNS域名系统
     DNS domainname system域名系统作用:实现域名解析,即域名和Ip的映射解析。为什么有DNS?网络中的设备(设备接口)使用IP地址标识,但是IP难于记忆。使用域名可方便表示。IP改变后,域名不变,仍可访问。域名为保障域名的唯一性以及设置域名的可行性,如何定义域名结构呢?域名,(域名空间)有两......
  • 大型互联网系统技术架构设计的4个基本要素
    作为一名大厂SRE,对什么是好产品(技术架构角度)有深刻的感悟。一个好产品的技术架构不仅在优秀的代码本身,更体现在后期的易运维性、可扩展性、高可用性上。随着用户体量、产品功能、IaaS、PaaS的变化甚至员工的离职,随时需要动态调整架构改变策略来应对各种问题,而这些场景都是对技术架......
  • openstack高可用(pike版本)-架构
    1、API服务包括*-api,neutron-server,glance-registry,nova-novncproxy,keystone,httpd等。由HAProxy提供负载均衡,将请求按照一定的算法转到某个节点上的API服务。由Pacemaker提供VIP。2、内部组件包括*-scheduler,nova-conductor,nova-cert等。它们都是无状态的,因此可以......