顯示具有 bind9 標籤的文章。 顯示所有文章
顯示具有 bind9 標籤的文章。 顯示所有文章

2017年9月25日

ubuntu dns 限制遞迴查詢

個人做法如下
sudo -s


cd /etc/bind/

 vim named.conf.options

options {
        directory "/var/cache/bind";
        managed-keys-directory "/etc/bind";
後加入下列

        allow-transfer {"none";};
        allow-recursion {"none";};
        recursion no;
        allow-query { any; };
存檔完後重啟bind9
 /etc/init.d/bind9 restart

做完之後使用nslookup查詢
sever 163.20.xx.1

> server 163.20.xx.1
Default server: 163.20.xx.1
Address: 163.20.xx.1#53
> dns.xx.ntpc.edu.tw.
Server:        163.20.xx.1
Address:    163.20.xx.1#53

dns.xx.ntpc.edu.tw    canonical name = ntpdc.xx.ntpc.edu.tw.
Name:    ntpdc.xx.ntpc.edu.tw
Address: 163.20.xx.1
> www.ntpc.edu.tw
Server:        163.20.xx.1
Address:    163.20.xx.1#53

** server can't find www.ntpc.edu.tw: REFUSED
你只可以查詢校內的dns資料,查詢其他的會回應查不到

allow-query 是回應可以查詢的網段

         allow-transfer {"none";};
        allow-recursion {"none";};
        recursion no;
是禁止 遞迴查詢

參考資料:
http://wiki.weithenn.org/cgi-bin/wiki.pl?bind9-%E6%8F%90%E4%BE%9BDomain_Name%E8%88%87IP%E5%B0%8D%E6%87%89%E7%9A%84%E6%9C%8D%E5%8B%99#Heading8

http://www.cc.ntu.edu.tw/chinese/epaper/0028/20140320_2809.html


保太提供指令查詢
sudo nmap -sU 53 --script=dns-recursion 10.231.1.1/24



使用nslookup查資料時
在校內
server 163.20.xx.1
只能查到自己管的domain




其他的會顯示查不到

nslookup
> server 163.20.xx.1
Default server: 163.20.xx.1
Address: 163.20.xx.1#53
> dns.xx.ntpc.edu.tw
Server:        163.20.xx.1
Address:    163.20.xx.1#53

dns.xx.ntpc.edu.tw    canonical name = ntpdc.xx.ntpc.edu.tw.
Name:    ntpdc.xx.ntpc.edu.tw
Address: 163.20.xx.1
> www.hinet.net
Server:        163.20.xx.1
Address:    163.20.xx.1#53

** server can't find www.hinet.net: REFUSED
> exit


在校外
 nslookup
> server 163.20.xx.1
Default server: 163.20.xx.1
Address: 163.20.xx.1#53
> dns.xx.ntpc.edu.tw
Server:        163.20.xx.1
Address:    163.20.xx.1#53

** server can't find dns.xx.ntpc.edu.tw: REFUSED
> exit

2015年12月21日

dns壓力測試

參考文章:http://note.tc.edu.tw/837.html
確定nds版本

named -v
wget https://ftp.isc.org/isc/bind9/9.10.3/bind-9.10.3.tar.gz
tar zxvf bind-9.10.3.tar.gz
cd bind-9.10.3/contrib/queryperf/
sh configure
make

複製執行檔到/usr/sbin
cp queryperf /usr/sbin/

如果和我使用的是edu2015的版本可以直接下載我編譯好的檔案來使用。
 下載後記得做
chmod +x queryperf
cp queryperf /usr/sbin/

執行方式
先建立查詢txt檔,建議至少100行可以是MX A ...
例如:
 www.turku.fi A
  www.helsinki.fi A


執行指令:
queryperf -d input_file -s server



結果:
Queries per second:   1137.599665 qps
代表每秒可以執行多少查詢