[Linux] DNS

ondacloud·2025년 3월 24일
0

Linux

목록 보기
6/10
post-thumbnail

What is DNS?

Domain Name System의 약자로 호스트의 도메인을 호스트의 네트워크 주소로 변환해주는 것


DNS 구성 요소

  1. Domain Name System
  2. Name Server
  3. Resolver

DNS Record

TypeFull NameDescription
AHost Record (IPv4)FQDN과 32 bit의 IPv4로 연결
AAAAHost Record (IPv6)FQDN과 128 bit의 IPv6로 연결
CNAMEAlias Record (별칭)실제 도메인 이름과 연결되는 가상 도메인 이름을 정의
SOAStart Of Authority권한 시작을 지정하며, 권한이 있는 서버를 가리킴
NSName Server도메인 서버 목록을 지정
MXMail Exchange Record주어진 사서함에 도달할 수 있는 라우팅 정보를 제공
SRVService Resources비슷한 TCP/IP 서비스를 제공하는 다수의 서버 위치 정보를 제공

Setting DNS

Forward

apt install -y bind9 bind9-utils bind9-dnsutils
vim /etc/resolv.conf
nameserver 192.168.0.1
vim /etc/bind/named.conf
zone  "naver.com"{
	type master;
	file "naver.zone";
};
vim /etc/bind/named.conf.options
dnssec-validation no;
cp /etc/bind/db.local /var/cache/bind/naver.zone
vim /var/cache/bind/naver.zone
:%s/localhost/ns.naver.com/g
   	IN	A	192.168.0.1
ns	IN	A	192.168.0.1
www	IN	A	192.168.0.2
systemctl restart bind9

Lookup

apt install -y bind9 bind9-utils bind9-dnsutils
vim /etc/resolv.conf
nameserver 192.168.0.1
vim /etc/bind/named.conf
zone  "0.168.192.in-addr.arpa"{
	type master;
	file "naver.re.zone";
};
vim /etc/bind/named.conf.options
dnssec-validation no;
cp /etc/bind/db.local /var/cache/bind/naver.zone
vim /var/cache/bind/naver.zone
:%s/localhost/ns.naver.com/g
   	IN	A	192.168.0.1
ns	IN	A	192.168.0.1
www	IN	A	192.168.0.2
cp /etc/bind/db.local /var/cache/bind/naver.re.zone
vim /var/cache/bind/naver.re.zone
:%s/localhost/ns.naver.com/g
1   IN	PTR ns.naver.com.
systemctl restart bind9

Master & Slave
Master

apt install -y bind9 bind9-utils bind9-dnsutils
vim /etc/resolv.conf
nameserver 192.168.0.1
search example.com
domain example.com
vim /etc/bind/named.conf
zone  "example.com" {
	type master;
	file "example.zone";
	allow-update { any; };
	allow-transfer { 192.168.0.2; };
};

zone  "0.168.192.in-addr.arpa" {
	type master;
	file "example.re.zone";
	allow-update { any; };
	allow-transfer { 192.168.0.2; };
};
vim /etc/bind/named.conf.options
dnssec-validation no;
cp /etc/bind/db.local /var/cache/bind/example.zone
vim /var/cache/bind/example.zone
:%s/localhost/Master.example.com/g
Master IN	A	192.168.0.1
ns	   IN	A	192.168.0.1
www	   IN	A	192.168.0.2
cp /etc/bind/db.local /var/cache/bind/naver.re.zone
vim /var/cache/bind/example.re.zone
:%s/localhost/ns.naver.com/g
1  IN	PTR	ns.example.com.
systemctl restart bind9

Slave

apt install -y bind9 bind9-utils bind9-dnsutils
vim /etc/resolv.conf
nameserver 192.168.0.2
search example.com
domain example.com
vim /etc/bind/named.conf
zone  "example.com" {
	type slave;
	masters { 192.168.0.1; };
	file "example.zone";
};

zone  "0.168.192.in-addr.arpa" {
	type slave;
	masters { 192.168.0.1; };
	file "example.re.zone";
};
systemctl restart bind9
profile
클라우드 엔지니어가 목표인 학생

0개의 댓글