bind 9.3 부터는 환경설정 파일로 named.conf 대신에 name.caching-nameserver.conf 사용한다.
1. 설치 방법
yum install bind bind-utils caching-nameserver
2. 환경 설정 * 주의 : 환경설정파일의 소유자는 root, 소유그룹이 named이여야 함
* 소유권변경방법: chown root:named 파일명
1) vi /etc/named.caching-nameserver.conf 편집
options { listen-on port 53 { 112.171.147.40; }; (--------1차 네임서버 ip) // 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"; // Those options should be used carefully because they disable port // randomization query-source port 53; 주석해제 // query-source-v6 port 53; allow-query { any; }; // allow-query-cache { localhost; }; allow-transfer { 112.171.147.0/24; }; 대역추가 }; logging { channel default_debug { file "data/named.run"; severity dynamic; }; }; view localhost_resolver { match-clients { any; }; match-destinations { any; }; recursion yes; include "/etc/named.rfc1912.zones"; }; |
2) vi /etc/named.rfc1912.zones 편집
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 "paeksang.com" IN { type master; 설정할 도메인을 추가. file "paeksang.com.zone"; allow-update { none; }; }; |
3) zone 파일 생성(미리생성된 /var/named/localdomain.zone 파일을 복사하여 수정함)
# cp localdomain.zone paeksang.com.zone ---> 파일생성
# chown root:named paeksang.com.zone ---> 파일의 소유권 변경
4) 생성한 zone 파일수정 ( #vi /var/named/paeksang.com.zone )
$TTL 86400 @ IN SOA ns1.paeksang.com. root.ns1.paeksang.com. ( 2007112105 ; Serial 28800 ; Refresh 14400 ; Retry 3600000 ; Expire 86400 ) ; Minimum IN NS ns1.paeksang.com. IN MX 10 mail.paeksang.com. IN A 112.171.147.2 www IN A 112.171.147.2 ns1 IN A 112.171.147.2 mail IN A 112.171.147.2 * IN A 112.171.147.2 test IN A 211.49.162.150 |
3. 데몬구동 ( # service named restart )
4. 네임서버의 dns지정을 설정한 dns서버의 ip로 변경 ( # vi /etc/resolve.conf 에서 네임서버의 아이피를 변경함)
5. nslookup으로 네임서버 구동 확인
[root@ns1 ~]# nslookup > paeksang.com Server: 112.171.147.2 Address: 112.171.147.2#53 Name: paeksang.com Address: 112.171.147.2 > ns1.paeksang.com Server: 112.171.147.2 Address: 112.171.147.2#53 Name: ns1.paeksang.com Address: 112.171.147.2 > test.paeksang.com Server: 112.171.147.2 Address: 112.171.147.2#53 Name: test.paeksang.com Address: 211.49.162.150 > |
네임서버 설정후에는 도메인등록업체에 호스트등록을해야함