第三章:NTP服务器
NTP是网络时间协议(Network Time Protocol),它是用来同步网络中各个计算机的时间的协议。
NTP 时间服务
ntp udp 123--端口
查看当前时间:date
timedatectl list-timezones(Africa/Douala)
timedatectl set-timezone Asia/Shanghai
tzselect
vi ~/.bash_profile
TZ='Asia/Shanghai';export TZ
chrony:
#1.获取软件包 mount /dev/sr0/mnt
#2.yum/dnf /etc/yum.repos.d/base(可改).repo
#3.dnf install 软件名
url-----路径地址
gpgcheck=0-------不需要秘钥
vim /etc/chrony.conf
date 101210122022
systemctl restart chronyd
一:配置主机向外网时间服务区同步时间
(1)更改当前主机所在地的时区
(2)安装chronyd时间同步程序
(3)访问外网
(4)vim /etc/chrony.conf
#pool s1b.time.edu.cn(可改) ibusrt 自定义同步时间服务区
systemctl restart chronyd (更改后要重启)
(5)date 查看时间是否同步
二:自建时间服务器同步时间
server:192.168.40.129
(1)更改配置文件
vim /ect/chrony.conf
#pool xxxxxxxxxxxxx
local stratum 10
allow 192.168.40.0/24
(2)重启服务
systemctl restart chronyd
(3)关闭防火墙
systemctl stop firewalld
client 192.168.40.134
(1)date 更改时间
(2)vim /etc/chrony.conf
pool 192.168.40.129
(3)systemctl restart chronyd
(4) chronyc sources
补充:
netstat -tunlp----当前udp和tcp监听列表
*客户端为随机端口
yum install wireshark