由于中国目前基础通讯的分割局面,使一些企业不得不考虑南北互联互通问题,这也是我们公司面临的问题之一。
为增加用户的体验度,不得不增加企业的运营成本。与联通沟通后,把服务器搬入双线机房---联通和电信----双线路双网卡。
双线路双网卡首先要解决域名解析问题,要让电信的IP访问的时候走电信的线路,联通的IP走联通的线路。
BIND 的view功能就是这个方案的解决途径之一。下面就介绍安装与配置:
1、去bind官网下载最新版本:ftp://ftp.isc.org/isc/bind9/9.8.1-P1/bind-9.8.1-P1.tar.gz
tar xzvf bind-9.8.1-P1.tar.gz
cd bind-9.8.1-P1
./configure --prefix=/opt/bind --with-libtool --enable-largefile --enable-threads --disable-ipv6 --sysconfdir=/opt/bind/etc --localstatedir=/var/named --disable-openssl-version-check
make&&make install
2、/opt/bind/sbin/rndc-confgen>/opt/bind/etc/rndc.conf
cd /opt/bind/etc
tail -10 rndc.conf |head -9|sed s/#\//g>named.conf
cd /var/named
dig>named.root
groupadd bind
useradd bind -g bind -s /sbin/nologin
3、编辑/opt/bind/etc/named.conf
options {
directory "/var/named";
pid-file "/var/run/named/named.pid";
version "0.0.0";
allow-query { any; };
recursion no;
allow-query-cache { none; };
datasize 50M;
auth-nxdomain no;
listen-on port 53 {192.168.0.20;};
};
key "rndc-key" {
algorithm hmac-md5;
secret "+FU4BMNi9nG0W+tzusLDhQ==";
};
controls {
inet 127.0.0.1 port 953
allow { 127.0.0.1; } keys { "rndc-key"; };
};
logging{
channel query_log{
file "/var/log/named/query.log" versions 3 size 256m;
severity info;
print-time yes;
print-severity yes;
print-category yes;
};
category queries{
query_log;
};
channel default_log{
file "/var/log/named/bind.log" versions 3 size 256m;
severity warning;
print-time yes;
print-severity yes;
print-category yes;
};
category default{
default_log;
};
};
include "/opt/bind/etc/acl.conf";
view "cnc" {
match-clients {cnc;};
zone "." IN {
type hint;
file "named.root";
};
include "/opt/bind/etc/cnc.conf";
};
view "chinanet" {
match-clients {chinanet;};
zone "." IN {
type hint;
file "named.root";
};
include "/opt/bind/etc/chinanet.conf";
};
view "other" {
match-clients {any;};
zone "." IN {
type hint;
file "named.root";
};
include "/opt/bind/etc/other.conf";
};