CentOS 5设置NTP服务器
Submitted by admin on Fri, 05/02/2008 - 11:03
- Linux
参考文献:Setup NTP Server
其实非常简单,因为在CentOS 5不再区分客户端和服务器,只要配置了NTP,它就会提供NTP服务。这一点与Solaris不同,其中提供了ntp.client和ntp.server可供选择,想使用哪个直接用相应文件覆盖/etc/ntp.conf即可。
1)确认已经ntp程序包:
# yum install ntp
2)配置时间源
# vi /etc/ntp.conf
server time.lib.tsinghua.edu.cn
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
3)配置是否为其他PC提供时间服务
# vi /etc/ntp.conf
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
4)配置开机时自动运行时间服务
# chkconfig ntpd on
5)启动或停止时间服务
# service ntpd start
# service ntpd stop
# service ntpd restart
6)验证ntp服务已经运行
# pgrep ntpd
7)初始同步
# ntpdate -u time.lib.tsinghua.edu.cn
8)确认同步成功
# ntpq -p
当然,如果要提供时间服务,还必须相应的设置iptable防火墙的配置。CentOS的时间服务使用udp 123端口。
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
评论(0)