时间同步

关闭防火墙

vim/etc/selinux/config
修改内容
SELINUX = disabled

serivce iptables status
输出结果
iptables:Firewall is not running
service iptables stop
无输出结果,说明已关闭

chkconfig iptables off
有输出结果,说明为关闭
service iptables stop
输出:
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
输入
chkconfig iptables ff

安装ntpd服务

[root@bbb-04 ~]# yum -y install ntpd

设置服务器 【都需要配置】

[root@bbb-04 ~]# vim /etc/ntpd.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

添加配置
# 192.168.123.0 是的子网IP
restrict 192.168.123.0 mask 255.255.255.0 nomodify notrap
server 127.127.1.0 # local cloc
fudge 127.127.1.0 stratum 10

修改保证主板BIOS与系统时间同步

vim /etc/sysconfig/ntpd
添加
SYNC_HWLOCK=yes

设置时间

service ntpd start
输出
Starting ntpd: [ OK ]

编辑定时器

*/1 * * * * /usr/sbin/ntpdate ntp1.aliyun.com

注:意思为每过一分钟与阿里云的时间同步一次

重启任务或系统

[root@bbb-04 ~]# service iptables restart 重启任务
[root@bbb-04 ~]# service ntpd start 先选择这个
[root@bbb-04 ~]# reboot 重启系统
[root@bbb-04 ~]# date

其他服务器 设置#

root@bbb-3 ~]# crontab -e
*/1 * * * * /usr/sbin/ntpdate node-04

[root@bbb-3 ~]# service ntpd start
[root@bbb-3 ~]# date

posted @ 2020-07-25 15:10  诸葛孔萌  阅读(110)  评论(0)    收藏  举报