Ubuntu DNS bind9 配置

下面的配置就是实现解析test.zp.com到不同的IP地址

安装dns server软件包
$ apt-get install bind9

配置dns
配置文件的路径在/etc/bind路径下面
添加一个zone
$ /etc/bind# vim /etc/bind/named.conf.local
添加下面,语法可以参照/etc/bind/zones.rfc1918中的语法添加,如下:

zone "zp.com" { type master; file "/etc/bind/db.zp.com"; };

修改db的配置文件
$ /etc/bind# cp db.local db.zp.com
$ /etc/bind# vim db.zp.com
;
; BIND data file for local loopback interface
;
$TTL 604800
@ IN SOA zp.com. root.localhost. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS localhost.
@ IN A 127.0.0.1
@ IN AAAA ::1
test IN A 192.168.0.11
test IN A 192.168.0.12
test IN A 192.168.0.13
test IN A 192.168.0.14
test IN A 192.168.0.15
test IN A 192.168.0.16


修改/etc/bind/named.conf.option 配置文件,在 named.conf 中可以设置 bind 的 round-robin 的给出结果的顺序:

rrset-order { order cyclic; };

rrset-order 支持三个参数:fixed, random, cyclic 。
fixed 会将多个A记录按配置文件的顺序固定给出
random 会随机给出
cyclic 会循环给出
重启服务
$ /etc/bind# /etc/init.d/bind9 restart
检查配置效果
修改域名解析配置文件
$ /etc/bind# vim /etc/resolv.conf
nameserver 192.168.0.***
添加你的域名服务器的IP地址
$ dig test.zp.com

 

更加简单的选择  dnsmasq

转载于:https://www.cnblogs.com/zhangeamon/p/5121663.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值