歡迎您光臨本站 註冊首頁

怎麼將DNS從127.0.0.1改為實際的ip地址

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

怎麼將DNS從127.0.0.1改為實際的ip地址

# rpm -qa|grep bind
bind-chroot-9.3.3-7.el5
bind-utils-9.3.3-7.el5
bind-9.3.3-7.el5
bind-libs-9.3.3-7.el5
ypbind-1.19-7.el5
# uname -a
Linux mailtest1 2.6.18-8.el5 #1 SMP Thu Mar 15 19:57:35 EDT 2007 i686 i686 i386 GNU/Linux
#

OS:CentOS5



# nslookup
> www.test.hk
Server:         127.0.0.1
Address:        127.0.0.1#53
Name:   www.test.hk
Address: 10.10.119.200
> server 10.10.119.200
Default server: 10.10.119.200
Address: 10.10.119.200#53
> www.test.hk
;; connection timed out; no servers could be reached




# ping www.test.hk
PING www.test.hk (10.10.119.200) 56(84) bytes of data.
64 bytes from www.test.hk (10.10.119.200): icmp_seq=1 ttl=64 time=0.391 ms
64 bytes from www.test.hk (10.10.119.200): icmp_seq=2 ttl=64 time=0.082 ms
64 bytes from www.test.hk (10.10.119.200): icmp_seq=3 ttl=64 time=0.080 ms

--- www.test.hk ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2004ms
rtt min/avg/max/mdev = 0.080/0.184/0.391/0.146 ms





named.conf
options {
#        listen-on port 53 { 10.10.119.200; };
        listen-on port 53 { 127.0.0.1; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";
        query-source    port 53;
        query-source-v6 port 53;
        pid-file "/var/run/named/named.pid";
        allow-query     { localhost; };
};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};

key "rndckey" {
      algorithm hmac-md5;
      secret "vt/j+jC7MxIoB+9emnuKqw==";
};
controls {
      inet 127.0.0.1 port 953
              allow { 127.0.0.1; } keys { "rndckey"; };
};
#controls {
#      inet 10.10.119.200 port 953
#              allow { 10.10.119.200; } keys { "rndckey"; };
#};
zone "." IN {
        type hint;
        file "named.ca";
};
zone "localdomain" IN {
        type master;
        file "localdomain.zone";
        allow-update { none; };
};
zone "localhost" IN {
        type master;
        file "localhost.zone";
        allow-update { none; };
};
zone "0.0.127.in-addr.arpa" IN {
        type master;
        file "named.local";
        allow-update { none; };
};
zone "0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" IN {
        type master;
        file "named.ip6.local";
        allow-update { none; };
};
zone "255.in-addr.arpa" IN {
        type master;
        file "named.broadcast";
        allow-update { none; };
};
zone "0.in-addr.arpa" IN {
        type master;
        file "named.zero";
        allow-update { none; };
};
zone "test.hk" IN {
    type master;
    file    "named.test.hk";
};
zone "119.10.10.in-addr.arpa" IN {
        type master;
        file "named.10.10.119";
        allow-update { none; };
};




# more /var/named/named.test.hk
$TTL 86400
@                         IN          SOA        center.net.         ruochen0926.hotmail.com  (
                                                1997022700 ; Serial
                                                28800      ; Refresh
                                                14400      ; Retry
                                                3600000    ; Expire
                                                86400 )    ; Minimum
@                       IN          NS         www.test.hk.
@                       IN          MX  0      mail.test.hk.
localhost.              IN          A          127.0.0.1
www                     IN          A          10.10.119.200
mail                    IN          A          10.10.119.200






# more /var/named/named.10.10.119
$TTL 86400
@                    IN                   SOA                  localhost. root.localhost.  (
                                      1997022700 ; Serial
                                      28800      ; Refresh
                                      14400      ; Retry
                                      3600000    ; Expire
                                      86400 )    ; Minimum
@                    IN             NS      localhost.
localhost.           IN             PTR     localhost.
200                  IN             PTR     www.test.hk.





就是怎麼將DNS從127.0.0.1改成10.10.119.200
好讓別人也能用這個DNS
在本機測試http://www.test.hk已經好了(從本文的開頭ping的輸出也可以看出來)

[ 本帖最後由 ruochen 於 2007-9-18 19:41 編輯 ]
《解決方案》

cat /etc/resolv.conf
《解決方案》


# cat /etc/resolv.conf
# generated by NetworkManager, do not edit!

; Use a local caching nameserver controlled by NetworkManager


nameserver 127.0.0.1

改成 nameserver 10.10.119.200
???
這個文件只是解析器的作用呀

[ 本帖最後由 ruochen 於 2007-9-18 20:31 編輯 ]
《解決方案》

就是說怎麼將監聽放在
10.10.119.200#53
而不是
127.0.0.1#53


我在這台機器上用http://www.test.hk
已經可以看到apache的default頁面

但是在別的機器上將dns設置成10.10.119.200
重新啟動網路后
ping www.test.hk
不通
當然也不能用IE訪問了

請問如有何才能讓別的電腦用這個設置成10.10.119.200的dns來訪問http://www.test.hk

就是想做個www/mail的dns server

[ 本帖最後由 ruochen 於 2007-9-18 21:08 編輯 ]
《解決方案》

你的配置裡面已經有了啊
listen-on port 53 { 127.0.0.1; };
照著改就行了,也可以放any
《解決方案》

#        listen-on port 53 { 10.10.119.200; };
        listen-on port 53 { 127.0.0.1; };
        allow-query     { localhost; };

上面的改成下面的也不行呀

        listen-on port 53 { 10.10.119.200; };
#        listen-on port 53 { 127.0.0.1; };
#        allow-query     { localhost; };





還有下面的control的要改嗎?
controls {
      inet 127.0.0.1 port 953
              allow { 127.0.0.1; } keys { "rndckey"; };
};



不管怎麼改
怎麼就是不能在別的計算機上設置10.10.119.200的DNS來解析www.test.hk呢?
《解決方案》

看你的allow-query
《解決方案》

下面的兩種都試了

        listen-on port 53 { 10.10.119.200; };
#        listen-on port 53 { 127.0.0.1; };
#        allow-query     { localhost; };





        listen-on port 53 { 10.10.119.200; };
#        listen-on port 53 { 127.0.0.1; };
        allow-query     { localhost; };



如果像下面這樣的
在本機nslookup回車后
設置server 127.0.0.1
就可以解析
設置server 10.10.119.200
就不能解析
#        listen-on port 53 { 10.10.119.200; };
        listen-on port 53 { 127.0.0.1; };
        allow-query     { localhost; };
《解決方案》

zone的數據重新組織一下。
使用新特性的view,最好。
《解決方案》

還是03年前用過redhat9的自帶bind

bind的view怎麼用呀?
現在對這個還沒有什麼認識
下面的怎麼改?
        match-clients      { localhost; };
        match-destinations { localhost; };

/etc/named.caching-nameserver.conf

view localhost_resolver {
        match-clients      { localhost; };
        match-destinations { localhost; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};


view和我上面的named.conf有哪些衝突的沒?

[ 本帖最後由 ruochen 於 2007-9-20 14:52 編輯 ]

[火星人 ] 怎麼將DNS從127.0.0.1改為實際的ip地址已經有783次圍觀

http://coctec.com/docs/service/show-post-35615.html