abc.com.adddomain 既不能用sh来执行,也不能直接用nsupdate < abc.com.adddomain
来执行,如果nsupdate不指定
-y ${key}:${secret} 会报错!类似报错如下:
update failed: REFUSED #感谢为我提供帮助的兄弟!
- root@dns-****:/home/liuxiaojie# cat /usr/local/bind9/etc/key/key.conf | head -n 4
- key "ungeo11" {
- algorithm hmac-md5;
- secret "5I7KzWpBW7FELdtB3kNNHzFMusdnfVMQlAedFcjumUcFfA6AMUbPFUO7c0n7uyZ74eDeZp0I7tgPnD1M/uxJFw==";
- };
-
- root@dns-****:/home/liuxiaojie# cat add.sh
- #!/bin/sh
- cat /usr/local/bind9/etc/key/key.conf | grep key |awk '{print $2}' > /home/liuxiaojie/keyname.txt
- cat /usr/local/bind9/etc/key/key.conf | grep secret |awk '{print $2}' > /home/liuxiaojie/secretname.txt
- paste -d " " keyname.txt secretname.txt >all.txt
- #sed -i 's/^/ /g' secretname.txt
- sed -i 's/;//g' all.txt
- sed -i 's/"//g' all.txt
- cat /home/liuxiaojie/all.txt | while read line
- do
- key=` echo $line|awk '{print $1}'`
- secret=` echo $line|awk '{print $2}'`
- #echo ${key}
- #echo ${secret}
- /usr/local/bind9/bin/nsupdate -y ${key}:${secret} < /home/liuxiaojie/abc.com.adddomain
- #echo "test"
- done
- 使用过程中的遇到的问题:
- ##192.168.1.106为dns server的地址,这个nsupdate运行后有点奇怪,并不能立即在类似于 telcq.zone telhain.zone teljl.zone .......文件中查看到添加的相关记录,但使用dig @192.168.1.106 却可以生效!大概过个10分钟左右(我测试的) ,相关记录就会在文件里出现!
- root@dns-****:/home/liuxiaojie# cat abc.com.adddomain
- server 127.0.0.1
- zone dccache.com
- update delete abc.com.dccache.com. CNAME
- update add abc.com.dccache.com. 600 CNAME dcc126.group.dccache.com.
- send
- show
- quit
- root@dns-****:/home/liuxiaojie# cat all.txt |head -n 2
- ungeo11 5I7KzWpBW7FELdtB3kNNHzFMusdnfVMQlAedFcjumUcFfA6AMUbPFUO7c0n7uyZ74eDeZp0I7tgPnD1M/uxJFw==
- ungeo12 ZSXTmfnJ5MRThHS+Ccw2BFhFCZb3uy7Q/oaLsJvd+9PJbhmr3abu+rHXtCjpR6dbXdo514qCRB6sdUIwziFLmA==
阅读(1777) | 评论(0) | 转发(0) |