环境说明:所有虚拟机的操作系统都是Debian9,网络环境为NAT,每台服务器只有一块网卡(在NAT模式是为了方便安装BIND9软件包)
开始配置主服务器:
#cd /etc/bind
#dnssec-keygen -a hmac-md5 -b 128 -n HOST tsig-dnssec
命令语法为dnssec-keygen -a [加密算法] -b [密钥长度] -n 名称类型 <秘钥名>
命令执行完成后,在/etc/bind目录下,会心生成两个文件
root@debian:/etc/bind# ls -l
-rw------- 1 root bind 55 Feb 22 00:07 Ktsig-dnssec.+157+18256.key #公钥
-rw------- 1 root bind 165 Feb 22 00:07 Ktsig-dnssec.+157+18256.private #私钥
#cat Ktsig-dnssec.+157+18256.private | grep Key > /etc/bind/tsig-dnssec
将秘钥部分输出到/etc/bind/tsig-dnssec中,相当于是创建文件了
#vim /etc/bind/tsig-dnssec
key "tsig-dnssec" {
algorithm hmac-md5;
secret "Ob6Q17UVpjMy8M+Vn5p5sw==";};
文件中的Ob6Q1