天天看點

centos 6.5 ntp 伺服器搭建

1、配置内網NTP-Server(192.168.1.135)

# yum install ntp

# chkconfig ntpd on

# chkconfig --list ntpd

#vim /etc/ntp.conf

------------------------------------------------------------------------------------------- 

# Hosts on local network are less restricted.

# 允許内網其他機器同步時間

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap

# 中國這邊最活躍的時間伺服器 : http://www.pool.ntp.org/zone/cn

server 210.72.145.44 perfer   # 中國國家受時中心

server 202.112.10.36             # 1.cn.pool.ntp.org

server 59.124.196.83             # 0.asia.pool.ntp.org

# 允許上層時間伺服器主動修改本機時間

restrict 210.72.145.44 nomodify notrap noquery

restrict 202.112.10.36 nomodify notrap noquery

restrict 59.124.196.83 nomodify notrap noquery

# 外部時間伺服器不可用時,以本地時間作為時間服務

server  127.127.1.0     # local clock

fudge   127.127.1.0 stratum 10

#service ntpd start

2、配置内網NTP-Clients

driftfile /var/lib/ntp/drift

restrict 127.0.0.1

restrict -6 ::1

# 配置時間伺服器為本地的時間伺服器

server 192.168.1.135

restrict 192.168.1.135 nomodify notrap noquery

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

手動同步伺服器時間

ntpdate -u 192.168.1.135

硬體時間與系統時間一起同步

# vim /etc/sysconfig/ntpd

SYNC_HWCLOCK=yes

 本文轉自1321385590 51CTO部落格,原文連結:http://blog.51cto.com/linux10000/1717524,如需轉載請自行聯系原作者

繼續閱讀