RHCE2

本文详细描述了如何配置Server主机设置为NTP服务器,包括修改主机名、IP地址、时间以及启用时间同步服务。同时指导如何在Client主机上设置同步Server主机的时间,包括IP配置和chrony配置。
摘要由CSDN通过智能技术生成

一.配置server主机要求如下:
1.server主机的主机名称为 ntp_server.example.com

//修改主机名  
hostnamectl set-hostname ntp_server.example.com
  reboot

修改主机名后一定要记住重启。
2.server主机的IP为: 172.25.254.100

//主机ip配置
[root@ntpserver ~]# nmcli connection add con-name eth0 ifname  eth0 ipv4.method manual type ethernet ipv4.addresses 172.25.254.100/24 ipv4.gateway 172.25.254.2 ipv4.dns 114.114.114.114


3.server主机的时间为1984-11-11 11:11:11

改变时间之前需要关闭时间同步服务。

[root@ntpserver ~]# systemctl stop chronyd.service 
[root@ntpserver ~]# timedatectl set-time "1984-11-11 11:11:11"

最后查看一下(timedatectl)


4.配置server主机的时间同步服务要求可以被所有人使用

利用ntp服务

[root@ntpserver ~]# vim /etc/chrony.conf 
//写入内容
server ntp.ntsc.ac.cn iburst
[root@ntpserver ~]# systemctl restart chronyd.service 

要求被所有人使用,将172.25.254.100作为源,所以配置文件在172.25.254.100

0.0.0.0代表所有人

[root@ntpserver ~]# vim /etc/chrony.conf 

allow 0.0.0.0/0


local stratum 10
[root@ntpserver ~]# systemctl restart chronyd.service 
[root@ntpserver ~]# systemctl disable --now firewalld

配置完毕后不仅要重启还要关闭防火墙。

配置完要重启服务再使用chronyc sources -v 测试一下

二.设定clinet主机要求如下
1.client主机的IP为:172.25.254.200

[root@server200 ~]# nmcli connection add con-name eth0 ifname  eth0 ipv4.method manual type ethernet ipv4.addresses 172.25.254.200/24 ipv4.gateway 172.25.254.2 ipv4.dns 114.114.114.114


2.client主机的主机名称为: client.example.com

[root@server200 ~]# hostnamectl set-hostname client.example.com
//主机名
[root@client ~]# 


3.同步172.25.254.100主机的时间到达本机

已经在服务器端配置过了所以直接来到客户端

来到客户端测试

[root@client ~]# vim /etc/chrony.conf
//写入,ip地址为服务器端的地址
server 172.25.254.100 iburst
[root@client ~]# systemctl restart chronyd.service 


4.用命令显示对于172.25.254.100主机的时间同步情况

  • 10
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值