NTP服务器端配置
安装ntp服务
#yum installntp
启动ntp服务
#service ntpdstart
设置ntp服务开机启动
#chkconfigntpd on
配置/etc/ntpd.conf文件。
#vi/etc/ntpd.conf
//放行NTP服务中心IP进入本服务器 restrict 202.112.7.13 restrict 202.112.11.70 restrict 202.112.0.38 restrict 202.112.10.36 //放行局域网来源 :restrict [你的IP] mask [mask_ip] [parameter] restrict 10.6.32.0 mask 255.255.255.0 nomodify restrict 10.6.27.0 mask 255.255.255.0 nomodify //设置NTP server上层服务器 server 202.112.7.13 prefer server 202.112.11.70 server 202.112.0.38 server 202.112.10.36 |
重启ntp服务
#service ntpdrestart
配置防火墙
# vi/etc/sysconfig/iptables
-A INPUT -p udp -s 10.6.32.0/24 --dport 123 -j ACCEPT |
#service iptablesrestart
国内NTP服务中心地址
序号 | 域名地址 | IP地址 | 地理位置 |
1 | s2e.time.edu.cn | 202.112.11.70 | 西北地区网络中心 |
2 | s2m.time.edu.cn | 202.112.7.13 | 北京大学 |
3 | s2a.time.edu.cn | 202.112.0.38 | 清华大学 |
4 | s2c.time.edu.cn | 202.112.10.36 | 北京邮电大学 |
5 | s2f.time.edu.cn | 202.112.29.82 | 东北地区网络中心 |
6 | s2b.time.edu.cn | 202.112.0.7 | 清华大学 |
NTP客户端配置
安装ntp服务
#yum installntp
启动ntp服务
#service ntpdstart
设置ntp服务开机启动
#chkconfigntpd on
配置/etc/ntpd.conf文件
vi/etc/ntp.conf
#server 0.centos.pool.ntp.org iburst #server 1.centos.pool.ntp.org iburst #server 2.centos.pool.ntp.org iburst #server 3.centos.pool.ntp.org iburst restrict 10.6.27.3 server 10.6.27.3 prefer |
重启ntp服务
#service ntpd restart
在客户端查看是否已经同步上NTP服务器
#ntpstat