您的位置:首页 > 编程语言 > PHP开发

ntp服务器配置

2014-03-11 00:00 120 查看
摘要: 关于ntp服务器的配置

1.安装ntp

[root@mfs1 ~]# yum install -y ntp


2.修改/etc/ntp.conf

首先注释掉3server

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org


添加

# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 0


restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap  //ntp server 所允许同步的client的网段


3.起动服务

[root@zhangxc ~]# /etc/init.d/ntpd restart    //ntpd服务端口为123
[root@zhangxc ~]# netstat -anutp
udp        0      0 :::123                      :::*                                    18891/ntpd


4.成功为:

[root@zhangxc ~]# ntpstat
synchronised to local net at stratum 1
time correct to within 11 ms
polling server every 1024 s


5.客户端

[root@mfs1 ~]# ntpdate 192.168.0.3
11 Mar 15:56:03 ntpdate[5390]: step time server 192.168.0.3 offset 28799.309433 sec


注:客户端首先要按装ntp。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息