zoukankan      html  css  js  c++  java
  • 搭建时间服务器实验

    搭建时间服务器,客户端可在每天早晨的9:00整从ntp服务器更新自己的时间

    搭建时间服务器

    [root@bogon ~]# getenforce                            # 查看 selinux 状态
    [root@bogon ~]# systemctl status firewalld            # 查看防火墙状态
    [root@bogon ~]# yum install chrony -y                 # 装包
    [root@bogon ~]# vim /etc/chrony.conf                  # 编辑配置文件
    pool 2.rhel.pool.ntp.org iburst                       # 定义时间服务器从哪里获取
    allow 192.168.168.168.0/24                            # 定义客户端同步时间的网段
    [root@bogon ~]# systemctl restart chronyd             # 重启服务
    [root@bogon ~]# date                                  # 查看时间
    [root@bogon ~]# chronyc sources                       # 同步时间
    

    测试

    开启另外一台虚拟机并命名为客户端

    [root@client ~]# yum install chrony -y                # 装包
    [root@client ~]# vim /etc/chrony.conf                 # 编写配置文件
    server 192.168.168.128 iburst                         # 从哪里同步时间
    [root@client ~]# systemctl restart chronyd            # 重启服务
    [root@client ~]# date                                 # 查看时间
    [root@client ~]# chronyc sources                      # 同步时间
    [root@client ~]# vim /etc/crontab                     # 编写计划任务配置文件
    0 9 * * * root chronyc sources 1> /dev/null  2&1      # 每天 9 点执行 chrony sourcees 命令
    
  • 相关阅读:
    洛谷P1218 [USACO1.5]特殊的质数肋骨 Superprime Rib
    洛谷 P1062 数列
    洛谷 P2822 组合数问题
    HDU 6112 今夕何夕
    poj 2115 C Looooops
    HDU 6092 Rikka with Subset
    poj 2720 Last Digits
    poj 1254 Hansel and Grethel
    poj 1222 EXTENDED LIGHTS OUT
    poj 2459 Sumsets
  • 原文地址:https://www.cnblogs.com/li-qing/p/14120321.html
Copyright © 2011-2022 走看看