• RSS订阅
  • 交换链接
  • WAP首页
  • 首页

Jeffrey’s Blog

Web&P2P架构及优化


bind架设策略DNS,使南北方用户自动访问较快的服务器。

July 17th, 2006

##2006/07/17 初稿
##20080409, 更新为bind9.4.2版配置,并增加master/slave配置
##20080425,更正view环境下从服务器同步不成功原因

主要实现:电信的用户访问电信的服务器,网通用户访问网通的服务器.(当然服务器都有托管相应机房)
1. 安装
下载 http://www.isc.org/products/BIND/
./configure –enable-threads –prefix=/app/bind-9.4.2 && make && make install
cd /app && ln -s bind-9.4.2/ bind
mkdir /app/bind/etc/named && cd /app/bind/etc/named && wget ftp://ftp.internic.org/domain/named.root

# groupadd bind
# useradd -g bind -d /app/bind-9.4.2 -s /sbin/nologin bind
# chown bind:bind /app/bind-9.4.2 -R

2. 配置
sbin/rndc-confgen > etc/rndc.conf
tail -10 etc/rndc.conf|head -9|sed s/#\//g > etc/named.conf
vi named.conf #主DNS服务器

key “rndc-key” {
algorithm hmac-md5;
secret “xxxxxxxxxxxxxxx”;
};

controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { “rndc-key”; };
};

acl “trust-lan” {
127.0.0.1/8; xx.xx.xx.xx/32; xx.xx.xx.xx/32; xx.xx.xx.xx/32;
};

options {
directory “/app/bind/etc/named”;
pid-file “/app/bind/var/run/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.106.0.20;
202.106.196.115;};
};

logging {

channel warning
{ file “/app/bind/var/logs/dns_warnings” versions 3 size 1240k;
severity warning;
print-category yes;
print-severity yes;
print-time yes;
};

channel general_dns
{ file “/app/bind/var/logs/dns_logs” versions 3 size 1240k;
severity info;
print-category yes;
print-severity yes;
print-time yes;
};

category default { warning; };
category queries { general_dns; };
};

### KEYS FOR TSIG ####
key telkey {
algorithm hmac-md5;
secret “xxxxxxxxxx”;
};

key cnckey {
algorithm hmac-md5;
secret “xxxxxxxxxxx”;
};

key anykey {
algorithm hmac-md5;
secret “xxxxxxxxxxxx”;
};

### CNC TEL EDU IP DEFINE ##
include “acl-tel.conf”;
include “acl-cnc.conf”;
#include “acl-edu.conf”;

### view list###
view “view_tel” IN {
match-clients { key “telkey”; tel; };
allow-transfer { key “telkey”; };
server 11.11.11.11 { keys telkey; };
server 22.22.22.22 { keys “telkey”; };
include “def/tel.def”;
};

view “view_cnc” IN {
match-clients { key “cnckey”; cnc; };
allow-transfer { key “cnckey”; };
server 11.11.11.11 { keys “cnckey”; };
server 22.22.22.22 { keys “cnckey”; };
include “def/cnc.def”;
};

view “view_any” IN {
match-clients { key anykey; any; };
allow-transfer { key anykey; };
server 11.11.11.11 { keys anykey; };
server 22.22.22.22 { keys anykey; };
include “def/other.def”;
};

named.conf ##从DNS服务器
server 主DNSIP { keys “telkey”; }; #就改server 11.11.11.11 { keys …; }; 就行就可以了

3.编辑网通电信IP地址段列表
#需要将从DNS服务器的IP地址去掉,不然无法同步
vi acl-cnc.conf
acl “CNC” {
#此处添加网通IP地址段;见下面附件;
};
vi acl-telecom.conf
acl “telecom” {
#此处添加电信IP地址段;见下面附件;
};

附一些配置文件
1) cat named.127.0.0
$TTL 600
@ IN SOA localhost. root.localhost. (
20080228 ;serial
28800 ;refresh
14400 ;retry
720000 ;expire
86400 ;minium
)
@ IN NS localhost.
1 IN PTR localhost.

2) cat named.localhost
$TTL 600
@ IN SOA localhost. root.localhost. (
20080228 ;serial
28800 ;refresh
14400 ;retry
720000 ;expire
86400 ;minimum
)

@ IN NS localhost.
localhost. IN A 127.0.0.1

3) 主DNS cnc.def
zone “zhangjianfeng.com” {
type master;
file “def/cnc/zhangjianfeng.com.zone”;
};

4) 从DNS cnc.def
zone “zhangjianfeng.com” {
type slave;
masters { xx.xx.xx.xx; };
file “def/cnc/zhangjianfeng.com.zone”;
};5) cnc/zhangjianfeng.com.zone
$TTL 3600
$ORIGIN zhangjianfeng.com.
@ IN SOA ns.zhangjianfeng.com. root.zhangjianfeng.com. (
20060720;
3600;
900;
68400;
15);
;
@ IN NS ns.zhangjianfeng.com
@ IN A 202.111.1.1
;; 上面指ping zhangjianfeng.com 为202.111.1.1
www IN A 202.111.11.11
* IN A 22.22.22.22
; “上面一行是泛域名指定 其它:
++如需要开机自动启动,把/usr/local/named/sbin/named -u bind加到/etc/rc.local
++常用命令
rndc status 显示named工作状态
rndc querylog 打开/关闭querylog,默认为关闭,打开后,客户机的所有DNS查询都记录在/var/log/message.(上面的配置已经打开并配置了querylog)
++key产生办法
sbin/dnssec-keygen -a HMAC-MD5 -b 128 -n HOST cnc
然后取出xxx.key文件中的最后一列即可BIND 下载 http://www.isc.org/products/BIND/
最新的named.root下载 ftp://ftp.internic.org/domain/named.root
网通IP地址段(参考):cnc.txt
电信IP地址段(参考):telecom.txt
电信IP地址段(参考):edu-ip.txt
DNS网通电信互通解决方案 DNS-cnc-telecom.txt
自动生成最新的网通/电信IP地址段的脚本: cn_isp.sh

Last modified at: Friday, April 25th, 2008 07:30:38 pm
Trackback URL: http://blog.zhangjianfeng.com/article/355/trackback

给本文打分: 1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...
Tags: BIND, 南北方用户, 服务器。, 策略DNS
2006/07/17 | 阅读全文 | 应用服务 | Email This Post | Print This Post | 1,926 views |
收藏到网摘: Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

Related Post

  • DNS与BIND学习笔记

1 Response to “bind架设策略DNS,使南北方用户自动访问较快的服务器。”


  1. 1jackbillow

    写的不错,兄弟.

    Comment on Jun 4th, 2007 at 6:00 pm  

Leave a Reply

  • :em04:
  • :em18:
  • :em17:
  • :em10:
  • :em01:
  • :em05:
  • :em15:
  • :em07:
  • :em03:
  • :em13:
  • :em09:
  • :em12:
  • :em11:
  • :em06:
  • :em16:
  • :em14:
  • :em02:
  • :em08:

« 简单的备份脚本
Argument list too long错误 »

    最新文章

    • CRIonline实用英语课堂学习笔记
    • Linux SNMP OID’s for CPU,Memory and Disk Statistics
    • lighttpd+mod_flv_streaming+flowplayer实现拖动播放/推荐FLV
    • 英语写作必背200句
    • MySQL 服务器调优[zt]
    • 简单iscsi网络存储服务器的配置笔记
    • Subversion的用户自助修改口令实现(linux测试通过)
    • SLES10-SP1+Apache-2.0.63+SVN-1.4.6安装配置笔记
    • [音乐欣赏]A place nearby
    • 不错的firefox插件---鼠标手势mouse gestures

    评分最高文章

      • 今天下载的一个CHM文件,打开时右边的内容看不到,提示“该页无法显示”。
      • linux日志服务器配置笔记
      • Legato networker学习笔记(杂)
      • linux tips 技巧笔记
      • [BT下载]2006韩剧-葡萄园的那小伙儿
      • 我家的金吉拉
      • 卡巴斯基病毒库离线更新方法
      • 忽悠姐妹花主题曲下载
      • 轻轻松松把 Apache 配置安全
      • 北京IDC机房介绍

    随机文章:

    • Wordpress 2.3 升级指南[转]
    • 中国人最容易犯错的30句英语[zz]
    • 公司邮件服务器向163及sina免费邮箱用户发信被退回解决纪录
    • EMC-AX100i在2003系统下出现的(重启后)共享文件夹丢失问题及解决办法
    • 在 fc 5 的英文状态下使用scim输入法
    • 千兆网线交叉线接法(有图)
    • Red Hat Enterprise Linux在IBM xSeries服务器上的调优(四)
    • ChinaUnix精华合集2006版
    • Note of Family Album - by Jeffrey
    • 赋予普通用户特殊权限

    最新评论

    • [...] Jeffrey 出处:http://blog.zhangjianfeng.co...
    • [...] 文章来源:http://blog.zhangjianfeng.co...
    • 是的. 只要端口不冲突就可...
    • 请教 我在UBUNTU上 (8。04)装了apache2....
    • 謝謝您提供的這些訊息...
    • venhow, 我已经好久没用legato networker了,...
    • 謝謝。 我還沒有提及最主要的一點...
    • 是7.x版本吗? 我记得在配置备份源目...
    • 謝謝。 是原主機(server)還原。 您...
    • venhow,你好 我这边没有相关环境,但根...


    邮件订阅  
  • Categories

    • 个人日志 (15)
    • 休闲娱乐 (79)
    • 应用服务 (87)
    • 影音娱乐 (10)
    • 电脑网络 (79)
    • 站点日志 (19)
    • 系统管理 (244)
    • 英语学习 (17)
    • 衣食住行 (41)
    • 资料共享 (28)
  • 工具网址

    • 天气预报
    • 常用电话
    • 疾病查询
    • 在线翻译
    • Alexa排名查询
    • IP信息查询
    • 邮箱图标生成
    • 我的Firefox插件
  • 友情链接

    • linuxの飘扬
    • winter的平凡生活
    • 伤感星星的天空
    • 回忆未来[张宴]
    • 存储部落
    • 扶凯Blog
    • 沐宇春风
    • 爱MySQL中文网
    • 狗.车.志
    • 非礼勿视
    • 顾秦博客
  • Tags

    • 下载 优化 使用 免费 北京 升级 学习 学习笔记 安装 工具 性能 技巧 日志 最新 服务器 笔记 英语学习 菜谱 视频 解决 调优 软件 运程 配置 配置文件 食物 2007 apache blog dreamhost freebsd Legato linux mysql networker oracle php RAID5 RedHat sendmail squid suse Ubuntu windows wordpress

Jeffrey's Blog is powered by WordPress 2.3.1 and Unnamed 1.22
Entries (RSS) and Comments (RSS) Admin 京ICP备06038449号

Podcast Powered by podPress (v8.8)