ntp服务器

主页:http://www.ntp.org/
安装:yum install ntp 或 apt-get install ntp
ntp使用UDP协议,使用123端口


配置:
ntp只有一个配置文件:/etc/ntp.conf
1. 权限设置
restrict … noquery: 拒绝客户端校时请求
restrict IP地址:放行该IP地址的服务器端,可以操作本服务器
restrict IP地址 mask 子网掩码 nomodify:放行局域网客户端校时请求
一般的
restrict default kod nomodify notrap nopeer noquery:先拒绝所有IPV4用户
restrict -6 default kod nomodify notrap nopeer noquery:拒绝所有IPV6用户
restrict 127.0.0.1
restrict -6::1 : 放行本机来源
restrict 220.130.158.71 : 放行上游时间服务器
restrict 192.168.1.0 mask 255.255.255.255.0 nomodify:放行局域网客户端
2.上游服务器设置
server IP地址或hostname [prefer]: 设置上游服务器,prefer为优先使用
3.时间差记录
driftfile 文件的绝对路径


启动服务端:service ntpd on 或 /etc/init.d/ntpd start
设置开机自启动:chkconfig ntpd on
查看ntp状态:ntpstat 或 watch ntpq -p


更改时区:
centos:
时区文件在目录/usr/share/zoneinfo/文件夹下,更改时区时,先在该目录找到相应的时区文件,比如/usr/share/zoneinfo/Asia/Shanghai,然后编辑/etc/sysconfig/clock文件,ZONE=“Asia/Shanghai”即可。

更改时间:
date:显示系统时间
date mmddhhmmyyyy:更改系统时间,格式月日时分年
hwclock -r:读取硬件时
hwclock -w:将系统时写入BIOS
ntpdate -dv IP或主机名:客户端网络校时
ntpd 是逐渐调整时间,ntpdate是立即校时。建议首次用ntpdate,之后用ntpd。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值