반응형
BIND 슬레이브 ZONE 파일 형식을 변경하는 방법(Binary Data → ASCII Text)
BIND 9.9 버전 이후부터 슬레이브(Slave) 서버의 존 파일 기본값은 성능 향상을 위해 raw(바이너리 데이터) 형식으로 저장됩니다. 이로 인해 cat이나 vi로 내용을 바로 확인할 수 없는 불편함이 있는데 masterfile-format 옵션을 통해 이를 텍스트 형식으로 변경할 수 있습니다.
Syntax: [ masterfile-format (text|raw) ; ]
masterfile-format
Specifies the file format of zone files (see Section 6.3.7). The default value is text, which is the standard textual representation, except for slave zones, in which the default value is raw. Files in other formats than text are typically expected to be generated by the namedcompilezone tool, or dumped by named.
Note that when a zone file in a different format than text is loaded, named may omit some of the checks which would be performed for a file in the text format. In particular, check-names checks do not apply for the raw format. This means a zone file in the raw format must be generated with the same check level as that specified in the named configuration file. This statement sets the masterfile-format for all zones, but can be overridden on a per-zone or per-view basis by including a masterfile-format statement within the zone or view block in the configuration file.
설정 방법 (named.conf)
모든 존 파일에 일괄 적용하거나 특정 존에만 개별적으로 적용할 수 있습니다.
전체(Global) 설정
- /etc/named.conf의 options 블록에 추가합니다.
vim /etc/named.conf
options {
...
# 슬레이브 존 파일을 텍스트 형식으로 저장하도록 설정
masterfile-format text;
...
};
개별(Zone) 설정
- 특정 도메인에만 적용하고 싶을 경우 zone 블록 안에 명시합니다.
vim /etc/named.conf
zone "mocha.scbyun.com" IN {
type slave;
file "slaves/mocha.scbyun.com.zone";
masters { 192.168.0.10; };
masterfile-format text; # 이 존에만 적용
};
728x90
적용 전후 비교
[적용 전] 기본값 (raw 형식)
- 파일 형식이 data로 인식되어 텍스트 편집기나 출력 명령어로 내용을 확인할 수 없습니다.
$ file mocha.scbyun.com.zone
mocha.scbyun.com.zone: data
$ cat mocha.scbyun.com.zone
(알 수 없는 바이너리 문자가 출력됨)
[적용 후] 변경값 (text 형식)
- 설정 적용 후 서비스를 재시작하거나 존을 재전송(rndc retransfer) 받으면 텍스트 형식으로 저장됩니다.
$ file mocha.scbyun.com.zone
mocha.scbyun.com.zone: ASCII text
$ cat mocha.scbyun.com.zone
$ORIGIN .
$TTL 60 ; 1 minute
mocha.scbyun.com IN SOA mocha.scbyun.com. root.mocha.scbyun.com. (
2023011601 ; serial
86400 ; refresh (1 day)
3600 ; retry (1 hour)
604800 ; expire (1 week)
10800 ; minimum (3 hours)
)
NS ns.mocha.scbyun.com.
NS ns2.mocha.scbyun.com.
A 192.168.0.61
$ORIGIN mocha.scbyun.com.
ns A 192.168.0.62
ns2 A 192.168.0.63
www CNAME mocha.scbyun.com.
주의사항 및 팁
적용 시점: 설정을 변경한 후에는 기존에 생성된 raw 파일이 자동으로 변환되지 않을 수 있습니다. 설정 적용 후 해당 존 파일을 삭제하고 named를 재시작하거나, rndc retransfer <zone> 명령어를 사용하여 마스터로부터 다시 받아오는 것이 확실합니다.
보안 및 성능: raw 형식은 로딩 속도가 빠르고 check-names 검사를 생략하여 리소스를 아낄 수 있습니다. 대규모 환경이 아니라면 관리 편의성을 위해 text 형식을 권장합니다.
명령어 확인: 만약 형식을 text로 바꾸지 않고 내용만 확인하고 싶다면 아래 명령어를 사용할 수 있습니다.
named-compilezone -f raw -F text -o - mocha.scbyun.com mocha.scbyun.com.zone
728x90
반응형
'네임서버' 카테고리의 다른 글
| CentOS 7에서 캐싱 전용 DNS 서버를 구성하는 방법(caching only nameserver) (0) | 2014.03.11 |
|---|---|
| bind 9 소스 컴파일 설치 (0) | 2013.11.08 |
| 슬레이브 DNS ZONE 파일 유형 변경 (0) | 2013.11.07 |
| bind(named) 기본 파일 확장자: $GENERATE 지시어 (0) | 2013.11.07 |
| BIND9 Query Log (0) | 2013.10.14 |