如何让Linux的两台机器时间同步?

  1. 选中node1来做ntp server,安装ntp服务
    apt install ntp
  2. vim /etc/ntp.conf 修改node1的ntp服务的配置文件
    新增:
    restrict 192.168.56.0 mask 255.255.255.0 # 192.168.56.0指的是要同步的网段为192.168.56.0/24这个网段
    server 127.127.1.0
    fudge 127.127.1.0 stratum 10
  3. node1启动ntp服务
    systemctl start ntp
  4. node2进行时间同步
    ntpdate node1_ip
posted @ 2021-07-29 15:09  Richardo-M-Lu  阅读(419)  评论(0编辑  收藏  举报