DNS 설정 점검
    • PDF

    DNS 설정 점검

    • PDF

    Article Summary

    네이버 클라우드 플랫폼에서 제공하는 DNS 설정을 사용하지 않으면, 내부 관리를 위해서 제공되는 서버와 정상 통신이 안될 수 있습니다. 가급적 별도 DNS 설정을 하지 않는 것을 권고합니다. 고객 측에서 별도의 DNS 설정을 하시면 내서버 이미지로 서버를 생성 하거나 관리자 비밀번호 설정하는 과정 등 네이버 클라우드 플랫폼 서비스를 사용하는 여러 상황에서 오류가 발생할 수 있습니다.

    CentOS, Rocky Linux

    네이버 클라우드 플랫폼에서 제공되고 있는 RedHat 계열의 OS에서 아래의 가이드를 통해서 DNS 설정값 및 파일을 점검 부탁드립니다.

    참고

    해당 가이드에서 지원하는 OS는 CentOS 7.3, CentOS 7.8, Rocky Linux 8.6 입니다.

    1. DHCP에서 받아온 네이버 클라우드 플랫폼 DNS 설정값을 확인합니다. VPC 환경에서 제공되는 DNS 서버의 IP는 169.254.169.53169.254.169.54 입니다.

      [root@centos78 ~]# grep domain-name /var/lib/dhclient/dhclient--eth0.lease
      option domain-name-servers 169.254.169.53,169.254.169.54;
      option domain-name-servers 169.254.169.53,169.254.169.54;
      
    2. /etc/resolv.conf 파일 설정 및 내용을 확인합니다.
      파일의 내용이 아래와 상이할 경우 네이버 클라우드 플랫폼 DNS 서버와 정상 통신이 안될 수 있습니다. 단, 파일 수정 후 OS 리부팅하면 DHCP로 부터 받아온 네이버 클라우드 플랫폼 설정값으로 초기화됩니다.

      [root@centos78 ~]# cat /etc/resolv.conf
      ; generated by /usr/sbin/dhclient-script
      nameserver 169.254.169.53
      nameserver 169.254.169.54
      
    3. nslookup 명령어로 DNS 쿼리 동작을 확인합니다.
      정상적으로 쿼리가 동작할 경우 169.254.1.5가 출력됩니다.

      [root@centos78 ~]# nslookup repo.fin-ncloud.com
      Server:		169.254.169.53
      Address:	169.254.169.53#53
      
      Non-authoritative answer:
      Name:	repo.fin-ncloud.com
      Address: 169.254.1.5
      

    Ubuntu

    네이버 클라우드 플랫폼에서 제공되고 있는 Ubuntu 18.04, Ubuntu 20.04는 systemd-resolved를 사용합니다. 아래의 가이드를 통해서 DNS 설정값 및 파일을 점검 부탁드립니다.

    참고

    해당 가이드에서 지원하는 OS는 Ubuntu 18.04, Ubuntu 20.04 입니다.

    1. /etc/resolv.conf 파일 설정 및 내용을 확인합니다.
      파일의 Symbolic Link 여부 확인를 확인합니다.

      • Ubuntu 18.04
      root@ubuntu1804:~# ll /etc/resolv.conf
      lrwxrwxrwx 1 root root 29 Nov 13  2019 /etc/resolv.conf -> ../run/resolvconf/resolv.conf
      
      • Ubuntu 20.04
      root@ubuntu2004:~# ll /etc/resolv.conf
      lrwxrwxrwx 1 root root 39 Aug 24  2021 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
      
    2. 파일의 내용을 확인합니다. 단, options edns0 trust-ad 옵션은 OS 버전에 따라서 없거나 옵션 항목이 다를 수 있습니다.

      • Ubuntu 18.04
      root@ubuntu1804:~# cat /etc/resolv.conf
      # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
      ... 생략 ...
      nameserver 127.0.0.53
      
      • Ubuntu 20.04
      root@ubuntu2004:~# cat /etc/resolv.conf
      # This file is managed by man:systemd-resolved(8). Do not edit.
      ... 생략 ...
      nameserver 127.0.0.53
      options edns0 trust-ad 
      
    3. DHCP에서 받아온 네이버 클라우드 플랫폼 DNS 설정값을 확인합니다.

      root@ubuntu2004:~# cat /run/systemd/resolved.conf.d/isc-dhcp-v4-eth0.conf
      [Resolve]
      DNS=169.254.169.53 169.254.169.54
      
    4. OS상에서 설정된 DNS 설정값을 확인합니다.
      VPC 환경에서 제공되는 DNS 서버의 IP는 169.254.169.53169.254.169.54 입니다.

      root@ubuntu2004:~# cat /run/systemd/resolve/resolv.conf
      ... 생략 ...
      nameserver 169.254.169.53
      nameserver 169.254.169.54
      

      만약 아래와 같이 보인다면, DNS 서버 설정이 비정상적인 상태입니다.

      root@ubuntu2004:~# tail -2 /run/systemd/resolve/resolv.conf
      
      # No DNS servers known.
      

      아래와 같이 처리 가능합니다.

      root@ubuntu2004:~# cat /run/systemd/resolved.conf.d/isc-dhcp-v4-eth0.conf
      [Resolve]
      DNS=169.254.169.53 169.254.169.54
      
      root@ubuntu2004:~# systemctl restart systemd-resolved
      root@ubuntu2004:~# tail -2 /run/systemd/resolve/resolv.conf
      nameserver 169.254.169.53
      nameserver 169.254.169.54
      
    5. systemd-resolved 데몬의 기동 여부 및 상태 확인합니다.
      설치된 unit 목록에서 systemd-resolved 데몬이 enabled 상태여야 부팅 후에도 정상 동작 가능합니다.

      root@ubuntu2004:~# systemctl list-unit-files | grep systemd-resolved.service
      systemd-resolved.service               enabled         enabled
      

      systemd-resolved 데몬이 active 상태여야 정상 동작이 가능합니다.

      root@ubuntu2004:~# systemctl status systemd-resolved.service
      ● systemd-resolved.service - Network Name Resolution
           Loaded: loaded (/lib/systemd/system/systemd-resolved.service; enabled; vendor preset: enabled)
           Active: active (running) since Sun 2023-04-09 20:35:16 KST; 14h ago
             Docs: man:systemd-resolved.service(8)
                   https://www.freedesktop.org/wiki/Software/systemd/resolved
                   https://www.freedesktop.org/wiki/Software/systemd/writing-network-configuration-managers
                   https://www.freedesktop.org/wiki/Software/systemd/writing-resolver-clients
         Main PID: 637 (systemd-resolve)
           Status: "Processing requests..."
            Tasks: 1 (limit: 4637)
           Memory: 4.6M
           CGroup: /system.slice/systemd-resolved.service
                   └─637 /lib/systemd/systemd-resolved
      

      IP 주소 127.0.0.53의 연결 상태 확인합니다.
      systemd-resolve 서비스에 의해 53(nameservice port) 포트를 통해 LISTEN 중인 것을 확인합니다.

      root@ubuntu2004:~# netstat -anp | grep 127.0.0.53
      tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      587/systemd-resolve
      udp        0      0 127.0.0.53:53           0.0.0.0:*                           587/systemd-resolve
      
    6. systemd-resolve 서비스에서 DNS 설정값 확인합니다.
      아래의 명령어로 쿼리를 날리는 DNS 서버 정보를 확인합니다.

      • Ubuntu 18.04
      root@ubuntu1804:~# systemd-resolve --status
      Global
               DNS Servers: 169.254.169.53
                            169.254.169.54
       ... 생략 ...
      
      • Ubuntu 20.04
      root@ubuntu2004:~# systemd-resolve --status
      Global
             LLMNR setting: no                 
      MulticastDNS setting: no                 
        DNSOverTLS setting: no                 
            DNSSEC setting: no                 
          DNSSEC supported: no                 
        Current DNS Server: 169.254.169.53     
               DNS Servers: 169.254.169.53     
                            169.254.169.54
      ... 생략 ...
      
    7. /etc/hosts 파일의 권한을 확인합니다.
      /etc/hosts 파일의 Other User에 read 권한을 부여해야 systemd-resolved 데몬이 정상 동작 가능합니다. 기본 설정으로 /etc/hosts 파일의 권한은 644로 되어있습니다.

      root@ubuntu2004:~# ls -l /etc/hosts
      -rw-r--r-- 1 root root 186 Jan 24  2022 /etc/hosts
      
    8. nslookup 명령어로 DNS 쿼리 동작을 확인합니다.
      정상적으로 쿼리가 동작할 경우 169.254.1.5가 출력됩니다.

      root@ubuntu2004:~# nslookup repo.fin-ncloud.com
      Server:		127.0.0.53
      Address:	127.0.0.53#53
      
      Non-authoritative answer:
      Name:	repo.fin-ncloud.com
      Address: 169.254.1.5
      

    DNS 관련 자주하는 질문

    Q. DNS 질의 시 아래와 같이 isc_socket_bind 에러가 발생합니다. 어떻게 조치를 해야 하나요?

    [root@ncp-server ~]# nslookup repo.fin-ncloud.com
    Server:		169.254.169.53
    Address:	169.254.169.53#53
    
    Non-authoritative answer:
    repo.fin-ncloud.com	canonical name = repo.fin-ncloud.grm.ncloud.com.
    repo.fin-ncloud.grm.ncloud.com	canonical name = fkr1-init.fin-ncloud.grm.ncloud.com.
    Name:	fkr1-init.fin-ncloud.grm.ncloud.com
    Address: 169.254.5.81
    
    nslookup: isc_socket_bind: address in use
    

    해당 이슈는 고객 서비스 네트워크 환경에 비해 ip_local_port_range 값이 너무 작거나, 현재 사용 중인 socket port가 과도하게 많은 경우에 발생합니다.
    ip_local_port_range는 아래와 같이 확인이 가능합니다. 기본값으로는 최소 포트 32768, 최대 포트 60999로 설정되어 있습니다.

    [root@ncp-server ~]# sysctl net.ipv4.ip_local_port_range
    net.ipv4.ip_local_port_range = 32768    60999
    

    리부팅 가능한 서버일 경우에는, 운영 체제에서 리부팅을 하시고 불가능한 경우에는 현재 사용 중인 소켓 개수를 확인하여 불필요한 소켓을 정리하거나 ip_local_port_range 값을 늘리는 것을 권장드립니다.
    정상 상태에서 DNS 질의할 경우에는 아래와 같이 출력되는 것을 확인할 수 있습니다.

    [root@ncp-server ~]# nslookup repo.fin-ncloud.com
    Server:		169.254.169.53
    Address:	169.254.169.53#53
    
    Non-authoritative answer:
    repo.fin-ncloud.com	canonical name = repo.fin-ncloud.grm.ncloud.com.
    repo.fin-ncloud.grm.ncloud.com	canonical name = fkr1-init.fin-ncloud.grm.ncloud.com.
    Name:	fkr1-init.fin-ncloud.grm.ncloud.com
    Address: 169.254.5.81 
    

    이 문서가 도움이 되었습니까?

    Changing your password will log you out immediately. Use the new password to log back in.
    First name must have atleast 2 characters. Numbers and special characters are not allowed.
    Last name must have atleast 1 characters. Numbers and special characters are not allowed.
    Enter a valid email
    Enter a valid password
    Your profile has been successfully updated.