查看是否安装软件包,一般系统中已安装。编辑主配置文件。ntp服务的端口号为udp的123.

[root@localhost ~]# vim /etc/ntp.conf
restrict 172.16.10.0 mask255.255.255.0 nomodify notrap nopeer kod

restrict       权限控制
kod         开启阻止Kiss of Death包***
nomodify    客户端不能更改ntp服务器的时间参数,但是可以校对时间
notrap      不提供trap远程事件登陆
nopeer      不予其他同一层的NTP服务器同步时间
noquery     不提供ntp服务
server        设定上层NTP服务器

重启服务

[root@localhost ~]# service ntpd restart

设为开机自启动

[root@localhost ~]# chkconfig ntpd on


客户端从服务器校对时间

[root@localhost ~]# ntpdate 172.16.10.1

添加循环计划任务

[root@localhost ~]# crontab -e

*/10 * * * * /sbin/ntpdate 172.16.10.1

ntp服务的图形管理

[root@localhost ~]# system-config-date