第一步:配置网关 dns
第二步:打开CRT 安装bind
在Mnt下面创建文件夹cdrom。
[ root@localhost ~]# mkdir /mnt/cdrom
将光盘挂载到CD ROM的文件夹下。
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom
mount: /dev/sr0 写保护,将以只读方式挂载
进入源文件。
[root@localhost ~]# cd /etc/yum.repos.d/
删除所有文件。
[root@localhost yum.repos.d]# rm -rf *
编辑新文件。
[root@localhost yum.repos.d]# vim dvd.repo ### 这是本地源安装
编辑内容为。
[dvd]
name=dvd
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
编辑完保存退出。
清除缓存。
[root@localhost yum.repos.d]# yum clean all
生成缓存。
[root@localhost yum.repos.d]# yum makecache
安装DNS服务
[root@localhost yum.repos.d]# yum -y install bind
######正向解析
[root@localhost ~]# vim /etc/named.conf
把俩处localhost改成any
[root@localhost ~]# vim /etc/named.rfc1912.zones
zone "stu学号.com" IN {
type master;
file "named.stu学号.com";
allow-update { none; };
};
[root@localhost ~]# cd /var/named/
[root@localhost named]# ll
[root@localhost named]# cp -p named.localhost named.stu学号.com
[root@localhost named]# vim named.stu学号.com
$TTL 1D
@ IN SOA @ stu学号.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS dns.stu学号.com.
www IN A 192.168.学号.100
ftp IN A 192.168.学号.100
dns IN A 192.168.学号.100
[root@localhost named]# systemctl restart named
[root@localhost named]# setenforce 0
[root@localhost named]# systemctl stop firewalld.service
########反向解析
[root@localhost yum.repos.d]# vim /etc/named.rfc1912.zones
添加新代码
zone "学号.168.192.in-addr.arpa" IN {
type master;
file "named.学号.168.192";
allow-update { none; };
}; 保存退出
[root@localhost ~]# cd /var/named/
[root@localhost named]# ll
[root@localhost named]# cp -p named.loopback named.学号.168.192
[root@localhost named]# ll
[root@localhost named]# vim named.学号.168.192
$TTL 1D
@ IN SOA @ stu学号.com. (
0 ; serial
1D ; refresh
1H ; retry
1W ; expire
3H ) ; minimum
@ IN NS dns.stu学号.com.
100 IN PTR www.stu学号.com.
100 IN PTR ftp.stu学号.com.
100 IN PTR dns.stu学号.com.
[root@localhost named]# systemctl restart named
[root@localhost named]# setenforce 0
[root@localhost named]# systemctl stop firewalld.service
[root@localhost named]# nslookup
>>192.168.学号.100 ### 验证
###############出现以下代表正反向解析成功
100.学号.168.192.in-addr.arpa name = www.stu学号.com.
100.学号.168.192.in-addr.arpa name = ftp.stu学号.com.
100.学号.168.192.in-addr.arpa name = dns.stu学号.com.