Linux--DNS服务--分离解析实验

Linux–DNS服务–分离解析

一、实验环境

第一台机器简称主机1,操作系统是centOS7.6,两个网卡,地址分别为:12.0.0.1和192.168.100.1;

第二台机器简称主机2,操作系统是centOS7.6,地址为:192.168.100.100;

第三台机器简称win10,操作系统是win10,地址为:12.0.0.100;

注:所有机器采用仅主机网络模式

二 : 实验步骤

2.1主机1分离解析配置(centos7.6)

2.1.1安装dns服务软件

yum -y install bind

[root@localhost ~]# yum -y install bind
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile

  • base: mirrors.163.com
  • extras: mirrors.163.com
  • updates: mirrors.163.com
    base | 3.6 kB 00:00:00
    ^Chttp://mirrors.ustc.edu.cn/centos/7.8.2003/extras/x86_64/repodata/repomd.xml: [Errno 14] curl#56 - “Callback aborted”
    正在尝试其它镜像。
    extras | 2.9 kB 00:00:00
    updates | 2.9 kB 00:00:00
    软件包 32:bind-9.11.4-16.P2.el7_8.6.x86_64 已安装并且是最新版本



#### 2.1.2 再添加一个网卡,将网卡都设置为仅主机模式



![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzEwMjExNDg1OC5wbmc?x-oss-process=image/format,png)

网卡添加成功

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzEwMjQxNDk5OS5wbmc?x-oss-process=image/format,png)

新添加的网卡还没有地址,需要自行设置

#### 2.1.3编辑ens33网卡

vim /etc/sysconfig/network-scripts/ifcfg-ens33

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzEwMzUxOTgyOS5wbmc?x-oss-process=image/format,png)

#### 2.1.4编辑ens36网卡

首先将ens33配置文件复制到ens36(方便编辑)

cp  -p  /etc/sysconfig/network-scripts/ifcfg-ens33   /etc/sysconfig/network-scripts/ifcfg-ens36

编辑网卡

vim  /etc/sysconfig/network-scripts/ifcfg-ens36

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzEwNDUzODY1Ni5wbmc?x-oss-process=image/format,png)

#### 2.1.5重启网卡

[root@localhost ~]# systemctl restart network
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 12.0.0.1 netmask 255.255.255.0 broadcast 12.0.0.255
inet6 fe80::4692:cf70:d003:ced4 prefixlen 64 scopeid 0x20
ether 00:0c:29:a3:3d:85 txqueuelen 1000 (Ethernet)
RX packets 4989 bytes 411021 (401.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1746 bytes 142212 (138.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

ens36: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.1 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::fedd:4dbd:89ae:c217 prefixlen 64 scopeid 0x20
ether 00:0c:29:9b:e6:a8 txqueuelen 1000 (Ethernet)
RX packets 295 bytes 31106 (30.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 274 bytes 44602 (43.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0


### 2.1.7 配置允许数据包转发

vim /etc/sysctl.conf

net.ipv4.ip_forward=1

![mark](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/110937070.png)

让配置文件立刻生效
[root@localhost ~]# sysctl -p
net.ipv4.ip_forward = 1

### 2.1.8修改主配置文件



vim  /etc/named.conf

![](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/112929000.png)

删除主配置文件根域解析

![mark](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/113238419.png)



#### 2.1.9编辑区域配置文件

vim /etc/named.rfc1912.zones

![mark](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/115722923.png)

#### 2.1.10编辑区域数据文件

1)将区域数据配置文件模板 named.localhost 分别复制到 kgc.com.lan       kgc.com.wan

[root@localhost named]# cp -p named.localhost kgc.com.lan
[root@localhost named]# cp -p named.localhost kgc.com.wan


2)vim  kgc.com.lan       ##编辑文件

![mark](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/141359212.png)

vim  kgc.com.wan     

![mark](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/141745649.png)

#### 2.1.11重启服务,关闭防火墙

[root@localhost named]# systemctl restart named
[root@localhost named]# systemctl stop firewalld
[root@localhost named]# iptables -F




### 2.2主机2配置(centos7.6)

#### 2.2.1网卡配置

[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-ens33

![mark](http://liudongliang.oss-cn-beijing.aliyuncs.com/img/20200712/105408406.png)

#### 2.2.2重启网卡

[root@localhost ~]# systemctl restart network
[root@localhost ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.100 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::6330:483:2f64:dd8e prefixlen 64 scopeid 0x20
ether 00:0c:29:26:d1:1b txqueuelen 1000 (Ethernet)
RX packets 28202 bytes 26161594 (24.9 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6110 bytes 433603 (423.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 443 bytes 45187 (44.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 443 bytes 45187 (44.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0






### 2.3主机3配置(win10)

#### 2.3.1选择仅主机模式

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzExMDAxMTUzMS5wbmc?x-oss-process=image/format,png)

#### 2.3.2配置网卡信息

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzExMDQ0NTM3Ny5wbmc?x-oss-process=image/format,png)

## 三:验证

外网win10

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzE1NDAzODMzMC5wbmc?x-oss-process=image/format,png)

内网centos7.6

## 2.3.1选择仅主机模式

[外链图片转存中...(img-oVryYwmp-1594540461951)]

#### 2.3.2配置网卡信息

[外链图片转存中...(img-ZOUDSnXP-1594540461952)]

## 三:验证

外网win10

[外链图片转存中...(img-m0gw5ACz-1594540461953)]

内网centos7.6

![mark](https://imgconvert.csdnimg.cn/aHR0cDovL2xpdWRvbmdsaWFuZy5vc3MtY24tYmVpamluZy5hbGl5dW5jcy5jb20vaW1nLzIwMjAwNzEyLzE1NDE0MDgyMC5wbmc?x-oss-process=image/format,png)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值