DNS 설정 점검

Prev Next

Classic 환경에서 이용 가능합니다.

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

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

참고

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

  1. DHCP에서 받아온 네이버 클라우드 플랫폼 DNS 설정값을 확인해 주십시오. Classic 환경에서 제공되는 DNS 서버의 IP는 10.39.254.13510.39.254.136 입니다.

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

    [root@centos78 ~]# cat /etc/resolv.conf
    ; generated by /usr/sbin/dhclient-script
    search gov-ncloud.com
    nameserver 10.39.254.135
    nameserver 10.39.254.136
    
    Plain text
  3. nslookup 명령어로 DNS 쿼리 동작을 확인해 주십시오.
    정상적으로 쿼리가 동작할 경우 10.250.69.32가 출력됩니다.

    [root@centos78 ~]# nslookup repo.gov-ncloud.com
    Server:		10.39.254.135
    Address:	10.39.254.135#53
    
    Non-authoritative answer:
    repo.gov-ncloud.com	canonical name = repo.gov-ncloud.grm.ncloud.com.
    Name:	repo.gov-ncloud.grm.ncloud.com
    Address: 10.250.69.32
    
    Plain text

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

참고

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

  1. /etc/resolv.conf 파일 설정 및 내용을 확인해 주십시오.
    파일의 Symbolic Link 여부 확인를 확인해 주십시오.
    root@ubuntu1804:~# ll /etc/resolv.conf
    lrwxrwxrwx 1 root root 39 Sep 28  2020 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf
    
    Plain text
    파일의 내용을 확인해 주십시오.
    root@ubuntu1804:~# cat /etc/resolv.conf
    # This file is managed by man:systemd-resolved(8). Do not edit.
    ... 생략 ...
    nameserver 127.0.0.53
    options edns0
    search gov-ncloud.com
    
    Plain text
  2. DHCP에서 받아온 네이버 클라우드 DNS 설정값을 확인해 주십시오.
    root@ubuntu1804:~# cat /run/systemd/resolved.conf.d/isc-dhcp-v4-eth0.conf
    [Resolve]
    DNS=10.39.254.135 10.39.254.136
    Domains= gov-ncloud.com
    
    Plain text
  3. OS상에서 설정된 DNS 설정값을 확인해 주십시오.
    Classic 환경에서 제공되는 DNS 서버의 IP는 10.39.254.13510.39.254.136 입니다.
    root@ubuntu1804:~# cat /run/systemd/resolve/resolv.conf
    ... 생략 ...
    nameserver 10.39.254.135
    nameserver 10.39.254.136
    search gov-ncloud.com
    
    Plain text
    만약 아래와 같이 보인다면, DNS 서버 설정이 정상적으로 안된 상태입니다.
    root@ubuntu1804:~# tail -2 /run/systemd/resolve/resolv.conf
    
    # No DNS servers known.
    
    Plain text
    아래와 같이 처리 가능합니다.
    root@ubuntu1804:~# cat /run/systemd/resolved.conf.d/isc-dhcp-v4-eth0.conf
    [Resolve]
    DNS=10.39.254.135 10.39.254.136
    Domains= gov-ncloud.com
    
    root@ubuntu1804:~# systemctl restart systemd-resolved
    root@ubuntu18:~# tail -3 /run/systemd/resolve/resolv.conf
    nameserver 10.39.254.135
    nameserver 10.39.254.136
    search gov-ncloud.com
    
    Plain text
  4. systemd-resolved 데몬의 기동 여부 및 상태 확인해 주십시오.
    설치된 unit 목록에서 systemd-resolved 데몬이 enabled 상태여야 부팅 후에도 정상 동작 가능합니다.
     root@ubuntu1804:~# systemctl list-unit-files | grep systemd-resolved.service
     systemd-resolved.service               enabled
    
    Plain text
    systemd-resolved 데몬이 active 상태여야 정상 동작이 가능합니다.
    root@ubuntu1804:~# 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 Sat 2023-01-07 16:04:37 KST; 2 months 6 days 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: 711 (systemd-resolve)
       Status: "Processing requests..."
        Tasks: 1 (limit: 4637)
       CGroup: /system.slice/systemd-resolved.service
               └─711 /lib/systemd/systemd-resolved
    
    Plain text
    IP 주소 127.0.0.53의 연결 상태 확인해 주십시오.
    systemd-resolve 서비스에 의해 53(nameservice port) 포트를 통해 LISTEN 중인 것을 확인해 주십시오.
    root@ubuntu1804:~# 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
    
    Plain text
  5. systemd-resolve 서비스에서 DNS 설정값 확인해 주십시오.
    아래의 명령어로 쿼리를 날리는 DNS 서버 정보를 확인해 주십시오.
    root@ubuntu1804:~# systemd-resolve --status
    Global
             DNS Servers: 10.39.254.135
                          10.39.254.136
     ... 생략 ...
    
    Plain text
  6. /etc/hosts 파일의 권한을 확인해 주십시오.
    /etc/hosts 파일의 Other User에 read 권한을 부여해야 systemd-resolved 데몬이 정상 동작 가능합니다. 기본 설정으로 /etc/hosts 파일의 권한은 644로 되어있습니다.
    root@ubuntu1804:~# ls -l /etc/hosts
    -rw-r--r-- 1 root root 189 Sep 28  2020 /etc/hosts
    
    Plain text
  7. nslookup 명령어로 DNS 쿼리 동작을 확인해 주십시오.
    정상적으로 쿼리가 동작할 경우 10.250.69.32가 출력됩니다.
    root@ubuntu18:~# nslookup repo.gov-ncloud.com
    Server:		127.0.0.53
    Address:	127.0.0.53#53
    
    Non-authoritative answer:
    repo.gov-ncloud.com	canonical name = repo.gov-ncloud.grm.ncloud.com.
    Name:	repo.gov-ncloud.grm.ncloud.com
    Address: 10.250.69.32
    
    Plain text
[root@ncp-server ~]# nslookup repo.gov-ncloud.com
Server:		10.39.254.135
Address:	10.39.254.135#53

Non-authoritative answer:
repo.gov-ncloud.com	canonical name = repo.gov-ncloud.grm.ncloud.com.
Name:	repo.gov-ncloud.grm.ncloud.com
Address: 10.250.69.32

nslookup: isc_socket_bind: address in use
Plain text

해당 이슈는 고객 서비스 네트워크 환경에 비해 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
Plain text

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

[root@ncp-server ~]# nslookup repo.gov-ncloud.com
Server:		10.39.254.135
Address:	10.39.254.135#53

Non-authoritative answer:
repo.gov-ncloud.com	canonical name = repo.gov-ncloud.grm.ncloud.com.
Name:	repo.gov-ncloud.grm.ncloud.com
Address: 10.250.69.32
Plain text