Chinaunix首页 | 论坛 | 博客
  • 博客访问: 6563102
  • 博文数量: 1005
  • 博客积分: 8199
  • 博客等级: 中将
  • 技术积分: 13071
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-25 20:19
个人简介

脚踏实地、勇往直前!

文章分类

全部博文(1005)

文章存档

2020年(2)

2019年(93)

2018年(208)

2017年(81)

2016年(49)

2015年(50)

2014年(170)

2013年(52)

2012年(177)

2011年(93)

2010年(30)

分类: LINUX

2011-12-04 14:45:28

操作系统:Red Hat Linux As5

[root@hxl ntp]# uname -a
Linux hxl 2.6.18-8.el5xen #1 SMP Fri Jan 26 14:42:21 EST 2007 i686 i686 i386 GNU/Linux

步骤1:检查是否安装了NTP软件包,若没有安装则需要安装(安装包在linux安装盘里会有).

[root@hxl ntp]# rpm -qa|grep ntp
ntp-4.2.2p1-5.el5

 

步骤2.配置/etc/ntp.conf文件

#加入中国或亚洲的时间服务器

server 0.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org

#注释掉安装时默认的时间服务器

#server 0.rhel.pool.ntp.org
#server 1.rhel.pool.ntp.org
#server 2.rhel.pool.ntp.org

#加入

restrict 0.cn.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 1.asia.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
restrict 2.asia.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

#注释掉(我的环境下找不到如下三行,直接加入如上三行就行)
#restrict 0.rhel.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
#restrict 1.rhel.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery
#restrict 2.rhel.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery

步骤3.配置/etc/ntp/step-tickers

#加入ntpd启动时提取时间同步的服务器,这里加入中国时间池服务器

0.cn.pool.ntp.org

步骤4:重启动ntpd

[root@hxl ntp]# service ntpd restart
Shutting down ntpd:                                        [  OK  ]
ntpd: Synchronizing with time server:                [  OK  ]
Starting ntpd:                                                 [  OK  ]

时间同步完成!

注:这里是本机器跟时间服务器做时间同步.

阅读(3345) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~