Centos 9 init
CentOS 9约 413 字大约 1 分钟
时间同步
ntpdate
在9上已经不可用了,使用chrony
rpm -qa | grep #启用时间同步
timedatectl set-ntp true
#禁用时间同步
timedatectl set-ntp false # 未安装则安装
yum install chrony
开机启动
systemctl enable chronyd --now
配置
vim /etc/chrony.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
## 时间服务器地址,若作为
pool 2.centos.pool.ntp.org iburst
...
...
~
同步
#启用时间同步
timedatectl set-ntp true
#禁用时间同步
timedatectl set-ntp false
#同步硬件时间
hwclock -w
IP设置
centos 9 通过 nmcli
管理网络,且之前IP 的配置文件在/etc/sysconfig/network-script
目录下已不存在。
最新的配置文件地址为/etc/NetworkManager/system-connections/网卡名
, 我的网卡就是 enp0s5
[root@k8s ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp0s5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:1c:42:85:d9:a5 brd ff:ff:ff:ff:ff:ff
inet 172.100.1.3/24 brd 172.100.1.255 scope global dynamic noprefixroute enp0s5
valid_lft 1513sec preferred_lft 1513sec
inet6 fe80::21c:42ff:fe85:d9a5/64 scope link noprefixroute
valid_lft forever preferred_lft forever
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default
link/ether 02:42:86:c4:a5:b2 brd ff:ff:ff:ff:ff:ff
inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
valid_lft forever preferred_lft forever
[root@k8s ~]# ls /etc/NetworkManager/system-connections
enp0s5.nmconnection
配置参考
[connection]
id=ens160
uuid=5d896bda-c62a-3eb1-bc29-7c031232db86
type=ethernet
autoconnect-priority=-999
interface-name=ens160
timestamp=1670979495
[ethernet]
[ipv4]
# method=auto
method=manual
# 地址1 = ip 子网掩码 网关
address1=192.168.42.188/24,192.168.42.2
# DNS地址, 用;隔开
dns=114.114.114.114;8.8.8.8
[ipv6]
addr-gen-mode=eui64
method=auto
[proxy]
重启网卡
nmcli c reload enp0s5