Linux操作系统上得ntpdate调整

Linux操作系统上得ntpdate调整

2015年05月04日 18:53:46 Benjamin_whx 阅读数:1297 标签: ntpdatelinux 更多

个人分类: Linux

通常情况下linux服务执行

 

 

 

 
  1. #ntpdate -u 210.72.145.44 

就可以进行时间同步,但突然发现服务器上的时间竟然不准确了,执行ntpdate -u 210.72.145.44命令提示如下信息:

 
  1. [root@localhost ~]# ntpdate 210.72.145.44 


 7 Jul 10:10:37 ntpdate[26186]: no server suitable for synchronization found

210.72.145.44是中国国家授时中心的官方服务器,不应该出问题的。

停到iptables还是不能进行同步。

man ntpdate看到如下的参数说明:
       -u      Direct  ntpdate  to  use  an  unprivileged port for outgoing packets. This is most useful when behind a firewall that blocks incoming traffic to privileged ports, and  you  want  to  synchronize  with  hosts beyond the firewall. Note that the -d option always uses unprivileged ports.

执行

 
  1. [root@localhost ~]# ntpdate -u 210.72.145.44 


 7 Jul 10:14:33 ntpdate[26462]: adjust time server 210.72.145.44 offset -0.001948 sec

时间同步成功。

不确定路由器上是否关闭了udp的123端口就加上-u参数吧。

 

附加一下网络上查询到的其他的时钟服务器

(美国) 
time.nist.gov 
(复旦)(国内用户推荐) 
ntp.fudan.edu.cn 
微软公司授时主机(美国) 
time.windows.com 
台警大授时中心(台湾) 
asia.pool.ntp.org 
网通授时中心(北京) 
219.158.14.130 
time.twc.weather.com 
swisstime.ethz.ch 
ntp0.fau.de 
ntp3.fau.de 
time-a.nist.gov 
time-b.nist.gov 
time-nw.nist.gov 
nist1-sj.glassey.com 
NTP服务器(上海) 
ntp.api.bz

修改linux的时间可以使用date指令
  date命令的功能是显示和设置系统日期和时间。
  输入date 查看目前系统时间。
  修改时间需要 date -功能字符 修改内容
��� 命令中各选项的含义分别为:
  -d datestr, --date datestr 显示由datestr描述的日期
  -s datestr, --set datestr 设置datestr 描述的日期
  -u, --universal 显示或设置通用时间
  时间域
  %H 小时(00..23)
  %I 小时(01..12)
  %k 小时(0..23)
  %l 小时(1..12)
  %M 分(00..59)
  %p 显示出AM或PM
  %r 时间(hh:mm:ss AM或PM),12小时
  %s 从1970年1月1日00:00:00到目前经历的秒数
  %S 秒(00..59)
  %T 时间(24小时制)(hh:mm:ss)
  %X 显示时间的格式(%H:%M:%S)
  %Z 时区 日期域
  %a 星期几的简称( Sun..Sat)
  %A 星期几的全称( Sunday..Saturday)
  %b 月的简称(Jan..Dec)
  %B 月的全称(January..December)
  %c 日期和时间( Mon Nov 8 14:12:46 CST 1999)
  %d 一个月的第几天(01..31)
  %D 日期(mm/dd/yy)
  %h 和%b选项相同
  %j 一年的第几天(001..366)
  %m 月(01..12)
  %w 一个星期的第几天(0代表星期天)
  %W 一年的第几个星期(00..53,星期一为第一天)
  %x 显示日期的格式(mm/dd/yy)
  %y 年的最后两个数字( 1999则是99)
  %Y 年(例如:1970,1996等)
  需要特别说明的是,只有超级用户才能用date命令设置时间,一般用户只能用date命令显示时间。
  例1:用指定的格式显示时间。
  $ date '+This date now is =>%x ,time is now =>%X ,thank you !'
  This date now is =>11/12/99 ,time is now =>17:53:01,thank you !
  例2:用预定的格式显示当前的时间。
  # date
  Fri Nov 26 15:20:18 CST 1999
  例3:设置时间为下午14点36分。
  # date -s 14:36:00
  Fri Nov 26 14:15:00 CST 1999
  例4:设置时间为1999年11月28号。
  # date -s 991128
  Sun Nov 28 00:00:00 CST 1999
  实例:设置时间伟2008年8月8号12:00
  # date -s "2008-08-08 12:00:00"
  修改完后,记得输入:clock -w
  把系统时间写入CMOS

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值