System/Linux

시간 동기화 time sync (ntp, manual, hwclock)

JJuno 2018. 7. 23.

NTP 시간 동기화 ntp time sync

1. 현재 시간날짜 확인 Check current time & date
[root@JJuno ~]# date
Mon Jul 23 16:47:42 KST 2018

 

2. /etc/ntp.conf파일의 server로 시작하는 라인 편집 Edit lines beginning with 'server' at /etc/ntp.conf file
[root@JJuno ~]# cat /etc/ntp.conf
server time.bora.net

 

3. ntp서버 재시작 restart ntp service

[root@JJuno ~]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
Starting ntpd:                                             [  OK  ]
[root@JJuno ~]#

 

4. 현재 ntp서버 확인 Check current ntp server

[root@JJuno ~]# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
 time.bora.net   ..{...          16 u   19   64    0    0.000    0.000   0.000
 

5. NTP서버의 시간으로 동기화 하기 Update time & date from ntp server 

NTP socket is in use라는 에러가 뜨면 ntp 서비스 잠시 중지하고 재시도 if you see 'the NTP socket is in use' then, ntpd stop and retry

[root@JJuno ~]# ntpdate time.bora.net 
6 Feb 01:18:38 ntpdate[30057]: the NTP socket is in use, exiting 
[root@JJuno ~]# service ntpd stop 
Shutting down ntpd: [ OK ] 
[root@JJuno ~]# ntpdate time.bora.net 
23 Jul 17:07:37 ntpdate[30077]: step time server 203.248.240.140 offset 14485731.430276 sec 
[root@JJuno ~]# date Mon Jul 23 17:07:42 KST 2018 
[root@JJuno ~]# service ntpd start 
Starting ntpd: [ OK ] 
[root@JJuno ~]#

 

수동 시간 동기화 manual time sync

1. date 020601052018 = 2018. 02. 06. (Tue) 01:05:00

02(month) 06(day) 01(hour) 05(minute) 2018(year)

 

[root@JJuno ~]# date
Mon Jul 23 16:53:47 KST 2018
[root@JJuno ~]# date 020601052018
Tue Feb  6 01:05:00 KST 2018

 

하드웨어 시간 동기화 hardware time sync

1. 현재 하드웨어 시간 확인 Check Hardware time & date
[root@JJuno ~]# hwclock --show
Mon 23 Jul 2018 04:55:01 PM KST  -0.595780 seconds
 

2. OS시간으로 하드웨어 시간 동기화 Sync OS time&date -> HW time&date 'hwclock -w'

[root@JJuno ~]# hwclock -w
[root@JJuno ~]# hwclock --show
Tue 06 Feb 2018 01:10:59 AM KST  -0.687930 seconds
 

3. 하드웨어 시간으로 OS시간 동기화 If you want to Sync HW time&date -> OS time&date, use '-s' option

[root@JJuno ~]# date
Mon Jul 23 17:11:40 KST 2018
[root@JJuno ~]# hwclock -s
[root@JJuno ~]# date
Tue Feb  6 01:22:57 KST 2018
 

 

728x90

댓글

💲 추천 글