Home | Mirror | Search

第 17 章 Synchronizes system time using the Network Time Protocol (NTP)

目錄

1. ntpd - Network Time Protocol (NTP) daemon
2. ntp client

http://www.ntp.org

1. ntpd - Network Time Protocol (NTP) daemon

過程 17.1. ntp server

  1. # yum install ntp	
    				
  2. port

    [root@ntp ~]# netstat -unlnp |grep 123
    udp        0      0 192.168.5.5:123             0.0.0.0:*                               10810/ntpd
    udp        0      0 172.16.0.5:123              0.0.0.0:*                               10810/ntpd
    udp        0      0 192.168.3.5:123             0.0.0.0:*                               10810/ntpd
    udp        0      0 127.0.0.1:123               0.0.0.0:*                               10810/ntpd
    udp        0      0 0.0.0.0:123                 0.0.0.0:*                               10810/ntpd
    udp        0      0 ::1:123                     :::*                                    10810/ntpd
    udp        0      0 fe80::225:64ff:fe9a:123     :::*                                    10810/ntpd
    udp        0      0 :::123                      :::*                                    10810/ntpd
    
    [root@ntp ~]# lsof -i :123
    COMMAND   PID USER   FD   TYPE DEVICE SIZE NODE NAME
    ntpd    10810  ntp   16u  IPv4  35921       UDP *:ntp
    ntpd    10810  ntp   17u  IPv6  35922       UDP *:ntp
    ntpd    10810  ntp   18u  IPv6  35923       UDP [fe80::225:64ff:fe9a:d7e0]:ntp
    ntpd    10810  ntp   19u  IPv6  35924       UDP localhost6.localdomain6:ntp
    ntpd    10810  ntp   20u  IPv4  35925       UDP localhost.localdomain:ntp
    ntpd    10810  ntp   21u  IPv4  35926       UDP nis.example.com:ntp
    ntpd    10810  ntp   22u  IPv4  35927       UDP 172.16.0.5:ntp
    ntpd    10810  ntp   23u  IPv4  35928       UDP 192.168.5.5:ntp
    				
  3. status

    ntpstat

    [root@subversion ~]# ntpstat
    synchronised to local net at stratum 11
       time correct to within 11 ms
       polling server every 1024 s
    				
    [root@subversion ~]# ntptrace -n 127.0.0.1
    127.0.0.1: stratum 11, offset 0.000000, synch distance 0.010984
    				
    [root@subversion ~]# ntpq -p
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
     122.226.192.4   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
     218.75.4.130    .INIT.          16 u    - 1024    0    0.000    0.000   0.000
     www.chinaepg.ne .INIT.          16 u    - 1024    0    0.000    0.000   0.000
    *LOCAL(0)        .LOCL.          10 l   60   64  377    0.000    0.000   0.001
    				
  4. http://www.pool.ntp.org/

    vim /etc/ntp.conf
    server 2.cn.pool.ntp.org
    server 3.asia.pool.ntp.org
    server 2.asia.pool.ntp.org
    				
  5. # chkconfig ntpd on
    # service ntpd start/stop/restart
    				
comments powered by Disqus