# test in debian 10
# 检查当前域名服务
ping baidu.com
# 注释DNS当前服务,并添加本机IP
vi /etc/resolv.conf
#nameserver 108.61.10.10
nameserver 127.0.0.1
# 查看是否已安装bind9
dpkg -l | grep bind9
# 安装bind9
apt update
apt install bind9
# 修改配置文件
vi /etc/bind/named.conf.local
zone "baidu.com" {
type master;
file "/etc/bind/db.baidu.com";
};
# 添加域名配置文件
vi /etc/bind/db.baidu.com
;
; BIND data file for baidu.com
;
$TTL 604800
@ IN SOA ns1.baidu.com. admin.baidu.com. (
2 ; Serial
604800 ; Refresh
86400 ; Retry
2419200 ; Expire
604800 ) ; Negative Cache TTL
;
@ IN NS ns1.baidu.com.
@ IN A 192.168.1.199
ns1 IN A 192.168.1.199
# 重启bind服务
service bind9 restart
service bind9 status
# 检查域名,这时已指向自定义的IP
ping baidu.com
# 也可用nslookup查询
nslookup baidu.com
标签:baidu,服务,bind,etc,DNS,vi,bind9,com,模拟
From: https://www.cnblogs.com/rustling/p/18093280