DNS解析综合学习案例实验详细代码
Posted elin989898
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了DNS解析综合学习案例实验详细代码相关的知识,希望对你有一定的参考价值。
[root@localhost ~]# fdisk -l |grep "/dev/sd*"
磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 83886079 40893440 8e Linux LVM
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 83886079 40893440 8e Linux LVM
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x5e4aae7f 创建新的 DOS 磁盘标签。
使用磁盘标识符 0x5e4aae7f 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +sizeK,M,G (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +sizeK,M,G (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):
命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”
命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”
命令(输入 m 获取帮助):p
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x5e4aae7f
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x5e4aae7f
设备 Boot Start End Blocks Id System
/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect
命令(输入 m 获取帮助):w
The partition table has been altered!
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdc
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x5b4f6ad8 创建新的 DOS 磁盘标签。
使用磁盘标识符 0x5b4f6ad8 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +sizeK,M,G (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +sizeK,M,G (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”
命令(输入 m 获取帮助):p
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x5b4f6ad8
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x5b4f6ad8
设备 Boot Start End Blocks Id System
/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect
命令(输入 m 获取帮助):w
The partition table has been altered!
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdd
欢迎使用 fdisk (util-linux 2.23.2)。
正在同步磁盘。
[root@localhost ~]# fdisk /dev/sdd
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
使用写入命令前请三思。
Device does not contain a recognized partition table
使用磁盘标识符 0x437a53c6 创建新的 DOS 磁盘标签。
使用磁盘标识符 0x437a53c6 创建新的 DOS 磁盘标签。
命令(输入 m 获取帮助):n
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +sizeK,M,G (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
Partition type:
p primary (0 primary, 0 extended, 4 free)
e extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-41943039,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +sizeK,M,G (2048-41943039,默认为 41943039):
将使用默认值 41943039
分区 1 已设置为 Linux 类型,大小设为 20 GiB
命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”
已选择分区 1
Hex 代码(输入 L 列出所有代码):fd
已将分区“Linux”的类型更改为“Linux raid autodetect”
命令(输入 m 获取帮助):p
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x437a53c6
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x437a53c6
设备 Boot Start End Blocks Id System
/dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect
命令(输入 m 获取帮助):w
The partition table has been altered!
The partition table has been altered!
Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk -l |grep "/dev/sd*"
磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 83886079 40893440 8e Linux LVM
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
/dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect
[root@localhost ~]# fdisk -l |grep "raid*"
/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect
[root@localhost ~]# pvcreate /dev/sd[bcd]1
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdc1" successfully created.
Physical volume "/dev/sdd1" successfully created.
[root@localhost ~]# pvremove /dev/sd[bcd]1
Labels on physical volume "/dev/sdb1" successfully wiped.
Labels on physical volume "/dev/sdc1" successfully wiped.
Labels on physical volume "/dev/sdd1" successfully wiped.
[root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 /dev/sd[bcd]1
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 20954112K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[root@localhost ~]# pvcreate /dev/md5
Physical volume "/dev/md5" successfully created.
[root@localhost ~]# vgcreate myvg /dev/md5
Volume group "myvg" successfully created
[root@localhost ~]# lvcreate -L 35G -n mylv myvg
Logical volume "mylv" created.
[root@localhost ~]# mkfs.ext4 /dev/myvg/mylv
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
2293760 inodes, 9175040 blocks
458752 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2157969408
280 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
正在同步磁盘。
[root@localhost ~]# fdisk -l |grep "/dev/sd*"
磁盘 /dev/sda:42.9 GB, 42949672960 字节,83886080 个扇区
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 83886079 40893440 8e Linux LVM
磁盘 /dev/sdb:21.5 GB, 21474836480 字节,41943040 个扇区
/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect
磁盘 /dev/sdc:21.5 GB, 21474836480 字节,41943040 个扇区
/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect
磁盘 /dev/sdd:21.5 GB, 21474836480 字节,41943040 个扇区
/dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect
[root@localhost ~]# fdisk -l |grep "raid*"
/dev/sdb1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdc1 2048 41943039 20970496 fd Linux raid autodetect
/dev/sdd1 2048 41943039 20970496 fd Linux raid autodetect
[root@localhost ~]# pvcreate /dev/sd[bcd]1
Physical volume "/dev/sdb1" successfully created.
Physical volume "/dev/sdc1" successfully created.
Physical volume "/dev/sdd1" successfully created.
[root@localhost ~]# pvremove /dev/sd[bcd]1
Labels on physical volume "/dev/sdb1" successfully wiped.
Labels on physical volume "/dev/sdc1" successfully wiped.
Labels on physical volume "/dev/sdd1" successfully wiped.
[root@localhost ~]# mdadm -Cv /dev/md5 -l5 -n3 /dev/sd[bcd]1
mdadm: layout defaults to left-symmetric
mdadm: layout defaults to left-symmetric
mdadm: chunk size defaults to 512K
mdadm: size set to 20954112K
mdadm: Defaulting to version 1.2 metadata
mdadm: array /dev/md5 started.
[root@localhost ~]# pvcreate /dev/md5
Physical volume "/dev/md5" successfully created.
[root@localhost ~]# vgcreate myvg /dev/md5
Volume group "myvg" successfully created
[root@localhost ~]# lvcreate -L 35G -n mylv myvg
Logical volume "mylv" created.
[root@localhost ~]# mkfs.ext4 /dev/myvg/mylv
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=128 blocks, Stripe width=256 blocks
2293760 inodes, 9175040 blocks
458752 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=2157969408
280 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@localhost ~]# mkdir -pv /usr/local/httpd/htdocs
mkdir: 已创建目录 "/usr/local/httpd"
mkdir: 已创建目录 "/usr/local/httpd/htdocs"
[root@localhost ~]# mount /dev/myvg/mylv /usr/local/httpd/htdocs/
[root@localhost ~]# mount -o remount,usrquota,grpquota /usr/local/httpd/htdocs/
[root@localhost ~]# mount | grep /usr/local/httpd/htdocs
/dev/mapper/myvg-mylv on /usr/local/httpd/htdocs type ext4 (rw,relatime,quota,usrquota,grpquota,stripe=256,data=ordered)
[root@localhost ~]# quotacheck -avug
mkdir: 已创建目录 "/usr/local/httpd"
mkdir: 已创建目录 "/usr/local/httpd/htdocs"
[root@localhost ~]# mount /dev/myvg/mylv /usr/local/httpd/htdocs/
[root@localhost ~]# mount -o remount,usrquota,grpquota /usr/local/httpd/htdocs/
[root@localhost ~]# mount | grep /usr/local/httpd/htdocs
/dev/mapper/myvg-mylv on /usr/local/httpd/htdocs type ext4 (rw,relatime,quota,usrquota,grpquota,stripe=256,data=ordered)
[root@localhost ~]# quotacheck -avug
[root@localhost ~]# rz -E
rz waiting to receive.
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg 模板 图片 下载 桌面
httpd-2.2.17.tar.gz 公共 视频 文档 音乐
[root@localhost ~]# tar xf httpd-2.2.17.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/httpd-2.2.17/
[root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd/htdocs && make && make install
[root@localhost httpd-2.2.17]# cd /usr/local/httpd/htdocs/conf/
[root@localhost conf]# cp httpd.conf,.bak
[root@localhost conf]# cd /usr/src/httpd-2.2.17/
[root@localhost httpd-2.2.17]# vi /usr/local/httpd/htdocs/conf/httpd.conf
[root@localhost httpd-2.2.17]# /usr/local/httpd/htdocs/bin/apachectl start
[root@localhost httpd-2.2.17]# yum -y install lynx
rz waiting to receive.
[root@localhost ~]# ls
anaconda-ks.cfg initial-setup-ks.cfg 模板 图片 下载 桌面
httpd-2.2.17.tar.gz 公共 视频 文档 音乐
[root@localhost ~]# tar xf httpd-2.2.17.tar.gz -C /usr/src/
[root@localhost ~]# cd /usr/src/httpd-2.2.17/
[root@localhost httpd-2.2.17]# ./configure --prefix=/usr/local/httpd/htdocs && make && make install
[root@localhost httpd-2.2.17]# cd /usr/local/httpd/htdocs/conf/
[root@localhost conf]# cp httpd.conf,.bak
[root@localhost conf]# cd /usr/src/httpd-2.2.17/
[root@localhost httpd-2.2.17]# vi /usr/local/httpd/htdocs/conf/httpd.conf
[root@localhost httpd-2.2.17]# /usr/local/httpd/htdocs/bin/apachectl start
[root@localhost httpd-2.2.17]# yum -y install lynx
[root@localhost httpd-2.2.17]# lynx 127.0.0.1
添加内容
[root@localhost ~]# vi /usr/local/httpd/htdocs/htdocs/index.html
[root@localhost ~]# lynx 192.168.116.66
添加内容
[root@localhost ~]# vi /usr/local/httpd/htdocs/htdocs/index.html
[root@localhost ~]# lynx 192.168.116.66
[root@localhost ~]# rpm -qa |grep "bind"
keybinder3-0.3.0-1.el7.x86_64
bind-utils-9.9.4-50.el7.x86_64
bind-license-9.9.4-50.el7.noarch
bind-libs-9.9.4-50.el7.x86_64
rpcbind-0.2.0-42.el7.x86_64
bind-libs-lite-9.9.4-50.el7.x86_64
[root@localhost ~]# yum -y install bind
keybinder3-0.3.0-1.el7.x86_64
bind-utils-9.9.4-50.el7.x86_64
bind-license-9.9.4-50.el7.noarch
bind-libs-9.9.4-50.el7.x86_64
rpcbind-0.2.0-42.el7.x86_64
bind-libs-lite-9.9.4-50.el7.x86_64
[root@localhost ~]# yum -y install bind
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.106.0.20
nameserver 192.168.116.10
nameserver 192.168.116.20
# Generated by NetworkManager
nameserver 202.106.0.20
nameserver 192.168.116.10
nameserver 192.168.116.20
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.116.10 ns1.study.com
192.168.116.20 ns2.study.com
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.116.10 ns1.study.com
192.168.116.20 ns2.study.com
[root@localhost ~]# cat /etc/named.conf
options
directory "/var/named";
;
zone "study.com" IN
type master;
file "elin.zheng";
allow-transfer 192.168.116.20; ;
;
zone "116.168.192.in-addr.arpa" IN
type master;
file "elin.fan";
allow-transfer 192.168.116.20; ;
;
options
directory "/var/named";
;
zone "study.com" IN
type master;
file "elin.zheng";
allow-transfer 192.168.116.20; ;
;
zone "116.168.192.in-addr.arpa" IN
type master;
file "elin.fan";
allow-transfer 192.168.116.20; ;
;
[root@localhost ~]# vim /var/named/elin.zheng
[root@localhost ~]# cat /var/named/elin.zheng
$TTL 86400
@ IN SOA study.com. admin.study.com.(
20190819
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
ns1 IN A 192.168.116.10
ns2 IN A 192.168.116.20
mail IN A 192.168.116.21
www IN A 192.168.116.22
[root@localhost ~]# vim /var/named/elin.fan
[root@localhost ~]# cat /var/named/elin.fan
$TTL 86400
@ IN SOA study.com. admin.study.com. (
20190817
3H
15M
1W
1D
)
IN NS ns1.study.com.
IN NS ns2.study.com.
IN MX 10 mail.study.com.
10 IN PTR ns1.study.com.
20 IN PTR ns2.study.com.
21 IN PTR mail.study.com.
22 IN PTR www.study.com.
[root@localhost ~]# chown :named /var/named/elin.*
[root@localhost ~]# named-checkconf -z /etc/named.conf
zone study.com/IN: loaded serial 20190819
zone 116.168.192.in-addr.arpa/IN: loaded serial 20190817
[root@localhost ~]# named-checkzone study.com /var/named/elin.zheng
zone study.com/IN: loaded serial 20190819
OK
[root@localhost ~]# named-checkzone 116.168.192.in-addr.arpa /var/named/elin.fan
zone 116.168.192.in-addr.arpa/IN: loaded serial 20190817
OK
[root@localhost ~]# systemctl start named
[root@localhost ~]#
[root@localhost ~]# named-checkconf -z /etc/named.conf
zone study.com/IN: loaded serial 20190819
zone 116.168.192.in-addr.arpa/IN: loaded serial 20190817
[root@localhost ~]# named-checkzone study.com /var/named/elin.zheng
zone study.com/IN: loaded serial 20190819
OK
[root@localhost ~]# named-checkzone 116.168.192.in-addr.arpa /var/named/elin.fan
zone 116.168.192.in-addr.arpa/IN: loaded serial 20190817
OK
[root@localhost ~]# systemctl start named
[root@localhost ~]#
从服务器
[root@localhost ~]# iptables -F
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
setenforce: SELinux is disabled
[root@localhost ~]# iptables -F
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# setenforce 0
setenforce: SELinux is disabled
[root@localhost ~]# rpm -aq | grep -w "bind"
bind-license-9.9.4-72.el7.noarch
bind-libs-lite-9.9.4-72.el7.x86_64
[root@localhost ~]# yum -y install bind bind-utils
[root@localhost ~]# vim /etc/hosts
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.116.10 ns1.study.com
192.168.116.20 ns2.study.com
[root@localhost ~]# vim /etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.106.0.20
nameserver 192.168.116.10
nameserver 192.168.116.20
bind-license-9.9.4-72.el7.noarch
bind-libs-lite-9.9.4-72.el7.x86_64
[root@localhost ~]# yum -y install bind bind-utils
[root@localhost ~]# vim /etc/hosts
[root@localhost ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.116.10 ns1.study.com
192.168.116.20 ns2.study.com
[root@localhost ~]# vim /etc/resolv.conf
[root@localhost ~]# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.106.0.20
nameserver 192.168.116.10
nameserver 192.168.116.20
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf
options
directory "/var/named";
;
zone "study.com" IN
type slave;
file "slaves/elin.zheng";
masters 192.168.116.10; ;
;
zone "116.168.192.in-addr.arpa " IN
type slave;
file "slaves/elin.zheng";
masters 192.168.116.10; ;
;
[root@localhost ~]# cat /etc/named.conf
options
directory "/var/named";
;
zone "study.com" IN
type slave;
file "slaves/elin.zheng";
masters 192.168.116.10; ;
;
zone "116.168.192.in-addr.arpa " IN
type slave;
file "slaves/elin.zheng";
masters 192.168.116.10; ;
;
[root@localhost ~]# systemctl start named
在主服务器上
[root@localhost ~]# vim /etc/named.conf
[root@localhost ~]# cat /etc/named.conf
options
listen-on port 53 192.168.116.66; ;
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/nemed_men_stats.txt";
allow-query any; ;
forwarders 202.106.0.20; ;
recursion yes;
;
zone "study.com" IN
type master;
file "elin.zheng";
allow-transfer 192.168.116.20; ;
;
zone "116.168.192.in-addr.arpa" IN
type master;
file "elin.fan";
allow-transfer 192.168.116.20; ;
;
以上是关于DNS解析综合学习案例实验详细代码的主要内容,如果未能解决你的问题,请参考以下文章