linux时间同步命令centos6,CentOS6.5搭建NTP服务器,并为思科交换机提供时间同步

本文主要讲解如何在CentOS6.5上配置NTP服务器,并为思科交换机提供时间同步功能。

服务器安装步骤:

1. Linux上安装NTP软件:

命令:yum install ntp(回车)

输出信息:

[root@localhost ~]# yum install ntp

Loaded plugins: fastestmirror,refresh-packagekit,security

Determining fastest mirrors

* base: mirrors.tuna.tsinghua.edu.cn

* extras: mirrors.tuna.tsinghua.edu.cn

* updates: mirrors.tuna.tsinghua.edu.cn

Setting up Install Process

Resolving Dependencies

--> Running transaction check

---> Package ntp.x86_64 0:4.2.6p5-1.el6.centos will be updated

---> Package ntp.x86_64 0:4.2.6p5-10.el6.centos.1 will be an update

--> Processing Dependency: ntpdate = 4.2.6p5-10.el6.centos.1 for package: ntp-4.2.6p5-10.el6.centos.1.x86_64

--> Running transaction check

---> Package ntpdate.x86_64 0:4.2.6p5-1.el6.centos will be updated

---> Package ntpdate.x86_64 0:4.2.6p5-10.el6.centos.1 will be an update

--> Finished Dependency Resolution

……

2.配置ntp服务器的配置文件

命令:[root@localhost ~]# vim /etc/ntp.conf

driftfile /var/lib/ntp/drift

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict -6 ::1

server ntp.fudan.edu.cn

restric ntp.fudan.edu.cn nomodify notrap noquery

server 127.127.1.0

fudge 127.127.1.0 stratum 8

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

3. 保存退出配置文件,重启ntp服务。

[root@localhost ~]# service ntpd start

如果时间没有立马同步,稍等几分钟。

思科交换机客户端配置步骤:

1. 登录交换机配置如下命令:

ntp server 192.168.4.212 (指定ntp服务器地址)

clock timezone GMT 8 (定义时区)

service timestamps debug datetime localtime (定义debug日志显示时间)

service timestamps log datetime localtime (定义log日志显示时间)

2. 查看命令

sw#show clock

20:56:16.132 GMT Thu Oct 13 2016

sw#show ntp status

Clock is synchronized,stratum 10,reference is 192.168.1.1

nominal freq is 119.2092 Hz,actual freq is 119.2081 Hz,precision is 2**17

reference time is DBAA0318.33909662 (20:56:56.201 GMT Thu Oct 13 2016)

clock offset is 0.2520 msec,root delay is 2.78 msec

root dispersion is 11.99 msec,peer dispersion is 0.41 msec

搭建过程中遇到的问题及解决办法:

搭建完成后发现交换机一直无法同步时间,使用另外一台linux机器配置为客户端一样无法同步时间。

在ntp客户端运行ntpdate serverIP,出现no server suitable for synchronization found的错误。

最后发现是没有关闭linux防火墙。。。

使用命令:#serviceiptablesstop 关闭linux防火墙后,服务器运行正常。

参考链接:http://www.blogjava.net/spray/archive/2008/07/10/213964.html

总结

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值