DNS server with CentOS

CentOs에서 DNS 및 Mail server 구축 실습

·

2 min read

  1. Install a web server for practice

     1-1
     yum -y install httpd # 웹서버 설치
     1-2
     systemctl restart httpd # 웹서비스 재시작
     1-3
     systemctl status httpd # 웹서비스 확인
     1-4
     vi /var/www/html/index.html # 웹 서버 초기 웹페이지 작성
     Welcome to CentOS # 입력 후 저장
    
  2. Install and configure the BIND package on the server

    • BIND - DNS server software
    2-1
    yum -y install bind bind-chroot # DNS 서버 구성에 필수적인 package설치
    2-2 
    systemctl restart named # named 재시작
    2-3 
    systemctl status named # named 상태 확인
    2-4 
    systemctl enable named # named 부팅시 자동 시작 설정
  1. Configure the server for the clinger.com domain

     3-1
     vi /etc/named.conf #네임서버 설정 변경
      12 options {
      13 listen-on port 53 {any;}; //listen-on port 53 { 127.0.0.1; };
      14 listen-on-v6 port 53 { ::1; };
      15 directory "/var/named";
      16 dump-file "/var/named/data/cache_dump.db";
      17 statistics-file "/var/named/data/named_stats.txt";
      18 memstatistics-file "/var/named/data/named_mem_stats.txt";
      19 recursing-file "/var/named/data/named.recursing";
      20 secroots-file "/var/named/data/named.secroots";
      21 allow-query { any; }; //allow-query { localhost; };
     ...
      36 dnssec-validation no; //dnssec-validation yes;
     ...
      62 zone "clinger.com" IN {
      63 type master;
      64 file "/var/named/clinger.com.db";
      65 allow-update { none; };
      66 };
    
     3-2
     named-checkconf # 해당 named설정이 문제 없는지 확인
    
     3-3
     cd /var/named # clinger.com.db파일 생성을 위해 해당 디렉토리로 이동
    
     3-4
     touch clinger.com.db # clinger.com.db파일 생성
    
     3-5
     vi clinger.com.db
     1 $TTL 3H
      2 @ SOA @ root. (2 1D 1H 1W 1H)
      3 IN NS @
      4 IN A 192.168.56.100
      5 www IN A 192.168.56.100
    
     3-6
     named-checkzone clinger.com clinger.com.db # 해당 zone설정이 문제 없는지 확인
    
     3-7
     systemctl restart named # named 재시작
    
     3-8
     systemctl status named # named 상태 확인 
    
     3-9
     vi /etc/resolv.conf # client server의 DNS서버를 방금 만든 DNS서버로 지정
     1 Generated by NetworkManager
      2 # search cloud.com
      3 # nameserver 168.126.63.1
      4 # nameserver 168.126.63.2
      5 # nameserver 8.8.8.8
      6 nameserver 192.168.56.100