1. vim /etc/sysconfig/network-scripts/ifcfg-eth0 //

DEVICE=eth0

BOOTPROTO=none

HWADDR=00:0c:29:8f:47:5e

MTU=1500

NM_CONTROLLED=yes

ONBOOT=yes

IPADDR=192.168.1.170

NETMASK=255.255.255.0

TYPE=Ethernet

GATEWAY=192.168.1.1

DNS1=192.168.1.170//dns设置为本机的ip地址

IPV6INIT=no

USERCTL=no

2. /etc/hosts

//hosts 文件如下

127.0.0.1 localhost.localdomain localhost

::1 localhost6.localdomain6 localhost6

192.168.1.170 www.test.com www //添加这一行

3. vim /etc/sysconfig/network // 修改主机名

NETWORKING=yes

HOSTNAME=www.test.com //主机名修改为www.test.com

4. vim /etc/resolv.conf //

# Generated by NetworkManager

nameserver 192.168.1.1

5. service network restart// 重新启动网络服务


6.插入光盘// mount /dev/cdrom /yum/ //如果没有yum目录的话,请mkdir /yum 再挂载。

7. 安装一下的包:

rpm -ivh bind-9.7.0-5.P2.el6.i686.rpm

rpm -ivh bind-libs-9.7.0-5.P2.el6.i686.rpm

rpm -ivh bind-dyndb-ldap-0.1.0-0.9.b.el6.i686.rpm

rpm -ivh bind-utils-9.7.0-5.P2.el6.i686.rpm

rpm -ivh bind-chroot-9.7.0-5.P2.el6.i686.rpm

8.vim /etc/name.conf //

listen-on port 53 { 192.168.1.170; };//原来127.0.0.1

# listen-on-v6 port 53 { ::1; };//加上#把他注释掉

allow-query { any; };//原来为localhost后改为any

9. vim /etc/named.rfc1912.zones //编辑这个文件

添加以下代码:

zone "test.com" IN{

type master;

file "test.zone";

allow-update{ none; };

};

zone "1.168.192.in-addr.arpa" IN{

type master;

file "reverse.zone";

allow-update { none; };

};

9. vim /etc/named.rfc1912.zones //编辑这个文件

添加以下代码:

zone "test.com" IN{

type master;

file "test.zone";

allow-update{ none; };

};

zone "1.168.192.in-addr.arpa" IN{

type master;

file "reverse.zone";

allow-update { none; };

};


redhat 6.0 dns 配置_configuration



cd /var/named/ //进入目录执行这两天命令

cp named.localhost test.zone

cp named.loopback reverse.zone

11. vim test.zone 修改如下://(修改完之后记得:wq保存退出!)

redhat 6.0 dns 配置_dns_02



12执行以下命令:

vim reverse.zone //(修改完之后记得:wq保存退出!)

redhat 6.0 dns 配置_redhat_03



[root@localhost named]# chgrp named test.zone

[root@localhost named]# chgrp named reverse.zone //如图:


redhat 6.0 dns 配置_redhat_04


redhat 6.0 dns 配置_redhat_05




最后就是测试:

[root@localhost named]# dig www.test.com //测试正向解析

redhat 6.0 dns 配置_configuration_06

redhat 6.0 dns 配置_dns_07



大功告成!