分享
 
 
 

在RHAS3上完全编译安装BIND-9.2.3

王朝other·作者佚名  2008-05-18
窄屏简体版  字體: |||超大  

安装BIND9:

# tar zxvf bind-9.2.3.tar.gz

# cd bind-9.2.3

# ./configure

--prefix=/usr/local/named

--disable-ipv6

# make

# make install

建立BIND用户:

# groupadd bind

# useradd bind -g bind -d /usr/local/named -s /sbin/nologin

创建配置文件目录:

# mkdir –p /usr/local/named/etc

# chown bind:bind /usr/local/named/etc

# chmod 700 /usr/local/named/etc

创建主要的配置文件:

# vi /usr/local/named/etc/named.conf

===========================named.conf=======================

acl "trust-lan" { 127.0.0.1/8; 192.168.0.0/16;};

options {

directory "/usr/local/named/etc/";

pid-file "/var/run/named/named.pid";

version "0.0.0";

datasize 40M;

allow-transfer {

"trust-lan";};

recursion yes;

allow-notify {

"trust-lan";

};

allow-recursion {

"trust-lan";

};

auth-nxdomain no;

forwarders {

202.99.160.68;

202.99.168.8;};

};

logging {

channel warning

{ file "/var/log/named/dns_warnings" versions 3 size 1240k;

severity warning;

print-category yes;

print-severity yes;

print-time yes;

};

channel general_dns

{ file "/var/log/named/dns_logs" versions 3 size 1240k;

severity info;

print-category yes;

print-severity yes;

print-time yes;

};

category default { warning; };

category queries { general_dns; };

};

zone "." {

type hint;

file "named.root";

};

zone "0.0.127.IN-ADDR.ARPA" {

type master;

file "localhost";

};

zone "home.com" {

type slave;

file "home.com";

masters {

192.168.0.1;

};

};

zone "0.168.192.in-addr.arpa" {

type slave;

file "0.168.192.in-addr";

masters {

192.168.0.1;

};

};

=========================named.conf==========================

# vi /usr/local/named/etc/home.com

============================ home.com ==========================

$TTL 86400

$ORIGIN home.com.

@ IN SOA redhat.home.com. root.home.com (

2001111601 ; serial

28800 ; refresh

14400 ; retry

3600000 ; expire

86400 ; default_ttl

)

IN NS redhat.home.com.

;; -- default address -

@ IN A 192.168.0.1

;; -- FreeBSD SerVer --

redhat IN A 192.168.0.1

IN MX 0 redhat.home.com.

IN MX 10 linux.home.com

IN HINFO "redhat as 3.0".

IN TXT "The internet gateway".

;; --- WIN2K SerVer ---

win2k IN A 192.168.0.10

IN MX 0 win2k.home.com.

IN MX 10 redhat.home.com.

IN HINFO "windows 2000 server".

;; ------ cnames ------

dns IN CNAME redhat

www IN CNAME redhat

mail IN CNAME redhat

ftp IN CNAME redhat

============================ home.com ==========================

# vi /usr/local/named/etc/0.168.192.in-addr

======================== 0.168.192.in-addr =====================

$TTL 86400

@ IN SOA redhat.home.com. root.home.home.com. (

2001111601 ; Serial

28800 ; refresh

14400 ; retry

3600000 ; expire

86400 ) ; minimum

@ IN NS redhat.home.com.

1 IN PTR dns.home.com.

1 IN PTR www.home.com.

1 IN PTR mail.home.com.

1 IN PTR ftp.home.com.

10 IN PTR win2k.home.com.

======================== 0.168.192.in-addr ======================

# vi /usr/local/named/etc/localhost

=========================== localhost ===========================

$TTL 3600

@ IN SOA redhat.home.com. root.home.home.com. (

20040526 ; Serial

3600 ; Refresh

900 ; Retry

3600000 ; Expire

3600 ) ; Minimum

IN NS redhat.home.com.

1 IN PTR localhost.home.com.

=========================== localhost ===========================

更新根区文件:

# cd /usr/local/named/etc/

# wget ftp://ftp.internic.org/domain/named.root

创建PID和日志文件:

# mkdir /var/run/named/

# chmod 777 /var/run/named/

# chown bind:bind /var/run/named/

# mkdir /var/log/named/

# touch /var/log/named/dns_warnings

# touch /var/log/named/dns_logs

# chown bind:bind /var/log/named/*

生成rndc-key:

# cd /usr/local/named/etc/

# ../sbin/rndc-confgen > rndc.conf

把rndc.conf中:

# Use with the following in named.conf, adjusting the allow list as needed:

后面以的部分加到/usr/local/named/etc/named.conf中并去掉注释

运行测试:

# /usr/local/named/sbin/named -gc /usr/local/named/etc/named.conf &

状态检查:

# /usr/local/named/sbin/rndc status

建立启动脚本:

# vi /etc/init.d/named

============================== named.sh============================

#!/bin/bash

#

# named a network name service.

#

#

# chkconfig: 545 35 75

# description: a name server

#

if [ `id -u` -ne 0 ]

then

echo "ERROR:For bind to port 53,must run as root."

exit 1

fi

case "$1" in

start)

if [ -x /usr/local/named/sbin/named ]; then

/usr/local/named/sbin/named -u bind -c /usr/local/named/etc/named.conf && echo . && echo 'BIND9 server started.'

fi

;;

stop)

kill `cat /var/run/named/pid` && echo . && echo 'BIND9 server stopped.'

;;

restart)

echo .

echo "Restart BIND9 server"

$0 stop

sleep 10

$0 start

;;

*)

echo "$0 start | stop | restart"

;;

esac

===============================named.sh============================

# chmod 755 /etc/init.d/named

# chown root:root /etc/init.d/named

# chkconfig -add named

# chkconfig named on

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有