DNS VIEW

dnsview는 DNS VIEW가 어떤 특수한 방식으로 사용자의 출처에 따라 서로 다른 조회 결과를 되돌려주는 것이 무엇인가. 이 기술은 CDN에서 상당히 많이 응용되고 현재 대출이 적고 지연이 큰 문제를 해결하는 방법인view "internal"{#internal은 지역 이름으로 사용자 정의할 수 있지만 유일해야 한다}.구분 구역은 match-clients 키워드를 통해 이루어진다. 예를 들어view "internal"{match­clients { 192.168.0.0/24; }; }; 위의 부분은 192.168.0.0/24 세그먼트의 요청만 처리할 수 있음을 나타낸다. match-clients는 매우 많은 세그먼트를 정의해야 할 수 있다.bind는 acl 키워드를 도입하여 변수 교체를 정의하여match-clients에 최소한의 기호만 나타나게 하고 세그먼트의 증가는 외부 파일에서 acl"foo­subnet"{ 192.168.1/24;192.168.2/24; }; view "internal"{ match­clients { "foo­subnet";};} 예: 간단한viewnamed.conf 예는 다음과 같다:options {directory"/var/named";};acl "foo­subnet"{ 192.168.0/25; }; view "internal"{ //internal view of our zones match­clients { "foo­subnet"; }; zone "zhoutao.com"{ type master; file "zhoutao.com.0­127.zone"; };      }; view "external"{ //view of our zones for the rest of the world match­clients { any; }; //implicit recursion no;           //outside of our subnet, they shouldn't be//requesting recursion zone "zhoutao.com"{ type master; file "zhoutao.external.zone"; //external zone data file };    }; 범례 해석: 192.186.0.1~192.168.0.127 사이의 IP 주소 사용자의 dns 요청은 모두 인터넷 보기에서 처리됩니다. 만약에 요청이 인터넷 보기에 규정된 구역에서 오지 않으면 요청은 다른 보기와 비교됩니다. 모든 보기의 대비는 위에서 아래입니다. 요청한 구역이 이전 보기에서 나오면 다음 보기로 요청하지 않습니다.다음 보기에서 이 구역view를 넣은 종속 서버 설정 문제도 주 서버에서 보기를 구분했기 때문에 원본 영역이 다른 보기에 분배되어 처리됩니다. 만약 종속 서버에 IP 주소가 하나만 있다면 종속 서버는 주 서버의 단일 보기에서 도메인 이름의 도메인 파일만 같은 단계로 이동할 수 있습니다.따라서 종속 서버는 주 서버의 보기 수량과 일치하는 IP 주소 수량을 필요로 한다.또한 기본적으로 종속 서버는 로컬 첫 번째 카드로 연결된 첫 번째 IP 주소로 동기화 요청을 보냅니다. 조정하지 않으면 종속 서버 보기에서 로컬 첫 번째 카드로 연결된 첫 번째 IP 주소가 메인 서버에 있는 그 보기의 메시지만 동기화됩니다.이 때 우리는 종속 서버의 보기에transfer를 설정해야 한다­source 키워드.예: 종속 서버의 named.conf의 예 options {directory "/var/named";;acl "foo­subnet"{ 192.168.0/25; }; view "internal"{ //internal view of our zones match­clients { "foo­subnet"; }; transfer­source 192.168.0.1; zone "zhoutao.com"{ type slave ; masters {192.168.0.254;}; file "zhoutao.com.0­127.zone"; };      }; view "external"{ //view of our zones for the rest of the world match­clients { any; }; //implicit transfer­source 192.168.0.201; recursion no;           //outside of our subnet, they shouldn't be//requesting recursion zone "zhoutao.com"{ type slave;\masters { 192.168.0.254; }; file "zhoutao.external.zone"; //external zone data file };    }; 192.168.0.1과 192.168.0.201은 모두 서버에 속하는 로컬 IP 주소입니다.동시에 보기에서 그것들은 또 다른 보기로 나누어진다.bindview 실험 시뮬레이션 남북 전신망 통신자 예를 들어 www.zhoutao.이 사이트는 전신망통 2개 네트워크의 고객 체험을 향상시키고 사용자로 하여금 가장 빠른 방문 속도를 체험하게 하기 위해 전신망통과 망통에 각각 2대의 서버를 설치하기로 결정했다. 그 중에서 1대는 전신에 접속하고 1대는 접속망통으로 사용자측이 투명하게 이 사이트를 방문하도록 한다. 사용자가 인공적인 사이트 선택을 할 필요가 없다.dns 서버view 기능을 사용하여 서로 다른 IP 주소가 서로 다른 네트워크에 있는 호스트를 가리키도록 합니다. 예를 들어 www.zhoutao를 보세요.com 시 망통 사용자가 망통을 방문하는 호스트, 예를 들어 192.168.3.128, 전신 사용자가 전신을 방문하는 호스트는 192.168.3.129, 다른 미지의 인터넷 사용자가 192.168.3.130을 방문한다. 이 호스트 실험 환경은 192.168.3.128(주 DNS 서버) 192.168.3.129(전신) 192.168.3.130(망통)에 bindyum install bind-utils bind-chroot를 설치하여 named를 수정한다.conf 구성 파일

  
  
  
  
  1. // 
  2. // Sample named.conf BIND DNS server 'named' configuration file 
  3. // for the Red Hat BIND distribution. 
  4. // 
  5. // See the BIND Administrator's Reference Manual (ARM) for details, in: 
  6. //   file:///usr/share/doc/bind-*/arm/Bv9ARM.html 
  7. // Also see the BIND Configuration GUI : /usr/bin/system-config-bind and 
  8. // its manual. 
  9. // 
  10. include                 "/etc/dx.cfg"; 
  11. include                 "/etc/wt.cfg"; 
  12. options 
  13.         // Those options should be used carefully because they disable port 
  14.         // randomization 
  15.         // query-source    port 53; 
  16.         // query-source-v6 port 53; 
  17.  
  18.         // Put files that named is allowed to write in the data/ directory: 
  19.         directory "/var/named"; // the default 
  20.         dump-file               "data/cache_dump.db"; 
  21.         statistics-file         "data/named_stats.txt"; 
  22.         memstatistics-file      "data/named_mem_stats.txt"; 
  23. }; 
  24. logging 
  25. /*      If you want to enable debugging, eg. using the 'rndc trace' command, 
  26.  *      named will try to write the 'named.run' file in the $directory (/var/named). 
  27.  *      By default, SELinux policy does not allow named to modify the /var/named directory, 
  28.  *      so put the default debug log file in data/ : 
  29.  */ 
  30.         channel default_debug { 
  31.                 file "data/named.run"; 
  32.                 severity dynamic; 
  33.         }; 
  34. }; 
  35. // 
  36. // All BIND 9 zones are in a "view", which allow different zones to be served 
  37. // to different types of client addresses, and for options to be set for groups 
  38. // of zones. 
  39. // 
  40. // By default, if named.conf contains no "view" clauses, all zones are in the 
  41. // "default" view, which matches all clients. 
  42. // 
  43. // If named.conf contains any "view" clause, then all zones MUST be in a view; 
  44. // so it is recommended to start off using views to avoid having to restructure 
  45. // your configuration files in the future. 
  46. // 
  47. #view "localhost_resolver" 
  48. #{ 
  49. /* This view sets up named to be a localhost resolver ( caching only nameserver ). 
  50.  * If all you want is a caching-only nameserver, then you need only define this view: 
  51.  */ 
  52. #       match-clients           { localhost; }; 
  53. #       match-destinations      { localhost; }; 
  54. #       recursion yes; 
  55.         # all views must contain the root hints zone: 
  56. #       include "/etc/named.root.hints"; 
  57.  
  58.         /* these are zones that contain definitions for all the localhost 
  59.          * names and addresses, as recommended in RFC1912 - these names should 
  60.          * ONLY be served to localhost clients: 
  61.          */ 
  62.         #include "/etc/named.rfc1912.zones"; 
  63. #}; 
  64.  
  65. view "dxzone" { 
  66. match-clients { dx; }; 
  67. recursion yes; 
  68. zone "zhoutao.com"{ 
  69. type master; 
  70. file "dx/zhoutao.com.zone"; 
  71. }; 
  72. }; 
  73.  
  74. view "wtzone" { 
  75. match-clients { wt; }; 
  76. recursion yes; 
  77. zone "zhoutao.com"{ 
  78. type master; 
  79. file "wt/zhoutao.com.zone"; 
  80. }; 
  81. }; 
  82.  
  83. view "otherzone" { 
  84. match-clients { any; }; 
  85. recursion yes; 
  86. zone"zhoutao.com"{ 
  87. type master; 
  88. file "others/zhoutao.com.zone"; 
  89. }; 
  90. }; 

etc에서 dx를 만듭니다.cfg 및 wt.cfg 구성 파일[root@localhost etc]# cat dx.cfg acl dx {192.168.3.129;}; [root@localhost etc]# cat wt.cfg acl wt {192.168.3.130;}; /var/named/chroot/var/named에서 3개의 영역 폴더 mkdir dx wt others 만들기root@localhost named]# ls data  dx  others  slaves  wt vimdiff dx/zhoutao.com.zone wt/zhoutao.com.zone others/zhoutao.com.zone  

  
  
  
  
  1. [root@localhost named]# cat dx/zhoutao.com.zone  
  2. $TTL    86400 
  3. @               IN SOA  @       root ( 
  4.                                         42              ; serial (d. adams) 
  5.                                         3H              ; refresh 
  6.                                         15M             ; retry 
  7.                                         1W              ; expiry 
  8.                                         1D )            ; minimum 
  9.  
  10.                 IN NS           @ 
  11. www             IN A            192.168.3.129 
  12.                 IN AAAA         ::1 
  13.  
  14. [root@localhost named]# cat wt/zhoutao.com.zone  
  15. $TTL    86400 
  16. @               IN SOA  @       root ( 
  17.                                         42              ; serial (d. adams) 
  18.                                         3H              ; refresh 
  19.                                         15M             ; retry 
  20.                                         1W              ; expiry 
  21.                                         1D )            ; minimum 
  22.  
  23.                 IN NS           @ 
  24. www             IN A            192.168.3.130 
  25.                 IN AAAA         ::1 
  26.  
  27. [root@localhost named]# cat others/zhoutao.com.zone  
  28. $TTL    86400 
  29. @               IN SOA  @       root ( 
  30.                                         42              ; serial (d. adams) 
  31.                                         3H              ; refresh 
  32.                                         15M             ; retry 
  33.                                         1W              ; expiry 
  34.                                         1D )            ; minimum 
  35.  
  36.                 IN NS           @ 
  37. www             IN A            192.168.3.128 
  38.                 IN AAAA         ::1 

/etc/init.d/named start resolv를 수정합니다.conf는dig 또는host 명령으로 192.168.3.129에서 테스트합니다[root@localhost etc]# host www.zhoutao.com www.zhoutao.com has address 192.168.3.129 192.168.3.130에서root@localhost ~]# host www.zhoutao.com www.zhoutao.com has address 192.168.3.130 www.zhoutao.com has IPv6 address: 1 기본 192.168.1.7 [zhoutao@WorkSpace ~]$ host www.zhoutao.com www.zhoutao.com has address 192.168.3.128 www.zhoutao.com has IPv6 address::1

좋은 웹페이지 즐겨찾기