代码分享:DNS负载均衡设置

网络 网络优化 网络运维
本文主要对DNS负载均衡设置的相关代码做了具体的总结。那么,希望大家通过本文的介绍,能学会这个简单的配置。

前面我们学习了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#53

Name:   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

 

责任编辑:佟健 来源: 互联网
相关推荐

2010-04-22 17:53:36

Apache负载均衡

2010-05-10 14:15:54

DNS负载均衡

2010-04-20 12:07:17

DNS负载均衡

2010-04-26 17:19:26

DNS负载均衡

2010-04-26 15:14:46

DNS负载均衡

2019-03-18 10:44:41

负载均衡DNSUDP

2010-04-26 15:37:18

DNS负载均衡

2010-04-26 13:34:43

DNS负载均衡

2010-04-26 00:42:08

DNS负载均衡

2010-05-06 16:58:10

Dns负载均衡

2010-05-04 16:59:52

DNS负载均衡

2016-11-01 11:38:50

DNS网站性能

2010-05-05 21:39:29

linux负载均衡

2009-01-10 18:53:01

服务器ServerDNS

2010-05-04 17:05:29

DNS负载均衡

2016-01-08 10:53:48

DNS负载均衡跨云应用

2010-04-26 16:30:00

DNS负载均衡

2010-04-21 12:28:50

Oracle负载均衡

2010-05-10 14:48:01

流量负载均衡

2010-04-20 18:13:44

网络负载均衡设置
点赞
收藏

51CTO技术栈公众号