实训二:CentOS 7 配置系统时间同步

实验环境:

VMware 版本:16.1.0
镜像:CentOS-7-x86_64-DVD-1611

有很多应用依赖计算机间准确的时间才能运作正常,如果计算机间的时间误差比较大,这些应用和协议就可能完全失败。
另外当涉及到网络上的安全设备时,同步问题就更为重要了。这些设备所生成的日志必须要反映出准确的时间。尤其是在处理繁忙数据的时候,如果时间不同步,几乎不可能将来自不同源的日志关联起来。 一旦日志文件不相关连,安全相关工具就会毫无用处。不同步的网络意味着企业不得不花费大量时间手动跟踪安全事件。


查看系统时间:

[root@Dai ~]# date
Tue Apr 13 17:17:50 CST 2021


时间同步:

[root@localhost ~]#yum install –y ntp   //安装NTP时间同步服务
[root@localhost ~]# vim /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
server ntp1.aliyun.com

[root@localhost ~]# systemctl restart ntpd    //启动ntpd服务
[root@localhost ~]# systemctl enable ntpd     //设置为开机自启动
Created symlink from /etc/systemd/system/multi-user.target.wants/ntpd.service to /usr/lib/systemd/system/ntpd.service.
[root@localhost ~]# ntpdate ntp.aliyun.com    //手动进行时间同步
11 Mar 09:12:17 ntpdate[4472]: the NTP socket is in use, exiting
[root@localhost ~]# hwclock--systohc   //同步系统时间到硬件时间

结尾 :由于小编还是大二学生,水平有限,文章中难免存在疏漏和不当之处,敬请各位大神以及读者不吝赐教

posted @ 2021-04-18 20:33  呆萝卜  阅读(366)  评论(0)    收藏  举报