linux dns服务器配置实验报告猛

Linux 服务器配置项 目 报 告 ,姓名: 班级: 专业:学号: ,一、 项目需求:根据某企业要求配置一个dns 服务器,从而达到所需要求。

Linux 服务器配置

项 目 报 告

,

姓名: 班级: 专业:

学号:

,

一、 项目需求:

根据某企业要求配置一个dns 服务器,从而达到所需要求。

二、 项目内容:

设置一个主DNS 服务器 1、实现解析 meng.com 域 2、具有邮件交换记录 3、分别解析www 、mail 、 ftp 等常用地址

三、 项目实施环境:

硬件设备:计算机一台以及RH Linux 系统安装光盘; 软件系统:RH AS Linux 5.0

虚拟机ip 地址:10.129.33.100

www 地址为:10.129.33.101

mail 地址为:10.129.33.102

ftp 地址为:10.129.33.103

Linux 主机名:meng.com

服务器所需软件包:

以及

,

基本配置文件路径:

/etc/named.conf

/etc/named.rfc1912.zones

/etc/named.caching-nameserver.conf

/var/named/chroot/var/named/localdomain.zone /var/named/chroot/var/named/named.local /var/named/chroot/var/named/meng.com.zone /var/named/chroot/var/named/33.129.10.zone

四、 实验步骤:

1. 配置环境

配置ip 地址:

,

2. 检查是否安装了bind 包:rpm - qa | grep bind

挂载系统光盘,安装:mount /dev/cdrom /media

安装bind 包: rpm – ivh bind* - -aid - -nodeps - -force 和caching-nameserver 包。

,

3. 生成主配置文件至/etc/named.conf。cp

/etc/named.caching-nameserver.conf /etc/named.conf

并作配置: vi /etc/named.conf

// named.caching-nameserver.conf

//

// Provided by Red Hat caching-nameserver package to configure the // ISC BIND named(8) DNS server as a caching only nameserver // (as a localhost DNS resolver only).

//

// See /usr/share/doc/bind*/sample/ for example named configuration files. //

// DO NOT EDIT THIS FILE - use system-config-bind or an editor // to create named.conf - edits to this file will be lost on

// caching-nameserver package upgrade.

//

options {

listen-on port 53 { any ; };

listen-on-v6 port 53 { ::1; };

directory "/var/named";

dump-file "/var/named/data/cache_dump.db"; statistics-file "/var/named/data/named_stats.txt";

memstatistics-file "/var/named/data/named_mem_stats.txt"; query-source port 53;

query-source-v6 port 53;

allow-query { any ; };

forwarders { 202.96.134.133 202.96.128.68; };

}; //此处添加的主机地址为解析外网所用的外网DNS 服务ip 地址 logging {

channel default_debug {

file "data/named.run";

severity dynamic;

};

,

};

view localhost_resolver {

match-clients { any ; };

match-destinations { any ; };

recursion yes;

include "/etc/named.rfc1912.zones";

; };

4. 修改区域配置文件,添加本地域名区域: Vi /etc/named.rfc1912.zone

// named.rfc1912.zones:

//

// Provided by Red Hat caching-nameserver package

//

// ISC BIND named zone configuration for zones recommended by // RFC 1912 section 4.1 : localhost TLDs and address zones //

// See /usr/share/doc/bind*/sample/ for example named configuration files.

//

zone "." IN {

type hint;

file "named.ca";

};

zone "localdomain" IN {

type master;

file "localdomain.zone";

allow-update { none; };

};

zone "localhost" IN {

type master;

file "localhost.zone";

allow-update { none; };

};

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

type master;

file "named.local";

,

allow-update { none; };

};

zone

"0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {

type master;

file "named.ip6.local";

allow-update { none; };

};

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

type master;

file "named.broadcast";

allow-update { none; };

};

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

type master;

file "named.zero";

allow-update { none; };

};

zone "meng.com" IN { //自己添加的正向区域 type master;

file "meng.com.zone"; //正向区域文件名

allow-update { none; };

};

zone "33.129.10.in-addr.arpa" IN { //自己添加的反向区域 type master;

file "33.129.10.zone"; //正向区域文件名

allow-update { none; };

"/etc/named.rfc1912.zones" 61L, 1144C

5. 生成正向区域文件和反向区域文件:

cp -p /var/named/chroot/var/named/localdomain.zone meng.com.zone //正向文件

,

cp -p /var/named/chroot/var/named/named.local 33.129.10.zone

6. 在生成的正向区域好反向区域文件内加入相应记录:

Vi /var/named/chroot/var/named/meng.com.zone

$TTL 86400

@ IN SOA meng.com. root .meng.com. (

42 ; serial (d. adams) 3H ; refresh 15M ; retry 1W ; expiry 1D ) ; minimum IN NS dns.meng.com.

IN MX 10 mail.meng.com. dns IN A 10.129.33.100

gw IN A 10.129.33.1

ftp IN A 10.129.33.103

www IN A 10.129.33.101 mail IN A 10.129.33.102

//反向文件

Vi /var/named/chroot/var/named/33.129.10.zone

@ IN SOA meng.com. root.meng.com. ( 1997022700 ; Serial

28800 ; Refresh

14400 ; Retry

3600000 ; Expire

86400 ) ; Minimum

IN NS dns.meng.com.

1 IN PTR gw.meng.com.

101 IN PTR www.meng.com.

102 IN PTR mail.meng.com.

103 IN PTR ftp.meng.com.

,

7. 关闭防火墙并且定制允许进入的端口,在“其他端口”一栏输入:53:tcp 53:udp

8. 开启dns 服务

/etc/init.d/named restart

9. 用nslookup 测试,

正向解析:

标签: