µ±Ç°Î»ÖãºLinux½Ì³Ì - Linux - ÅäÖà DNS ·þÎñÆ÷

ÅäÖà DNS ·þÎñÆ÷



        

    ¶ÔÓÚÓÃÓÚÍøÂç¿ìËÙ¸üеÄÈí¼þ¸÷°æ±¾,ÓöÔÍ⿪·ÅµÄ·þÎñÆ÷À´²âÊÔÊǾßÓÐÒ»¶¨Î£ÏÕÐÔµÄ,ÓÃÄÚ²¿ÍøרÃŵÄһ̨¼ÆËã»úÀ´²âÊÔÊÇ×îºÃ²»¹ýµÄÁË,Òò´Ë¾ÍרÃÅÅäÖÃÁËһ̨ÓÃÓÚÄÚÁªÍøµÄ·þÎñÆ÷,Ò²Òò´ËÅäÖÃÁËÒ»¸öΪÄÚÁªÍøÓõļòµ¥ DNS ·þÎñÆ÷,ÏÂÃæ¾Í½éÉÜÒ»ÏÂÕâ¸ö DNS µÄÅäÖùý³Ì.

    ÄÚÁªÍøÖ÷»ú·þÎñÆ÷µÄÖ÷»úÃûΪ pc10,IP ÊÇ:192.168.1.10,ÆôÓà tcpip.cxm ×÷ΪÓòÃû.

    Õû¸ö¹ý³ÌÐèÒªÅäÖÃÒÔϼ¸¸öÅäÖÃÎĵµ:
    /etc/hosts
    /etc/host.conf
    /etc/resolv.conf
    /etc/named.conf
    /var/named/named.192.168.1
    /var/named/named.tcpip.cxm

    1.Ê×ÏÈÅäÖà /etc/hosts Ö¸¶¨ Ip µ½Ö÷»úµÄÓ°Éä,ÏÂÃæÊÇÅäÖúõÄÎĵµ
    -------------------------------------------------------
    #IP Address Hostname Alias
    127.0.0.1 localhost
    192.168.1.10 pc10 pc10.tcpip.cxm
    --------------------------------------------------------

    2.½ÓÏÂÀ´ÊÇ /etc/host.conf µÄÅäÖÃ
    --------------------------------------------------------
    order hosts, bind
    multi on
    --------------------------------------------------------
    Õâ¸öÅäÖõÄÒâ˼ÊÇ´Ó /etc/hosts ¿ªÊ¼²éѯ,È»ºóÊÇ DNS,Èç¹ûÊǶà¸öÖ÷»ú½«È«²¿·µ»Ø

    3.ÅäÖÃ /etc/resolv.conf
    --------------------------------------------------------
    search tcpip.cxm
    nameserver 192.168.1.10
    --------------------------------------------------------
    Õâ¶ùÅäÖõÄÊÇ DNS ¿Í»§,search Ö¸¶¨µÄÊÇ¿Í»§Ä¬ÈÏÓòÃû,nameserver ÔòÊÇÖ¸¶¨Ê¹ÓÃµÄ DNS ·þÎñÆ÷µÄ IP µØÖ·,ÕâÀïʹÓõÄÊÇÕýÔÚÅäÖà DNS ·þÎñÆ÷µÄÖ÷»ú IP µØÖ·:192.168.1.10

    4.ÅäÖà /etc/named.conf ,Õâ¸öÎĵµµÄÅäÖúÜÖØÒª
    --------------------------------------------------------
    // generated by named-bootconf.pl

    options {
    directory "/var/named";
    /*
    * If there is a firewall between you and nameservers you want
    * to talk to, you might need to uncomment the query-source
    * directive below. Previous versions of BIND always asked
    * questions using port 53, but BIND 8.1 uses an unprivileged
    * port by default.
    */
    // query-source address * port 53;
    };

    //
    // a caching only nameserver config

    //
    zone "." {
    type hint;
    file "named.ca";
    };

    zone "0.0.127.in-addr.arpa" {
    type master;
    file "named.local";
    };


    zone "1.168.192.in-addr.arpa" {
    type master;
    file "named.192.168.1";
    };

    zone "tcpip.cxm" {
    type master;
    file "named.tcpip.cxm";
    };
    --------------------------------------------------------
    ÀïÃæµÄ // ºóºÍ /* */ ÀïµÄÄÚÈݶ¼ÊÇ×¢ÊÍ,ÓÈÆäҪעÒâÀïÃæµÄ±êµãÒªÕýÈ·,zone "1.168.192.in-addr.arpa" ÊÇÅäÖ÷´Ðò²éÕÒ,¶ø zone "tcpip.cxm" ÔòÊÇÅäÖÃÕýÐò²éÕÒ

    5.´´½¨ÇøÊý¾ÝÎļþ /var/named/named.192.168.1,Ö»Ð踴ÖÆ /var/named/named.local Ϊ /var/named/named.192.168.1 ½øÐÐÐÞ¸Ä(×¢Òâ:ÊǸ´ÖƲ»ÊǸüÃû),Ð޸ĺóµÄÄÚÈÝÈçÏÂ:
    ---------------------------------------------------------
    @ IN SOA pc10.tcpip.cxm. hostnaster.pc10.tcpip.cxm. (
    1997022700 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    86400 ) ; Minimum
    IN NS pc10.tcpip.cxm.
    1 IN PTR pc10.tcpip.cxm.
    ---------------------------------------------------------
    ÀïÃæ¸÷¸ö±êµãÒ²±ØÐëÕýÈ·!

    6.´´½¨Êý¾ÝÎļþ /etc/named.tcpip.cxm ,ÕýÈ·½á¹ûÈçÏÂ:
    ---------------------------------------------------------
    @ IN SOA pc10.tcpip.cxm. hostmaster.pc10.tcpip.cxm. (
    1997022700 ; Serial
    28800 ; Refresh
    14400 ; Retry
    3600000 ; Expire
    86400 ) ; Minimum
    IN NS pc10
    pc10 IN A 192.168.1.10
    www IN CNAME pc10
    ----------------------------------------------------------
    ÕâÀï NS ÊÇÓòÃû·þÎñÆ÷, A ÊǵØÖ·¼Ç¼,CNAME Êǹ淶µÄÃû³ÌÒ²Ö¸Ìæ»»,Ò²¾ÍÊÇ˵Óà pc10.tcpip.cxm Óë www.tcpip.cxm Ò»Ñù.

    7.×Ðϸ¼ì²éÈ·±£ÕýÈ·ºó,ÖØÐÂÆô¶¯ DNS ÊØ»¤½ø³Ì named:
    #/etc/rc.d/init.d/named restart

    8.¼ì²é DNS ·þÎñÆ÷
    ÏÈ telnet 192.168.1.10 ,È»ºó ping ÍⲿÍøÖ·,ÔÙÓà nslookup
    ÕýÈ·µÄ»° DNS ·þÎñÆ÷ÅäÖóɹ¦.ÕâʱÄÚ²¿ÍøµÄ¼ÆËã»ú¶¼¿ÉÓà 192.168.1.10 ×÷ΪÓòÃû·þÎñÆ÷.

    ÏÖÔÚÎÒÅäÖÃµÄ DNS ÔËÐÐÁ¼ºÃ,²»½ö¿ÉÒÔä¯ÀÀÍâÃæÍøÕ¾,»¹¿É¶ÔÄÚÌṩÓòÃû·þÎñ(µ±È»¶¼²»ÊÇȨÍþµÄÓòÃû,²»¹ýµ±»ØÉϵ۵ĸоõͦ²»´í^o^)
    ·¢²¼ÈË:I like Linux À´×Ô:·Ç³£Linux