Centos 快速搭建ntp服务器
centos 6.5测试成功
一、安装并配置
yum -y install ntp ntpdate(若系统未安装服务)
vi /etc/ntp.conf (以下是ntp.conf文件的内容)
#设置此服务器同上层服务器做时间同步的IP地址,prefer意味着首选@H_404_68@server 218.21.130.42@H_404_68@server 0.asia.pool.ntp.org@H_404_68@server 1.asia.pool.ntp.org@H_404_68@server 2.asia.pool.ntp.org@H_404_68@#设置默认策略为允许任何主机进行时间同步@H_404_68@restrict default ignore@H_404_68@#设置允许访问此时间服务器的时间服务的@H_404_68@#根据情况自己设定@H_404_68@restrict 127.0.0.1@H_404_68@restrict 192.168.10.2指定某台机器时间同步@H_404_68@restrict 192.168.0.0 mask 255.255.255.0 #允许192.168.0.0/254子网内主机时间同步@H_404_68@restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许任何主机跟进行时间同步@H_404_68@
二、启动服务(关闭防火墙或者开端口)
service ntpd start
时间同步
ntpdate 192.168.1.xx(服务器ip)