前面我们学习了DNS负载均衡的基本知识,后来又对它的优缺点进行了总结和归纳。现在我们了解到,DNS负载均衡的配置相对来说比较简单,容易实现。但是它的缺点就是需要更新,而且出现故障问题就需要大量时间来修复。那么现在,我们就来对DNS负载均衡设置过程进行一个介绍。
DNS负载均衡设置一:
root@localhost ~]# vi /etc/named.conf//
// named.conf for Red Hat caching-nameserver
//options {
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
};controls {
inet 127.0.0.1 allow { localhost; } keys { rndckey; };
};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 "ox.com" {
type master ;
file "ox.zone";
};
zone "0.168.192.in-addr.arpa" {
type master ;
file "named.ox";
};
include "/etc/rndc.key";
#p#DNS负载均衡设置二:
[root@localhost ~]# vi /var/named/chroot/var/named/ox.zone$TTL 86400
@ IN SOA dns.ox.com root (
192 ;serial (d. adams)
3H ;refresh
15M ;retry
1W ;expiry
1D ) ;minimum@ IN NS dns.ox.com.
dns IN A 192.168.0.1
www IN A 192.168.0.6
www IN A 192.168.0.7
www IN A 192.168.0.8
DNS负载均衡设置三:
[root@localhost ~]# nslookup www.ox.com
Server: 192.168.0.1
Address: 192.168.0.1#53Name: www.ox.com
Address: 192.168.0.8
Name: www.ox.com
Address: 192.168.0.6
Name: www.ox.com
Address: 192.168.0.7