chrony服务器作业

在这里插入图片描述

# 下载chrony时间服务器
[root@localhost yum.repos.d]# yum -y install chrony
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Appstream                                                 3.4 MB/s | 8.4 MB     00:02    
BaseOS                                                    3.7 MB/s | 4.6 MB     00:01    
Package chrony-4.1-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!

# 编辑/etc/chrony.conf文件
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
pool 2.rhel.pool.ntp.org iburst
server ntp.aliyun.com iburst # 增加这二个网络服务器
server ntp.tencent.com iburst

# Record the rate at which the system clock gains/losses time.
driftfile /var/lib/chrony/drift

# Allow the system clock to be stepped in the first three updates
# if its offset is larger than 1 second.
makestep 1.0 3

# Enable kernel synchronization of the real-time clock (RTC).
rtcsync

# Enable hardware timestamping on all interfaces that support it.
#hwtimestamp *

# Increase the minimum number of selectable sources required to adjust
# the system clock.
#minsources 2

# Allow NTP client access from local network.
#allow 192.168.0.0/16

# Serve time even if not synchronized to a time source.
#local stratum 10

# Specify file containing keys for NTP authentication.
keyfile /etc/chrony.keys

# Get TAI-UTC offset and leap seconds from the system tz database.
leapsectz right/UTC

# Specify directory for log files.
logdir /var/log/chrony

# Select which information is logged.
#log measurements statistics tracking

[root@localhost yum.repos.d]# systemctl restart chronyd
[root@localhost yum.repos.d]# timedatectl status 
               Local time: Sun 2022-11-06 07:33:51 EST
           Universal time: Sun 2022-11-06 12:33:51 UTC
                 RTC time: Sun 2022-11-06 12:33:50
                Time zone: America/New_York (EST, -0500)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
[root@localhost yum.repos.d]# timedatectl set-ntp true 

设置命令
[root@localhost yum.repos.d]# crontab -e
0 9 * * * systemctl restart chronyd 
[root@localhost yum.repos.d]# crontab -l
0 9 * * * systemctl restart chronyd 

#配置网络
[root@localhost network-scripts]# cat /etc/sysconfig/network-scripts/ifcfg-ens160
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=dhcp
IPADDR=192.168.123.123
PREFIX=24
GATEWAY=192.168.123.154
DNS1=8.8.8.8
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
NAME=ens160
UUID=21c987a8-4001-485e-b7ca-ac530b2190d2
DEVICE=ens160
ONBOOT=yes

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值