#获取bind9镜像
docker pull 18370952508/bind9
#启用bind9服务器,端口映射tcp和udp的53端口
docker run --name bind -d -p 53:53/udp -d -p 53:53/tcp 18370952508/bind9
#进入bind9容器
docker exec -it bind /bin/bash
#下载vim编辑器
apt-get update
apt-get install vim
#进入配置文件路径
cd /etc/bind/
#单独复制named.conf和zone文件
cp named.conf.default-zones yuntle.org
cp db.local yuntle.org.zone
#追加yuntle.org文件到named.conf文件中
/etc/bind/named.conf
include "/etc/bind/yuntle.org";
#编辑vim yuntle.org
zone "yuntle.org" {
type master;
file "/etc/bind/yuntle.org.zone";
};
#编辑vim yuntle.org.zone域名
$TTL 604800
@ IN SOA yuntle.org. root.yuntle.org. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS yuntle.org.
@ IN A 127.0.0.1
@ IN AAAA ::1
www IN A 1.1.1.1
web IN A 2.2.2.2
#追加到vim /etc/bind/named.conf.options,启用递归迭代功能
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { any; };
allow-query { any; };
recursion yes;
};
#重新加载配置文件
rndc reload
#使用dig测试
dig www.yuntle.org @10.0.44.252
dig www.baidu.com @10.0.44.252
Content type
Image
Digest
Size
89.5 MB
Last updated
over 4 years ago
docker pull 18370952508/bind9