RHCE——时间服务器(ntp)

这篇具有很好参考价值的文章主要介绍了RHCE——时间服务器(ntp)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

1.配置ntp时间服务器,确保客户端主机能和服务主机同步时间

2.配置ssh免密登陆,能够通过客户端主机通过redhat用户和服务端主机基于公钥验证方式进行远程连接


一.配置ntp时间服务器,确保客户端主机能和服务主机同步时间

1、软件安装

[root@localhost ~]# yum install chrony -y

2、查看客户端主机时间

[root@client ~]# timedatectl 
               Local time: 日 2003-07-13 07:16:23 CST
           Universal time: 六 2003-07-12 23:16:23 UTC
                 RTC time: 日 2023-04-16 11:47:14
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: no
              NTP service: active
          RTC in local TZ: no
[root@client ~]# 

3、修改配置文件

客户端主机:

RHCE——时间服务器(ntp)

[root@client ~]# vim /etc/chrony.conf 
#添加服务端地址
pool 192.168.186.138 iburst

服务端主机:

RHCE——时间服务器(ntp)

[root@server ~]# vim /etc/chrony.conf 
#设置允许哪个客户端可以访问该服务器
# Allow NTP client access from local network.
allow 192.168.186.0/24

# Serve time even if not synchronized to a time source.
local stratum 10
(值10可被取代,可选范围为1-15。假如该计算机可以连接到一台最终与真实时间同步的计算机,那么该计算机的stratum层级几乎可以肯定比10小。因此,为local命令选取stratum 10这样的大数值,可以防止机器本身的时间与真实时间混淆,可以保证该机器不会将本身的时间授时给那些可以连接同步到真实时间的ntp服务器的ntp客户端。)  

4、查看服务器时间,并重启chronyd服务

[root@server ~]# date
2023年 04月 16日 星期日 19:51:18 CST
[root@server ~]# grep allow /etc/chrony.conf 
allow 192.168.186.0/24
[root@server ~]# systemctl restart chronyd

5、用客户端去同步,并再次查看客户端的时间是否与客户端一致

[root@client ~]# ping 192.168.186.138
[root@client ~]# grep iburst /etc/chrony.conf 
#pool 2.rhel.pool.ntp.org iburst
#pool ntp.aliyun.com iburst
pool 192.168.186.138 iburst
[root@client ~]# systemctl restart chronyd
[root@client ~]# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 192.168.186.138              10   6    17     0    -19us[  -53us] +/-  354us
[root@client ~]# timedatectl 
               Local time: 日 2023-04-16 20:00:55 CST
           Universal time: 日 2023-04-16 12:00:55 UTC
                 RTC time: 日 2023-04-16 12:00:56
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
[root@client ~]# chronyc ntpdata 

Remote address  : 192.168.186.138 (C0A8BA8A)
Remote port     : 123
Local address   : 192.168.186.137 (C0A8BA89)
Leap status     : Normal
Version         : 4
Mode            : Server
Stratum         : 10
Poll interval   : 6 (64 seconds)
Precision       : -26 (0.000000015 seconds)
Root delay      : 0.000000 seconds
Root dispersion : 0.000000 seconds
Reference ID    : 7F7F0101 ()
Reference time  : Sun Apr 16 12:03:56 2023
Offset          : -0.000075828 seconds
Peer delay      : 0.000886137 seconds
Peer dispersion : 0.000000034 seconds
Response time   : 0.000293112 seconds
Jitter asymmetry: +0.00
NTP tests       : 111 111 1111
Interleaved     : No
Authenticated   : No
TX timestamping : Daemon
RX timestamping : Kernel
Total TX        : 7
Total RX        : 7
Total valid RX  : 7
[root@client ~]# 

二.配置ssh免密登陆,能够通过客户端主机通过redhat用户和服务端主机基于公钥验证方式进行远程连接

1、创建用户redhat

[root@client ~]# useradd redhat
[root@client ~]# passwd redhat 
更改用户 redhat 的密码 。
新的密码: 
无效的密码: 密码少于 8 个字符
重新输入新的密码: 
passwd:所有的身份验证令牌已经成功更新。
[root@client ~]# 

2、创建新的密钥对,并且发送到指定目录中

[root@client .ssh]# su redhat
[redhat@client .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/redhat/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/redhat/.ssh/id_rsa
Your public key has been saved in /home/redhat/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:ttXkI8fBsvXzKNTArpYWluWKxVRVtDFNbPzcYi/1HpQ redhat@client
The key's randomart image is:
+---[RSA 3072]----+
|            ...O=|
|           +    O|
|          o O  ++|
|         o & =oE=|
|        S X X.=+.|
|       . * O ..=o|
|        o * . .oo|
|         o   .  .|
|                 |
+----[SHA256]-----+
[redhat@client .ssh]$ 
[redhat@client .ssh]$ ll
总用量 8
-rw-------. 1 redhat redhat 2602  4月 16 20:47 id_rsa
-rw-r--r--. 1 redhat redhat  567  4月 16 20:47 id_rsa.pub


[root@server .ssh]# ll
总用量 8
-rw-------. 1 root root 1695  4月 16 20:43 authorized_keys
-rw-r--r--. 1 root root 2590  4月 16 20:50 id_rsa
[root@server .ssh]# 

ssh-keygen 生成、管理和转换认证密钥 -t制定类型 RSA

/root/.ssh/id_rsa私钥文件
/root/.ssh/id_rsa.pub公钥文件文章来源地址https://www.toymoban.com/news/detail-450184.html

 3、客户端测试

[redhat@client .ssh]$ ssh 192.168.186.138
The authenticity of host '192.168.186.138 (192.168.186.138)' can't be established.
ED25519 key fingerprint is SHA256:IjiKi+oexrRWTbUACwNqXYQvu2F8yakPx49b7PW9lto.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.186.138' (ED25519) to the list of known hosts.
redhat@192.168.186.138's password: 
Activate the web console with: systemctl enable --now cockpit.socket

Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Apr  8 10:10:53 2023
[redhat@server ~]$ 

到了这里,关于RHCE——时间服务器(ntp)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • ubuntu 配置NTP时间服务器

     Client 代表 客户端ntp请求服务端 Server 代表 服务端ntp回应服务端 端口:123 网卡:ens33

    2024年02月04日
    浏览(36)
  • 【Linux】NTP服务器配置、时间修改

    2024年02月08日
    浏览(33)
  • 【Linux】NTP时间服务器Chrony配置详解

    🦄 个人主页——🎐开着拖拉机回家_大数据运维-CSDN博客 🎐✨🍁 🪁🍁 希望本文能够给您带来一定的帮助🌸文章粗浅,敬请批评指正!🍁🐥 🪁🍁🪁🍁🪁🍁🪁🍁 🪁🍁🪁🍁🪁🍁🪁 🪁🍁🪁🍁🪁🍁🪁🍁🪁🍁🪁🍁 🪁🍁🍁🪁🍁🪁🍁 感谢点赞和关注 ,每天

    2024年02月08日
    浏览(30)
  • Linux下的时间同步,以及ntp时间服务器配置流程

    但在Linux下,系统时间和硬件时间并不会自动同步。在Linux运行过程中,系统时间和硬件时间以异步的方式运行,互不干扰。硬件时间的运行,是靠BIOS电池来维持,而系统时间,是用CPU来维持的。在系统开机的时候,会自动从BIOS中取得硬件时间,设置为系统时间。 命令 功能

    2024年04月11日
    浏览(36)
  • centos 7 离线安装ntp时钟服务器以及客户端

    1.离线安装包下载地址 下载路径阿里云盘 资源内容包含如下: : 1.找一台服务做时间服务器,将文件夹 ntp-install 放入到 /home 下,执行命令 sh setup 2. 修改/etc/ntp.conf 文件配置. 允许 1192.168.0.0-192.168.0.255 网段内所有机器从 esnode1 同步时间 restrict 192.168.0.0 mask 255.255.255.0 nomodify

    2024年04月26日
    浏览(31)
  • Windows搭建NTP服务器——搭建时间同步服务器

    本环境搭建环境是windows2012R2 在Windows 服务器下,按住“ windows+r ”打开“运行”对话框,输入regedit,点击“确定”打开注册表。 依次打开HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesW32TimeParametersType 鼠标双击Type 文件; 弹出对话框,在数据数值(V)项输入 NTP,单击确定 按照此

    2023年04月25日
    浏览(44)
  • STM32同步NTP服务器时间

    目录 一、NTP  二、报文解析 三、代码 获取时间的方式有很多: GPS授时 、 无卡CDMA授时 和 网络授时 等,NTP是通过Internet或局域网,从NTP服务器获取时间。 NTP时间服务器是用于局域网服务器时间同步使用的,可以保证局域网所有的服务器与时间服务器的时间保持一致,SP-SS

    2024年02月10日
    浏览(37)
  • Linux部署NTP时间服务器实现内外网时间同步

            NTP(Network Time Protocol)是网络时间协议,它的作用是同步网络中每台计算机的时间,使他们处于相同的时间环境,确保服务或软件在计算机中正常运行。         在ntp时间同步架构中,节点分为服务端(server)和客户端(client),server端配置为ntp时钟源,用来为

    2024年04月16日
    浏览(37)
  • centos7部署时间同步(ntp)服务器

    这里搭建ntp服务器,服务端和客户端,客户端去拉取服务端的时间,为自己所用。 a.安装ntp b.配置文件 最后加上下面的 c.开启服务 d.确认NTP同步正常 输出是 synchronised to NTP server 那证明已经连上了NTP服务器, 如果输出是 unsynchronised 开头的 那证明还没有连上NTP服务器,过几分钟

    2024年01月19日
    浏览(44)
  • GPS北斗授时服务器(NTP时间服务器)在5G网络系统的应用

    GPS北斗授时服务器(NTP时间服务器)在5G网络系统的应用 GPS北斗授时服务器(NTP时间服务器)在5G网络系统的应用 京准电子科技官微——ahjzsz 摘要: 5G网络部署和垂直行业应用对于时间同步提出了新的需求。为了更满足高精度的同步需求,需要采用高精度同步源技术、高精度

    2024年03月21日
    浏览(55)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包