OpenEuler-DNS多域服务器搭建

多域服务器搭建

多域服务器

复制代码
www.tech.com ------>192.168.40.146

www.hcie.com ------>192.168.40.146

server1     192.168.40.144      server1
server2     192.168.40.145      DNS Server
server3     192.168.40.146      WEB

DNS Server(server2)

1.在原有基础上新增hcie.com区域

复制代码
[root@localhost ~]# vi /etc/named.rfc1912.zones
     57 zone "hcie.com" IN {
     58         type master;
     59         file "hcie.com.zone";
     60         allow-update { none; };
     61 };

2.检查配置文件

复制代码
[root@localhost ~]# named-checkconf /etc/named.rfc1912.zones

3.修改区域配置文件

复制代码
[root@localhost ~]# cd /var/named/
[root@localhost named]# cp -p tech.com.zone hcie.com.zone
[root@localhost named]# cat hcie.com.zone  \\正向内容无需修改
$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
www     A       192.168.40.146
​
[root@localhost named]# vi 192.168.40.zone   \\反向
$TTL 1D
@       IN SOA  @ rname.invalid. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
        NS      @
        A       127.0.0.1
        AAAA    ::1
        PTR     localhost.
146     PTR     www.tech.com
146     PTR     www.hcie.com
​

4.检查配置文件

复制代码
[root@localhost named]# named-checkconf /etc/named.rfc1912.zones
[root@localhost named]# named-checkzone hcie.com /var/named/hcie.com.zone 
zone hcie.com/IN: loaded serial 0
OK
[root@localhost named]# named-checkzone hcie.com /var/named/192.168.40.zone 
zone hcie.com/IN: loaded serial 0
OK

5.重启DNS服务

复制代码
[root@localhost ~]# systemctl restart named

WEB(server3)

1.验证hcie.com区域

复制代码
[root@localhost ~]# nslookup
> www.hcie.com
Server:         192.168.40.145
Address:        192.168.40.145#53
​
Name:   www.hcie.com
Address: 192.168.40.146
​
> 192.168.40.146
146.40.168.192.in-addr.arpa     name = www.hcie.com.40.168.192.in-addr.arpa.
146.40.168.192.in-addr.arpa     name = www.tech.com.40.168.192.in-addr.arpa.

2.使用dig命令

复制代码
[root@localhost ~]# dig www.hcie.com
​
; <<>> DiG 9.16.37 <<>> www.hcie.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 2781
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
​
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1232
; COOKIE: 31154d7e2ab926c401000000669f1fb49d6392805d74f2bb (good)
;; QUESTION SECTION:
;www.hcie.com.                  IN      A
​
;; ANSWER SECTION:
www.hcie.com.           86400   IN      A       192.168.40.146
​
;; Query time: 0 msec
;; SERVER: 192.168.40.145#53(192.168.40.145)
;; WHEN: Tue Jul 23 11:12:52 CST 2024
;; MSG SIZE  rcvd: 85

3.使用curl命令验证

复制代码
[root@localhost ~]# curl www.hcie.com
hello DNS
[root@localhost ~]# curl www.tech.com
hello DNS
相关推荐
Trouvaille ~12 小时前
【Linux】进程等待与资源回收:父进程的责任
linux·运维·服务器·进程等待·进程退出·非阻塞与阻塞·资源回收
木子欢儿12 小时前
Ubuntu24.04 安装rime中文输入法
linux·运维·服务器
gf132111112 小时前
python_基于主视频删减片段并插入镜头视频
linux·python·音视频
liuwei20000012 小时前
Ubuntu 22.04 安装 ROS 2 Humble
linux·运维·ubuntu
YJlio12 小时前
Active Directory 工具学习笔记(10.14):第十章·实战脚本包——AdExplorer/AdInsight/AdRestore 一键化落地
服务器·笔记·学习
Logic10112 小时前
《数据库运维》 郭文明 实验4 数据库备份与恢复实验核心操作与思路解析
运维·数据库·sql·mysql·学习笔记·形考作业·国家开放大学
物联网心球12 小时前
从ext4文件系统到Linux文件树
linux·linux内核·文件系统
winner888112 小时前
深入理解 find 与 grep 路径参数位置差异:Unix 哲学下的设计逻辑
服务器·unix
ℳ₯㎕ddzོꦿ࿐13 小时前
先立后破:Linux 下“新建管理员 → 验证 → 禁用 root 远程 SSH”的零翻车笔记
linux·笔记·ssh
郁大锤13 小时前
解决Ubuntu/Linux/Gnome 打开文件慢,使用chrome打开文件更慢/卡死问题
linux·ubuntu·卡顿