# vi /etc/sysconfig/iptables
.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 53 -j ACCEPT
-A INPUT -m state --state NEW -m udp -p udp --dport 53 -j ACCEPT
# service iptables restart
# service named start
# netstat -tunlp
# dig @127.0.0.1 tw.yahoo.com
.
;; ANSWER SECTION:
.
# vi /etc/named.conf
.
listen-on port 53 { any; }; //原127.0.0.1
.
allow-query { any; }; //原localhost
# service named restart
# dig @192.18.2.105 tw.yahoo.com
+++++++++++++++++++++++++++++++++++++++
# vi /etc/named.rfc1912.zones
//只要自己的正解即可
zone "502.kk" IN {
type master;
file "named.502.kk";
allow-update { none; };
};
# vi /etc/named.rfc1912.zones
//只要自己的正解即可
zone "502.kk" IN {
type master;
file "named.502.kk";
allow-update { none; };
};
# vi /var/named/named.502.kk
$TTL 600
@ IN SOA dns.502.kk. guochin369@gmail.com. (0 3H 15M 1W 1D)
@ IN NS dns.502.kk.
dns IN A 192.168.2.105
www IN A 192.168.2.105
# service named restart
# ping www.502.kk
$TTL 600
@ IN SOA dns.502.kk. guochin369@gmail.com. (0 3H 15M 1W 1D)
@ IN NS dns.502.kk.
dns IN A 192.168.2.105
www IN A 192.168.2.105
# service named restart
# ping www.502.kk
# dig @dns.502.kk tw.yahoo.com
+++++++++++++++++++++++++++++++++++++++
另一測試電腦IP:192.168.2.51 Win7 設定dns:192.168.2.105
cmd
c:\Users\User>ping 192.168.2.105
c:\Users\User>ping dns.502.kk
c:\Users\User>ping www.50.2kk
c:\Users\User>ping tw.yahoo.com
瀏覽器連結tw.yahoo.com