# 下载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
chrony服务器作业
最新推荐文章于 2024-09-09 22:12:22 发布