![]() |
| ◆ | ntp のインストール |
|
時刻自動設定ソフトをインストールします。このソフトをインストール&設定することによりサーバーの時計を常に日本の標準時刻に合わせることができます。 下記のように入力します。青文字が入力文字です。 尚、Nothing to do と表示された場合はインストールされていますので設定のみを行って下さい。 |
|
| [root@linux]# yum install ntp ← yum inatall ntp を入力 fedora 100% |=========================| 2.1 kB 00:00 updates 100% |=========================| 2.3 kB 00:00 Setting up Install Process Parsing package install arguments Resolving Dependencies --> Running transaction check ---> Package ntp.i386 0:4.2.4p2-6.fc8 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ============================================================================= Installing: ntp i386 4.2.4p2-6.fc8 fedora 1.4 M Transaction Summary ============================================================================= Install 1 Package(s) Update 0 Package(s) Remove 0 Package(s) Total download size: 1.4 M Is this ok [y/N]: y ← y を入力 Downloading Packages: (1/1): ntp-4.2.4p2-6.fc8. 100% |=========================| 1.4 MB 00:03 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing: ntp ######################### [1/1] Installed: ntp.i386 0:4.2.4p2-6.fc8 Complete! ← Complete! と表示されれば完了 |
|
| ◆ | ntp の設定 |
| 時刻を日本標準時間に合わせます。 下記のように入力します。青文字が入力文字です。 |
|
| [root@linux]# ntpdate ntp1.jst.mfeed.ad.jp ← 入力 13 Apr 23:08:27 ntpdate[2539]: step time server 210.173.160.27 offset 27.719748 sec |
|
|
時刻設定ファイルの作成です。 下記のように入力します。緑文字の部分を黄文字のように書き換えて下さい。青文字が入力文字です。 |
|
| [root@linux]# vi /etc/ntp.conf ← 入力 # For more information about this file, see the man pages # ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5). driftfile /var/lib/ntp/drift # Permit time synchronization with our time source, but do not # permit the source to query or modify the service on this system. restrict default kod nomodify notrap nopeer noquery restrict -6 default kod nomodify notrap nopeer noquery # Permit all access over the loopback interface. This could # be tightened as well, but to do so would effect some of # the administrative functions. restrict 127.0.0.1 restrict -6 ::1 # Hosts on local network are less restricted. #restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap ↓ restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap ← コメント解除 # Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.fedora.pool.ntp.org dynamic server 1.fedora.pool.ntp.org dynamic server 2.fedora.pool.ntp.org dynamic ↓ server ntp1.jst.mfeed.ad.jp ← 日本のNTPサーバーに変更 server ntp2.jst.mfeed.ad.jp server ntp3.jst.mfeed.ad.jp #broadcast 192.168.1.255 key 42 # broadcast server #broadcastclient # broadcast client #broadcast 224.0.1.1 key 42 # multicast server #multicastclient 224.0.1.1 # multicast client #manycastserver 239.255.254.254 # manycast server #manycastclient 239.255.254.254 key 42 # manycast client # Undisciplined Local Clock. This is a fake driver intended for backup # and when no outside source of synchronized time is available. #server 127.127.1.0 # local clock #fudge 127.127.1.0 stratum 10 # Enable public key cryptography. #crypto includefile /etc/ntp/crypto/pw # Key file containing the keys and key identifiers used when operating # with symmetric key cryptography. keys /etc/ntp/keys # Specify the key identifiers which are trusted. #trustedkey 4 8 42 # Specify the key identifier to use with the ntpdc utility. #requestkey 8 # Specify the key identifier to use with the ntpq utility. #controlkey 8 # Enable writing of statistics records. #statistics clockstats cryptostats loopstats peerstats |
|
| ◆ | ntp の起動 |
| 下記のように入力します。青文字が入力文字です。 | |
|
[root@linux]# /etc/rc.d/init.d/ntpd start ← /etc/rc.d/init.d/httpd start を入力(apache の起動) ntpd を起動中: [ OK ] |
|
| 続いてPCの再起動に ntpd を自動的に起動するようにします。下記のように入力します。青文字が入力文字です。 | |
|
[root@linux]# chkconfig ntpd on ← chkconfig httpd on を入力(apache の自動起動) |
|
| 自動起動設定の確認。下記のように入力し 、下記のように表示されればOKです。 | |
|
[root@linux]# chkconfig --list ntpd ← chkconfig --list httpd を入力(apache の自動起動確認) ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off |
|
| 再起動は下記のように入力します。青文字が入力文字です。 | |
|
[root@linux]# /etc/rc.d/init.d/ntpd restart ← /etc/rc.d/init.d/httpd restart を入力(apache の再起動) |
|
| ntp の起動 &時刻調整の確認 | |
|
[root@linux]# ntpq -p ← ntpd -q を入力 remote refid st t when poll reach delay offset jitter ============================================================================== ntp1.jst.mfeed. 210.173.160.86 2 u 35 64 1 7.220 95.935 0.001 ntp2.jst.mfeed. 210.173.160.86 2 u 34 64 1 6.074 96.133 0.001 ntp3.jst.mfeed. 210.173.160.86 2 u 33 64 1 7.306 96.131 0.001 |
|
| 上記を実行後、10分〜20分後に再度 ntpq -p を実行します。 | |
|
[root@linux]# ntpq -p ← ntpd -q を入力 remote refid st t when poll reach delay offset jitter ============================================================================== +ntp1.jst.mfeed. 210.173.160.86 2 u 35 64 1 7.220 95.935 0.001 +ntp2.jst.mfeed. 210.173.160.86 2 u 34 64 1 6.074 96.133 0.001 *ntp3.jst.mfeed. 210.173.160.86 2 u 33 64 1 7.306 96.131 0.001 |
|
| 上記のようにサーバー名(アドレス)の前に + - * のマークが付いていればネット上にあるメインNtpサーバーと同期が取れています。 | |
| ◆ | クライアント(Windows)機の時刻同期 |
| タスクバー右端の時計の上で右クリックして『日付と時刻の調整』⇒『インターネット時刻』⇒『自動的にインターネット時刻サーバーと同期する』の前のチェックボックスにチェックを入れ、サーバー欄にNtpサーバーのIPアドレスを入力して『今すぐ更新(U)』クリックしま。その後『OK』をクリックして完了です。 | |
|
|
|