Ubuntu 22.04にNTP サーバーChronyをインストールする

環境
OSバージョンの確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
# cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"
# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy
DISTRIB_DESCRIPTION="Ubuntu 22.04 LTS"

Chrony のインストール方法
1.Chronyをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# apt -y install chrony
# apt -y install chrony
# apt -y install chrony

2.配置ファイルを設定します
# vi /etc/chrony/chrony.conf
20行目~23行目
修正前

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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
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
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

修正後

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
#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
pool ntp.nict.jp 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 pool ntp.nict.jp 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
pool ntp.nict.jp iburst

3.chronyを再起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl restart chrony
# systemctl restart chrony
# systemctl restart chrony

4.時刻同期確認

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# chronyc sources
MS Name/IP address Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp-b2.nict.go.jp 1 6 17 39 +416us[ -496us] +/- 12ms
^+ ntp-a2.nict.go.jp 1 6 17 39 -1689us[-2601us] +/- 9727us
^+ ntp-k1.nict.jp 1 6 17 39 +492us[ -420us] +/- 17ms
^- ntp-b3.nict.go.jp 1 6 17 40 +1691us[+1691us] +/- 13ms
# chronyc sources MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* ntp-b2.nict.go.jp 1 6 17 39 +416us[ -496us] +/- 12ms ^+ ntp-a2.nict.go.jp 1 6 17 39 -1689us[-2601us] +/- 9727us ^+ ntp-k1.nict.jp 1 6 17 39 +492us[ -420us] +/- 17ms ^- ntp-b3.nict.go.jp 1 6 17 40 +1691us[+1691us] +/- 13ms
# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* ntp-b2.nict.go.jp             1   6    17    39   +416us[ -496us] +/-   12ms
^+ ntp-a2.nict.go.jp             1   6    17    39  -1689us[-2601us] +/- 9727us
^+ ntp-k1.nict.jp                1   6    17    39   +492us[ -420us] +/-   17ms
^- ntp-b3.nict.go.jp             1   6    17    40  +1691us[+1691us] +/-   13ms

 

Ubuntu 22.04

Posted by arkgame