CentOS NTP时间服务器配置

    选择打赏方式

 1、安装NTP软件包

[root@desktop2 ~]# yum -y install ntp

2NTP服务的配置

[root@desktop2 ~]# grep -v "^#" /etc/ntp.conf

driftfile /var/lib/ntp/drift

restrict default kod nomodify notrap nopeer noquery

restrict 127.0.0.1

restrict -6 ::1

restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap    允许局域网访问

restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap    允许局域网访问

server  210.72.145.44           ---公网的地址

server  127.127.1.0     # local clock

fudge   127.127.1.0 stratum 10

includefile /etc/ntp/crypto/pw

keys /etc/ntp/keys

logfile /var/log/ntp

[root@desktop2 ~]# cat /etc/ntp/step-tickers      //NTP服务启动时,会自动与该文件中的记录的上层NTP服务进行时间校对

# List of servers used for initial synchronization.

192.168.0.254

[root@desktop2 ~]# cat /etc/sysconfig/ntpd //允许BIOS与系统时间同步

# Drop root to id 'ntp:ntp' by default.

SYNC_HWCLOCK=yes

OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g"

3、启动NTP服务

[root@desktop2 ~]# service ntpd start

[root@desktop2 ~]# chkconfig ntpd on

4NTP的测试

[root@desktop2 ~]# ntpstat

synchronised to NTP server (192.168.0.254) at stratum 12           //进行时间校对的NTP服务器

   time correct to within 958 ms                                        //本地与上层NTP服务器的时间差

   polling server every 64 s                                                  //下次同步时间

[root@desktop2 ~]# ntpq -p

     remote           refid      st t when poll reach   delay   offset  jitter

==============================================================================

*instructor.exam LOCAL(0)        11 u   26   64  377    0.807    0.030   0.219

 LOCAL(0)        .LOCL.          10 l   27   64  377    0.000    0.000   0.000

NTP占用的端口是123

 

 

版权声明:若无特殊注明,本文皆为《 CM部落 》原创,转载请保留文章出处。
本文链接:CentOS NTP时间服务器配置 https://itkz.cn/centos/11.html
正文到此结束

热门推荐

发表吐槽

你肿么看?

你还可以输入 250 / 250 个字

嘻嘻 大笑 可怜 吃惊 害羞 调皮 鄙视 示爱 大哭 开心 偷笑 嘘 奸笑 委屈 抱抱 愤怒 思考 日了狗 胜利 不高兴 阴险 乖 酷 滑稽

评论信息框

吃奶的力气提交吐槽中...


既然没有吐槽,那就赶紧抢沙发吧!