前言
版本Debian10.7,三台机子,server/node1/node2一、环境
192.168.26.10 server server.zedd.com
192.168.26.11 node1 node1.zedd.com
192.168.26.12 node2 node2.zedd.com
二、主机名修改、安装
1.修改主机名
root@debian:~# echo server > /etc/hostname
root@debian:~# vim /etc/hosts
127.0.1.1 server.zedd.com server //修改
//保存退出,更新主机名
root@debian:~# hostname -F /etc/hostname
root@debian:~# hostname
server
root@debian:~# hostname -f
server.zedd.com
root@debian:~# bash
root@server:~#
node1/node2 相同操作
2.安装
root@server:~# apt install bind9 dnsutils -y
root@node1:~# apt install dnsutils -y
root@node2:~# apt install dnsutils -y
二、配置
1.修改工作目录路径
root@server:~# cd /etc/bind/
root@server:/etc/bind# vim named.conf.options
directory "/etc/bind/"; //修改
2.添加区域
root@server:/etc/bind# vim named.conf
正向区域文件创建
root@server:/etc/bind# cp db.empty db.zedd
root@server:/etc/bind# vim db.zedd
反向区域文件创建
root@server:/etc/bind# cp db.127 db.ddez
root@server:/etc/bind# vim db.ddez
权限
chown -R bind:bind /etc/bind
DNS域名各项解析记录
https://www.cnblogs.com/bluestorm/p/10345334.html
三、测试
//重启服务,添加DNS
root@server:/etc/bind# systemctl restart bind9
root@server:/etc/bind# cat /etc/resolv.conf
nameserver 192.168.26.10 //添加
nameserver 8.8.8.8
root@node1:~# cat /etc/resolv.conf
nameserver 192.168.26.10
root@node2:~# cat /etc/resolv.conf
nameserver 192.168.26.10
server
node1