반응형
우분투 24.04에서 사용하는 systemd-resolved DNS 캐시 관리 방법
1. systemd-resolved DNS 캐시 구조
systemd-resolved는 내부적으로 다음을 캐싱합니다.
- DNS query 결과 (A / AAAA / CNAME 등)
- negative cache (존재하지 않는 도메인 NXDOMAIN)
- LLMNR / mDNS 응답 (옵션)
즉, OS 레벨에서 DNS 응답을 임시 저장합니다.
2. DNS 캐시 플러시 (Flush)
전체 캐시 초기화
sudo resolvectl flush-caches
또는 (구버전 호환)
sudo systemd-resolve --flush-caches
확인
resolvectl statistics | grep "Current Cache Size"
Current Cache Size: 6
3. DNS 상태 및 캐시 통계 확인
resolvectl statistics
Transactions
Current Transactions: 0
Total Transactions: 185
Cache
Current Cache Size: 11
Cache Hits: 58
Cache Misses: 127
Failure Transactions
Total Timeouts: 0
Total Timeouts (Stale Data Served): 0
Total Failure Responses: 0
Total Failure Responses (Stale Data Served): 0
DNSSEC Verdicts
Secure: 0
Insecure: 0
Bogus: 0
Indeterminate: 0
확인 가능한 항목
- Cache Hits / Misses
- Cache Size
- DNSSEC 성공 여부
- Query 실패율
4. 특정 인터페이스 DNS 관리
인터페이스 기준으로 DNS를 따로 확인 가능
resolvectl status eno1
또는 전체
resolvectl status
5. DNS 서버 변경 (런타임 테스트)
Netplan 변경 없이 임시 테스트 가능
sudo resolvectl dns eno1 8.8.8.8 1.1.1.1
확인
resolvectl status eno1
Link 2 (eno1)
Current Scopes: DNS
Protocols: +DefaultRoute -LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
Current DNS Server: 1.1.1.1
DNS Servers: 8.8.8.8 1.1.1.1
resolvectl dns eno1 ... 같은 런타임 설정은 Netplan보다 우선권이 높고 persistent처럼 유지됨
런타임 DNS 초기화(Netplan DNS로 변경)
sudo resolvectl revert eno1
resolvectl status eno1
728x90
6. 특정 도메인 강제 확인 (디버깅용)
resolvectl query google.com
google.com: 142.250.197.46 -- link: eno1
2404:6800:4005:81f::200e -- link: eno1
-- Information acquired via protocol DNS in 172.6ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: network
또는 상세
resolvectl query google.com -i eno1
google.com: 142.250.197.46 -- link: eno1
2404:6800:4005:81f::200e -- link: eno1
-- Information acquired via protocol DNS in 1.4ms.
-- Data is authenticated: no; Data was acquired via local or encrypted transport: no
-- Data from: cache
7. 캐시 + DNS 문제 트러블슈팅 순서
DNS 장애 발생 시 보통 아래 순서로 확인합니다
1) 캐시 제거
sudo resolvectl flush-caches
2) DNS 상태 확인
resolvectl status
3) 실제 질의 테스트
resolvectl query google.com
4) 인터페이스 DNS 확인
resolvectl status eno1
8. systemd-resolved 재시작 (강력 초기화)
캐시 + 상태 모두 리셋
sudo systemctl restart systemd-resolved
참고URL
- 변군이글루 : 우분투 24.04 Stub Resolver 동작 및 설정 정리
728x90
반응형
'리눅스' 카테고리의 다른 글
| 우분투 24.04 Stub Resolver 동작 및 설정 정리 (0) | 2026.05.21 |
|---|---|
| 리눅스 특정 TTY 세션 제외 후 전체 SSH 세션 종료 방법 (0) | 2026.05.13 |
| MySQL 프로세스를 강제 종료하지 않고 정상 종료하는 방법 (0) | 2026.05.12 |
| Linux Bash 명령어 이력을 Syslog로 중앙 수집하는 방법 (0) | 2026.05.11 |
| 리눅스에서 사용자 명령어(history)를 rsyslog 중앙 로그 서버로 전송하는 방법 (0) | 2026.05.10 |