centos6.5配置NTP服务器的详细步骤

1.查看是否安装了NTP:
# rpm -q ntp
ntp-4.2.4p8-2.el6.x86_64    // 这表示已安装了,如果没有安装,这是空白。


2.如果没有安装,我们按照下
# yum install ntp


注意:前提是已经配置好了yum源。


3.开启ntp的自启命令:
# chkconfig ntpd on


4.配置NTP的配置文件:
#vi /etc/ntp.conf


需修改内容为:
restrict 127.0.0.1
restrict -6 ::1


添加内容:
#表示同步的服务器
server 210.72.145.44 perfer   # 中国国家受时中心
server 202.112.10.36             # 1.cn.pool.ntp.org
server 59.124.196.83             # 0.asia.pool.ntp.org

#表示允许同步的IP段
restrict 210.72.145.44 nomodify notrap noquery
restrict 202.112.10.36 nomodify notrap noquery
restrict 172.24.240.0 nomodify notrap noquery


# 外部时间服务器不可用时,以本地时间作为时间服务
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
 
# Enable public key cryptography.
#crypto


5.保存退出即可。
service ntpd start
7.一般需要5-10分钟左右,查看状态:
# netstat -tlunp | grep ntp 
出现:udp        0      0 172.24.240.160:123           0.0.0.0:*                               23103/ntpd  说明配置成功。
(注意:本机的ip为172.24.240.160)。
到此服务器已经配置完成。




客户机时间同步配置:
1.# yum install ntp
...

ntp服务自启设置:

 chkconfig ntp on

配置文件内容为:
2.# vim /etc/ntp.conf

driftfile /var/lib/ntp/drift
restrict 127.0.0.1
restrict -6 ::1
 
# 配置时间服务器为本地的时间服务器
server 172.24.240.160
 
restrict 172.24.240.160 nomodify notrap noquery
 
server  127.127.1.0     # local clock
fudge   127.127.1.0 stratum 10
 
includefile /etc/ntp/crypto/pw
 
keys /etc/ntp/keys


保存退出。


3.手动同步:
ntpdate -u 172.24.240.160


4.查看状态:
# ntpstat
出现:synchronised to NTP server (172.24.240.160) at stratum 12
表示配置成功。


恭喜你配置完成!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值