Linux域名解析服務實驗報告DNS
一、搭建緩存域名服務器1. 配置ip 地址 [root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0BOOTPROTO=non
一、搭建緩存域名服務器
1. 配置ip 地址 [root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
BOOTPROTO=none
IPADDR=192.168.1.1
NETMASK=255.255.255.0
[root@localhost ~]# service network restart 重啟網(wǎng)卡
配置IP 地址
[root@localhost ~]# ifconfig eth0 查看網(wǎng)卡信息 eth0 Link encap:Ethernet HWaddr 00:0C:29:F5:12:C9
inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0
2. 查看并安裝軟件包
[root@localhost ~]# rpm -q bind
package bind is not installed (沒有安裝)
查看軟件包是否安裝
3. 安裝軟件包 [root@localhost ~]# mount /dev/cdrom /mnt 掛載光盤
mount: block device /dev/cdrom is write-protected, mounting read-only
[root@localhost ~]# vim /etc/yum.repos.d/rhel-debuginfo.repo
baseurl=file:///mnt/Server
enabled=1
安裝: [root@localhost ~]# yum -y install bind* caching-nameserver 安裝
Installing : bind-devel 1/6 Installing : bind 2/6 Installing : bind-sdb 3/6 Installing : caching-nameserver 4/6 Installing : bind-libbind-devel 5/6 Installing : bind-chroot 6/6
查看:
[root@localhost ~]# rpm -q bind 查看
bind-9.3.6-4.P1.el5_4.2
4. 配置、
方法一:
[root@localhost~]#cp -p /var/named/chroot/etc/named.caching-nameserver.conf /var/named/chroot/etc/named.conf 復制文件
方法二:
[root@localhost ~]# vim /var/named/chroot/etc/named.conf 直接編輯
,添加: options {
directory "/var/named"
};
zone "." {
type hint;
file "named.ca"
};
5. 驗證所配置語法是否正確
[root@localhost ~]# named-checkconf /var/named/chroot/etc/named.conf
(沒有任何提示說明沒有配置錯誤)
驗證
6. 重啟服務
[root@localhost ~]# service named restart 重啟
停止 named : [確定] 啟動 named : [確定]
[root@localhost ~]# netstat -anpt | grep named 驗證
7. 驗證
(需要聯(lián)網(wǎng),然后nslookup www.baidu.com 能夠解析公網(wǎng)當中的ip 地址即成功)
二、搭建主域名服務器
1. 配置
[root@localhost ~]# vim /var/named/chroot/etc/named.conf
options {
directory "/var/named";
};
zone "." {
type hint;
file "named.ca";
};
zone "benet.com" {
type master;
file "benet.com.zone"; 配置