Cent OS6.8为局域网内设备提供网络时钟服务

版权声明:本文为GJHe原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35428201/article/details/82497182

最近在配交换机的时候发现之前的NTP服务器垮掉了,当时不是我装的,正好趁着这个机会装一个 

检查CentOS时钟

date -R

 查看clock系统配置时区

cat /etc/sysconfig/clock

修改时区

cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime -R

查看BIOS时间

hwclock -r

 修改BIOS硬件时间

hwclock -w

安装NTP

yum install ntp  

修改配置文件

vi /etc/ntp.conf

增加一句


restrict 172.0.0.0 mask 255.0.0.0 nomodify notrap  

用restrict控管权限 
nomodify - 用户端不能更改ntp服务器的时间参数 
noquery - 用户端不能使用ntpq,ntpc等命令来查询ntp服务器 
notrap - 不提供trap远端登陆 
172.0.0.0/8 - 对这个网段的交换机提供时钟同步

开启NTP服务

启动NTP服务

/etc/rc.d/init.d/ntpd start

 开机启动NTP

chkconfig ntpd on

检查NTP端口是否已经开启

netstat -unlnp

 开启的端口为123

测试

 未配置NTP之前的时间

首先将时区更改为beijing 8

A206#configure terminal

A206(config)#clock timezone beijing 8

交换机端设置

A206(config)#ntp server 210.44.127.8

 配置完成之后查看NTP状态

show ntp status

猜你喜欢

转载自blog.csdn.net/qq_35428201/article/details/82497182