负载均衡的DNS

1,安装DNS
[root@VM_16_17_centos ~]# yum -y install bind
2,配置DNS
[root@VM_16_17_centos ~]# vim /etc/named.conf
options {
listen-on port 53 { 127.0.0.1; 192.168.0.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”;
allow-query { localhost; any; };
recursion yes;
dnssec-enable no;
dnssec-validation no;
dnssec-lookaside auto;
/* Path to ISC DLV key */
bindkeys-file “/etc/named.iscdlv.key”;
managed-keys-directory “/var/named/dynamic”;
};

logging {
channel default_debug {
file “data/named.run”;
severity dynamic;
};
};

zone “.” IN {
type hint;
file “named.ca”;
};

include “/etc/named.rfc1912.zones”;
include “/etc/named.root.key”;

vim /etc/named.rfc1912.zones

zone “uplooking.com” IN {
type master;
file “uplooking.com.zone”;
allow-update { none; };
};

创建区域文件
[root@VM_16_17_centos ~]# cd /var/named/
[root@VM_16_17_centos ~]# cp -a named.localhost uplooking.com.zone(必须要加-a,否则named用不了这个文件,DNS无效)
[root@VM_16_17_centos ~]# vim uplooking.com.zone
$TTL 86400
@ IN SOA dns.uplooking.com. root.uplooking.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum

@ IN NS dns.uplooking.com.
dns IN A 192.168.0.1

www IN A 192.168.0.100
www IN A 192.168.0.101
www IN A 192.168.0.102
www IN A 192.168.0.103
www IN A 192.168.0.104

检查配置文件的语法
[root@VM_16_17_centos ~]# named-checkconf /etc/named.conf
[root@VM_16_17_centos ~]# named-checkzone uplooking.com /var/named/uplooking.com.zone
zone uplooking.com/IN: loaded serial 42
OK

启动DNS服务
[root@VM_16_17_centos ~]# service named start
[root@VM_16_17_centos ~]# chkconfig named on
[root@VM_16_17_centos ~]# netstat -unlp |grep :53
udp 0 0 192.168.0.1:53 0.0.0.0:* 2846/named
udp 0 0 127.0.0.1:53 0.0.0.0:* 2846/named

测试DNS轮询:

[root@VM_16_17_centos ~]# vim /etc/resolv.conf

nameserver 192.168.0.1

[root@VM_16_17_centos ~]#ping www.uplooking.com
PING www.uplooking.com (192.168.0.100) 56(84) bytes of data

[root@VM_16_17_centos ~]# ping www.uplooking.com
PING www.uplooking.com (192.168.0.101) 56(84) bytes of data

[root@VM_16_17_centos ~]#ping www.uplooking.com
PING www.uplooking.com (192.168.0.102) 56(84) bytes of data.

[root@VM_16_17_centos ~]# ping www.uplooking.com
PING www.uplooking.com (192.168.0.103) 56(84) bytes of data.

[root@VM_16_17_centos ~]#ping www.uplooking.com
PING www.uplooking.com (192.168.0.104) 56(84) bytes of data.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值