一、安装bind9
apt install bind9
二、修改配置文件
1、修改“named.conf.local”文件
vi /etc/bind/named.conf.local
文件末尾添加如下内容
zone "test.com" {
type master;
file "/etc/bind/db.test.com";
};
2、“/etc/bind”目录下新建“db.test.com”文件
文件内容举例如下
;
; BIND data file for sip test
;
$TTL 604800
@ IN SOA test.com. root.test.com. (
3 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS test.com.
@ IN A 127.0.0.1
@ IN AAAA ::1
;NAPTR
@ 3600 IN NAPTR 0 0 "s" "SIP+D2U" "" _sip._udp
@ 3600 IN NAPTR 0 0 "s" "SIP+D2T" "" _sip._tcp
@ 3600 IN NAPTR 0 0 "s" "SIPS+D2T" "" _sips._tcp
;SRV
_sip._udp 3600 IN SRV 0 0 5060 udp1
_sip._udp 3600 IN SRV 0 0 5060 udp2
_sip._tcp 3600 IN SRV 0 0 5060 tcp1
_sip._tcp 3600 IN SRV 0 0 5060 tcp1
_sips._tcp 3600 IN SRV 0 0 5061 tls1
_sips._tcp 3600 IN SRV 0 0 5061 tls1
;A&AAAA
udp1 3600 IN A 127.0.0.1
udp2 3600 IN A 127.0.0.1
tcp1 3600 IN A 127.0.0.1
tcp2 3600 IN A 127.0.0.1
tls1 3600 IN A 127.0.0.1
tls2 3600 IN A 127.0.0.1
udp1 3600 IN AAAA ::1
udp2 3600 IN AAAA ::1
tcp1 3600 IN AAAA ::1
tcp2 3600 IN AAAA ::1
tls1 3600 IN AAAA ::1
tls2 3600 IN AAAA ::1
三、重启bind9
/etc/init.d/bind9 restart