Linux centerOS 服务器搭建NTP服务

1,安装 NTP软件

bash 复制代码
sudo yum -y install ntp

2,编辑配置文件

bash 复制代码
sudo vim /etc/ntp.conf

3,修改配置

ntp.conf文件中,可以配置服务器从哪些上游时间源同步时间。如果你想让你的服务器对外同步时间,可以去掉restrict default ignore这一行前面的注释符号,并将ignore改为nomodify notrap nopeer noquery

bash 复制代码
restrict default nomodify notrap nopeer noquery

4,将本机设置为NTP服务

bash 复制代码
server 127.127.1.0 将当前主机作为时间服务器

fudge 127.127.1.0 stratum 8   //fudge和server必须一起用 stratum 8代表层数

5,配置时间服务器,如

bash 复制代码
server 192.168.16.44 prefer  //prefer 优先

6,设置开机自动启动

bash 复制代码
systemctl enable ntpd

7,手动同步NTP时间,如下图则表示成功

bash 复制代码
ntpdate 192.168.16.204

8,启动并查看状态

bash 复制代码
systemctl restart ntpd                        //重启ntp服务

systemctl status ntpd                        //查看ntp服务
相关推荐
wljy11 天前
二、进制状态转换
linux·运维·服务器·c语言·c++
week@eight1 天前
Linux - Doris
linux·运维·数据库·mysql
平行云1 天前
实时云渲染预启动技术解析:UE数字孪生应用的延迟优化机制(二)
linux·unity·ue5·webgl·实时云渲染·云桌面·像素流
看到代码头都是大的1 天前
CentOS环境下手动升级openssl、openssh
linux·运维·centos
浮生若城1 天前
Linux——Ext系列文件系统
linux·运维·服务器
ITyunwei09871 天前
主流 SaaS 工单系统对比
运维·服务器·人工智能
枳实-叶1 天前
【Linux驱动开发】第16天:按键中断完整实战
linux·运维·驱动开发
杨云龙UP1 天前
Oracle Recycle Bin 回收站详解:DROP TABLE 后还能找回吗?
linux·运维·数据库·sql·mysql·oracle
又熟了1 天前
乌班图Ubuntu安装
linux·运维·ubuntu
Cat_Rocky1 天前
Linux-ansible之Playbook简单应用
linux·网络·ansible