728x90
반응형
우분투 24.04에서 BIND9를 설치하는 방법
테스트 환경
운영체제 정보
$ lsb_release -d
Description: Ubuntu 24.04.3 LTS
1. BIND9 설치
패키지 목록 업데이트
sudo apt update
BIND9 설치
sudo apt install -y bind9 bind9-utils dnsutils
버전 확인
named -v
BIND 9.18.39-0ubuntu0.24.04.2-Ubuntu (Extended Support Version) <id:>
- 우분투 24.04에서도 9.18 ESV가 기본이며 장기 운영에 안정적인 선택입니다.
2. BIND9 기본 설정 구조
/etc/bind/named.conf : 메인 설정 파일
/etc/bind/named.conf.options : 캐시/리졸버 동작 설정
3. 메인 설정 파일 확인
sudo vim /etc/bind/named.conf
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian for information on the
// structure of BIND configuration files in Debian, *BEFORE* you customize
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local
include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";
include "/etc/bind/named.conf.default-zones";
캐시 DNS 전용이라면
named.conf.local에는 아무 존(Zone)도 정의하지 않는 것이 정석입니다.
4. 캐시 DNS 설정(named.conf.options)
sudo vim /etc/bind/named.conf.options
더보기
---
cat /etc/bind/named.conf.options
options {
directory "/var/cache/bind";
// If there is a firewall between you and nameservers you want
// to talk to, you may need to fix the firewall to allow multiple
// ports to talk. See http://www.kb.cert.org/vuls/id/800113
// If your ISP provided one or more IP addresses for stable
// nameservers, you probably want to use them as forwarders.
// Uncomment the following block, and insert the addresses replacing
// the all-0's placeholder.
// forwarders {
// 0.0.0.0;
// };
//========================================================================
// If BIND logs error messages about the root key being expired,
// you will need to update your keys. See https://www.isc.org/bind-keys
//========================================================================
dnssec-validation auto;
listen-on-v6 { any; };
};
---
options {
directory "/var/cache/bind";
listen-on { any; };
listen-on-v6 { any; };
allow-query { any; };
recursion yes;
allow-recursion { any; };
// 외부 DNS Forwarder
forwarders {
8.8.8.8;
8.8.4.4;
};
// 보안 권장 옵션
dnssec-validation auto;
auth-nxdomain no;
// 불필요한 정보 최소화
version "not currently available";
};
- recursion yes; → 캐시 DNS의 핵심
- forwarders → Google / Cloudflare / 내부 상위 DNS 사용 가능
- allow-transfer/allow-update → 캐시 DNS에서는 불필요(명시 안 함)
쿼리 로깅 활성화
캐시 DNS 운영 시 queries 로그만 있어도 충분합니다.
로그 디렉터리 생성
sudo mkdir -p /var/log/named
sudo chown bind:bind /var/log/named
sudo chmod 755 /var/log/named
간결한 로깅 설정(named.logging.conf)
sudo vim /etc/bind/named.logging.conf
logging {
channel general_log {
file "/var/log/named/general.log" versions 3 size 20m;
severity notice;
print-time yes;
print-severity yes;
print-category yes;
print-source yes;
};
channel query_log {
file "/var/log/named/queries.log" versions 5 size 50m;
severity info;
print-time yes;
print-severity yes;
print-category yes;
print-source yes;
};
channel security_log {
file "/var/log/named/security.log" versions 3 size 20m;
severity warning;
print-time yes;
print-severity yes;
print-category yes;
print-source yes;
};
category queries { query_log; };
category general { general_log; };
category security { security_log; };
};
named.conf에 포함
sudo vim /etc/bind/named.conf.options
include "/etc/bind/named.logging.conf";
설정 파일 검증
전체 설정 검사
sudo named-checkconf
BIND9 서비스 시작
서비스 활성화 및 시작
sudo systemctl enable --now named
상태 확인
sudo systemctl status named
캐시 DNS 동작 테스트
로컬 테스트
dig @127.0.0.1 google.com
캐시 확인(두 번 연속 실행)
dig @127.0.0.1 google.com
dig @127.0.0.1 google.com
로깅 { 채널 일반_로그 { 파일 "/var/log/named/general.log" 버전 3 크기 20m; 심각도 통지; 인쇄 시간 예; 인쇄 심각도 예; 인쇄 카테고리 예; 인쇄 소스 예; }; 채널 쿼리_로그 { 파일 "/var/log/named/queries.log" 버전 5 크기 50m; 심각도 정보; 인쇄 시간 예; 인쇄 심각도 예; 인쇄 카테고리 예; 인쇄 소스 예; }; 채널 security_log { 파일 "/var/log/named/security.log" 버전 3 크기 20m; 심각도 경고; 인쇄 시간 예; 인쇄 심각도 예; 인쇄 카테고리 예; 인쇄 소스 예; }; 카테고리 쿼리 { query_log; }; 카테고리 일반 { General_log; }; 카테고리 보안 { security_log; }; };
728x90
반응형
'네임서버' 카테고리의 다른 글
| 우분투 22에서 BIND 9를 소스에서 설치하고 systemd 서비스로 등록하는 방법 (0) | 2025.05.12 |
|---|---|
| BIND9에 뷰를 설정하는 방법 (0) | 2025.05.09 |
| 우분투 22.04에서 BIND9를 설치하고 설정하는 방법 (0) | 2025.05.09 |
| CentOS 7에서 Unbound를 설치하고 DNSSEC을 활성화하여 사용하는 방법 (2) | 2024.10.05 |
| BIND에서 nsupdate 명령을 사용하여 동적으로 존을 변경하는 방법 (0) | 2024.05.29 |