[Ubuntu] NTP

Alexandria·2024년 3월 1일

Ubuntu

목록 보기
6/11
post-thumbnail

1. 설치

서버, 클라이언트 모두 NTP 패키지를 설치한다.

$ sudo apt -y install ntp

2. NTP 서버

/etc/ntp.conf를 수정한다.

ntp를 받아갈 클라이언트를 지정한다.

로컬 시스템의 시간을 기준점으로 삼기 위해 pool 관련 줄은 모두 주석처리하며 server를 지정한다.

$ sudo vi /etc/ntp.conf
...
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
...
server 127.127.1.0

서비스를 재시작한다.

$ sudo systemctl restart ntp

3. NTP 클라이언트

/etc/ntp.conf를 수정한다.

server에 ntp 서버의 주소를 넣는다.

$ sudo vi /etc/ntp.conf
...
server 192.168.0.97

서비스를 재시작한 뒤 일정시간 뒤에 시간이 동기화가 된다.

$ sudo systemctl restart ntp
$ ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 192.168.0.97    LOCAL(0)         6 u    1   64    1    0.294   -1.719   0.000
profile
IT 도서관

0개의 댓글