redhat7.2 centos7.2怎么配置ntp服务器 redhat7.2 centos7.2怎么配置ntp服务器

redhat7.2 centos7.2\u600e\u4e48\u914d\u7f6entp\u670d\u52a1\u5668

1\u3001yum -y install ntp
2\u3001\u914d\u7f6e /etc/ntp.conf
restrict 127.0.0.1
server cn.pool.ntp.org
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap noquery notrust
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
keys /etc/ntp/keys
3\u3001/etc/init.d/ntpd start\u6216\u8005systemctl start ntpd
systemctl enable ntpd
4\u3001NTP server is listening on UDP port 123
netstat -nulp|grep 123
5\u3001other server you can config crontab
# crontab -e
0 0 * * * /usr/sbin/ntpdate 172.16.1.123;/sbin/hwclock -w;

redhat\u7248\u672c\u4e0d\u540cntp\u7684\u7248\u672c\u53ef\u80fd\u4e5f\u4f1a\u6709\u6240\u53d8\u5316\uff0c\u5728\u5b89\u88c5\u4e4b\u524d\u9700\u8981\u67e5\u627entp\u670d\u52a1\uff0c\u770b\u4e0b\u662f\u5426\u5b58\u5728\uff1a
yum search ntp

2
\u67e5\u627e\u5230ntp.x86_64\uff0c\u4f7f\u7528yum\u8fdb\u884c\u5b89\u88c5\u3002\u5b89\u88c5\u65f6.x64_64\u53ef\u4ee5\u4e0d\u8f93\u5165\u3002
yum install -y ntp
-y\uff1a\u4e0d\u63d0\u793a\uff0c\u76f4\u63a5\u5b89\u88c5

3
\u8fdb\u5165ntp\u914d\u7f6e\u76ee\u5f55\uff1a
vi /etc/ntp.conf
4
\u8fdb\u5165ntp.conf\u914d\u7f6e\u6587\u4ef6\uff0c\u6ce8\u91ca\u4ee5server\u5f00\u5934\u7684\u914d\u7f6e\uff0c\u5e76\u6dfb\u52a0\u5185\u5bb9\uff1aserver 127.127.1.1
\u6dfb\u52a0\u5b8c\u6210\u4fdd\u5b58\u9000\u51fa\u3002

5
\u91cd\u542fntp\u670d\u52a1\u5668\uff0c\u5e76\u67e5\u770b\u72b6\u6001\u662f\u5426running\u3002
systemctl restart ntpd.service #\u91cd\u542f\u670d\u52a1
systemctl status ntpd.service #\u67e5\u770b\u72b6\u6001

6
\u67e5\u770bntp\u670d\u52a1\u662f\u5426\u80fd\u591f\u88ab\u540c\u6b65\uff0c\u663e\u793a\u4e3a\u201cLOCAL\u201d\uff0c\u8868\u793a\u6210\u529f\u3002\u5982\u679c\u6ca1\u6709\u4efb\u4f55\u663e\u793a\uff0c\u5ba2\u6237\u7aef\u5c06\u65e0\u6cd5\u540c\u6b65\u3002

END
\u6b65\u9aa42(Client):


1
\u670d\u52a1\u5668\u5df2\u7ecf\u914d\u7f6e\u5b8c\u6210\uff0c\u73b0\u5728\u662fClient\u914d\u7f6e\uff0c\u6d4b\u8bd5Client\u80fd\u5426\u4e0eServer\u76f8\u8fde\u3002

2
\u5728Clientt\u4e0a\u4f7f\u7528ntpdate\u6765\u540c\u6b65\uff1antpdate 192.168.116.2
\u540c\u6b65\u540e\u53cd\u9988\u662f\u662f\u6210\u529f\u540c\u6b65\u7684\u3002

END
\u6ce8\u610f\u4e8b\u9879


\u65f6\u95f4\u4e0a\u4e0d\u80fd\u76f8\u5dee\u8fc7\u8fdc

redhat版本不同ntp的版本可能也会有所变化,在安装之前需要查找ntp服务,看下是否存在:
yum search ntp

2
查找到ntp.x86_64,使用yum进行安装。安装时.x64_64可以不输入。
yum install -y ntp
-y:不提示,直接安装

3
进入ntp配置目录:
vi /etc/ntp.conf
4
进入ntp.conf配置文件,注释以server开头的配置,并添加内容:server 127.127.1.1
添加完成保存退出。

5
重启ntp服务器,并查看状态是否running。
systemctl restart ntpd.service #重启服务
systemctl status ntpd.service #查看状态

6
查看ntp服务是否能够被同步,显示为“LOCAL”,表示成功。如果没有任何显示,客户端将无法同步。

END
步骤2(Client):

1
服务器已经配置完成,现在是Client配置,测试Client能否与Server相连。

2
在Clientt上使用ntpdate来同步:ntpdate 192.168.116.2
同步后反馈是是成功同步的。

END
注意事项

时间上不能相差过远

步骤(Server):

1
redhat版本不同ntp的版本可能也会有所变化,在安装之前需要查找ntp服务,看下是否存在:
yum search ntp

2
查找到ntp.x86_64,使用yum进行安装。安装时.x64_64可以不输入。
yum install -y ntp
-y:不提示,直接安装

3
进入ntp配置目录:
vi /etc/ntp.conf
4
进入ntp.conf配置文件,注释以server开头的配置,并添加内容:server 127.127.1.1
添加完成保存退出。

5
重启ntp服务器,并查看状态是否running。
systemctl restart ntpd.service #重启服务
systemctl status ntpd.service #查看状态

6
查看ntp服务是否能够被同步,显示为“LOCAL”,表示成功。如果没有任何显示,客户端将无法同步。

END
步骤2(Client):

1
服务器已经配置完成,现在是Client配置,测试Client能否与Server相连。

2
在Clientt上使用ntpdate来同步:ntpdate 192.168.116.2
同步后反馈是是成功同步的。

redhat版本不同ntp的版本可能也会有所变化,在安装之前需要查找ntp服务,看下是否存在:
yum search ntp

2
查找到ntp.x86_64,使用yum进行安装。安装时.x64_64可以不输入。
yum install -y ntp
-y:不提示,直接安装

3
进入ntp配置目录:
vi /etc/ntp.conf
4
进入ntp.conf配置文件,注释以server开头的配置,并添加内容:server 127.127.1.1
添加完成保存退出。

5
重启ntp服务器,并查看状态是否running。
systemctl restart ntpd.service #重启服务
systemctl status ntpd.service #查看状态

6
查看ntp服务是否能够被同步,显示为“LOCAL”,表示成功。如果没有任何显示,客户端将无法同步。

END
步骤2(Client):

1
服务器已经配置完成,现在是Client配置,测试Client能否与Server相连。

2
在Clientt上使用ntpdate来同步:ntpdate 192.168.116.2
同步后反馈是是成功同步的。

END
注意事项

时间上不能相差过远

redhat版本不同ntp的版本可能也会有所变化,在安装之前需要查找ntp服务,看下是否存在:
yum search ntp

2
查找到ntp.x86_64,使用yum进行安装。安装时.x64_64可以不输入。
yum install -y ntp
-y:不提示,直接安装

3
进入ntp配置目录:
vi /etc/ntp.conf
4
进入ntp.conf配置文件,注释以server开头的配置,并添加内容:server 127.127.1.1
添加完成保存退出。

5
重启ntp服务器,并查看状态是否running。
systemctl restart ntpd.service #重启服务
systemctl status ntpd.service #查看状态

6
查看ntp服务是否能够被同步,显示为“LOCAL”,表示成功。如果没有任何显示,客户端将无法同步。

END
步骤2(Client):

1
服务器已经配置完成,现在是Client配置,测试Client能否与Server相连。

2
在Clientt上使用ntpdate来同步:ntpdate 192.168.116.2
同步后反馈是是成功同步的。

END
注意事项

时间上不能相差过远

1.在集群中所有节点上安装ntp
2.所有节点设置时区,这里设置为中国所用时间timedatectl set-timezone Asia/Shanghai
3.在server节点上启动ntp服务
4.在server节点上设置现在的准确时间
timedatectl set-time HH:MM:SS
5.在server节点上设置其ntp服务器为其自身,同时设置可以接受连接服务的客户端,是通过更改/etc/ntp.conf文件来实现的,其中server设置127.127.1.0为其自身,新增加一个restrict段为可以接受服务的网段
这里写图片描述
6.重启ntpd服务
systemctl restart ntpd
7.在client节点上设置ntp服务器为server节点
这里写图片描述
8.在client节点上同步server的时间
ntpdate 10.107.18.35
9.client节点启动ntpd服务
10.所有节点启动时间同步
timedatectl set-ntp yes

扩展阅读:17173.com ... paperpass免费入口 ... paperyy ... red hat enterprise ... 韩国macbookpro ... red hat qxl gpu ... 海康ehome5.0平台接入 ... water resistant ... ourc hat ...

本站交流只代表网友个人观点,与本站立场无关
欢迎反馈与建议,请联系电邮
2024© 车视网