[Ubuntu] 02. NTP 서버 구성

Date:     Updated:

카테고리:

태그:


🔔 타임 서버(Time Server) 필요한 이유


전산실에서는 수많은 장비들이 운영되고 있으며 각 시스템들은 시스템 시간을 가지고 있습니다. 이때 시간이 모두 일치해야 각 시스템에서 생성되는 데이터, 로그, 보안 등에 관련된 것들이 시간에 대해 일관성을 가지게 됩니다. 하지만 시간이 지남에 따라 운영되는 시스템들의 시스템 시간이 불일치하게 되므로 동일한 시간을 가기 위해 시간 동기화를 할 필요가 있습니다2. 이때 사용되는 서버가 NTP(Network Time Protocol) 서버입니다.


🔔 NTP(Network Time Protocol)


네트워크를 통해 시스템 시간을 동기화 시키는 통신 프로토콜 또는 서비스

  • NTP는 시간만을 처리하는 원자 서버가 있으며 이를 “Stratum 0”이라고 부릅니다.

  • 그리고 NTP 서버와 직접 연결된 NTP 서버를 “Stratum 1”이라고 부릅니다.

  • “Stratum 1”, “Stratum 2”, “Stratum 3” 이런 형식으로 NTP는 계층적인 시스템을 사용합니다.

  • 전산실에 NTP 서버로 사용할 시스템을 두고 Stratum 서버와 시간을 동기화 설정을 하고 전산실 내에 있는 모든 시스템에 NTP 서비스를 통해 시간 동기화를 시키는 것이 일반적입니다.

  • 이렇게 하기 위해서는 NTP 서버/클라이언트 구성이 필요합니다.


■ Stratum Server

도메인 IP 주소 비고
time.kriss.re.kr 210.98.16.100 Stratum 1, 한국표준과학연구원
time2.kriss.re.kr 210.98.16.101 Stratum 1, 한국표준과학연구원
ntp.postech.ac.kr 141.223.182.106 Stratum 1, 포항공대
ntp.xbsd.pe.kr 58.73.137.250 Stratum 1, xbsd
gps.bora.net 210.120.246.46 Stratum 1, LGU+
ntp.kornet.net 168.126.3.6 Stratum 1, KT
ntp1.cs.pusan.ac.kr - Stratum 1, 부산대학교
ntp2.cs.pusan.ac.kr - Stratum 1, 부산대학교
ntp.ewha.or.kr 175.119.224.116 / 114.207.245.175 Stratum 2, 이화여대
maths.kaist.ac.kr 143.248.25.208 Stratum 2, 카이스트
time.bora.net 203.248.240.103 Stratum 2, LGU+
time.korserve.net 211.51.221.196 / 211.51.221.130 Stratum 2, korserve
rokkorclub.net 210.118.170.59 Stratum 2, rokkorclub
time.wonkwang.ac.kr 203.249.48.182 Stratum 2, 원광대학교
ntp1.epidc.co.kr 211.115.194.21 Stratum 2, epidc
ntp2.epidc.co.kr 211.115.194.22 Stratum 2, epidc
time.nuri.net - Stratum 2, 아이네트호스팅
cse.inha.ac.kr 165.246.43.176 Stratum 2, 인하대학교
radi.inha.ac.kr 165.246.43.195 Stratum 2, 인하대학교


🔔 NTP 서버 구성



■ chrony 설치 및 구성

$ dnf -y install chrony


$ vi /etc/chrony.conf


# line 20 : 기본 설정을 주석 처리하고 시간대에 맞는 NTP 서버를 추가
server time.bora.net iburst
#pool ntp.ubuntu.com        iburst maxsources 4
#pool 0.ubuntu.pool.ntp.org iburst maxsources 1
#pool 1.ubuntu.pool.ntp.org iburst maxsources 1
#pool 2.ubuntu.pool.ntp.org iburst maxsources 2

# 클라이언트로부터 시간 동기화 요청을 받을 수 있도록 허용하는 네트워크 범위 추가
allow 192.168.219.0/24


$ systemctl restart chrony


# 상태 확인
$ chronyc sources -v

  .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
 / .- Source state '*' = current best, '+' = combined, '-' = not combined,
| /             'x' = may be in error, '~' = too variable, '?' = unusable.
||                                                 .- xxxx [ yyyy ] +/- zzzz
||      Reachability register (octal) -.           |  xxxx = adjusted offset,
||      Log2(Polling interval) --.      |          |  yyyy = measured offset,
||                                \     |          |  zzzz = estimated error.
||                                 |    |           \
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* time.bora.net                 3   6     7     0    -16us[+8414us] +/-   48ms


🔔 NTP 클라이언트 구성



■ NTP 클라이언트 구성

  • Ubuntu에서는 기본적으로 NTP 클라이언트(systemd-timesyncd)가 실행되고 있으므로 쉽게 설정할 수 있다.

  • NTPd나 Chrony와 같은 서비스를 클라이언트로 사용할 수도 있다 이 경우에도 시간을 동기화하기 위해 NTP 서버만 설정하면 되며, 다른 호스트로부터 시간 동기화 요청을 받는 권한은 설정하지 않아도 된다.

$ vi /etc/systemd/timesyncd.conf

# 시간대에 맞는 NTP 서버 설정
NTP=ntp.srv.test


$ timedatectl timesync-status
       Server: 192.168.219.195 (ntp.srv.test)
Poll interval: 2min 8s (min: 32s; max 34min 8s)
         Leap: normal
      Version: 4
      Stratum: 4
    Reference: CBF8F08C
    Precision: 1us (-26)
Root distance: 40.435ms (max: 5s)
       Offset: +2.201ms
        Delay: 606us
       Jitter: 831us
 Packet count: 1
    Frequency: -61.596ppm

UBUNTU 카테고리 내 다른 글 보러가기

댓글 남기기