




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
文档名称文档密级一、 服务器端1、 安装ntp包2、 配置ntp服务修改ntp.conf文件,具体见附录3、 启动服务/etc/init.d/ntpd start4、自动启动chkconfig ntpd on5、 测试命令ntptracentpq -p二、 客户端1、 安装ntp包2、 配置ntp服务修改ntp.conf文件,具体见附录3、 查询时间不用启动ntpd服务,否则会出错执行命令:ntpdate 01 即可同步4、FAQ如果执行命令出现一下错误1.提示:7 Dec 19:24:55 ntpdate2120: the NTP socket is in use, exiting这个是你linux机器上已经存在这个进程,输入:ps -ef | grep ntpdKill掉ntp的进程2.提示:No Server suitable for synchronization found这个是最容易出现的问题,比较常见的是配置好服务器并启动服务器进程后,马上启动客户进程,那么客户进程就会报错。解决方法是,在大约3-5分钟以后启动进程就行我想每10分钟就和Windows服务同步时间1.创建自己的一个crontab文件,随便建立一个文件date.cron,首先可以使用任何文本编辑器建立一个新文件,然后向其中写入需要运行的命令和要定期执行的时间。vi date.cron加入下面要运行的命令和要定期执行的时间*/10 * * * * /usr/sbin/ntpdate 2然后存盘退出2.使用crontab命令来安装这个文件,使之成为该用户的crontab文件。键入:crontab date.cron这个文件已经建立好了3.使用命令:crontab -l (查看安排的作业序列)可以看到刚才的作业如:rootNXD-TEST root# crontab -l# DO NOT EDIT THIS FILE - edit the master and reinstall.# (date.cron installed on Tue Dec 7 18:22:42 2004)# (Cron version - $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)*/10 * * * * /usr/sbin/ntpdate 2现在就OK了,每10分钟Linux就和服务端同步一次。附录:服务器端ntp.conf# Permit time synchronization with our time source, but do not# permit the source to query or modify the service on this system.#restrict default nomodify notrap noquery# Permit all access over the loopback interface. This could# be tightened as well, but to do so would effect some of# the administrative functions.restrict # - CLIENT NETWORK -# Permit systems on this network to synchronize with this# time service. Do not permit those systems to modify the# configuration of this service. Also, do not use those# systems as peers for synchronization.restrict mask nomodify #112网段的客户端都可以访问# - OUR TIMESERVERS - #server 0. 不配置Internet网络时间服务器#server 1.#server 2.# - NTP MULTICASTCLIENT -#multicastclient# listen on default # restrict mask 55 nomodify notrap# restrict mask nomodify notrap# - GENERAL CONFIGURATION -# Undisciplined Local Clock. This is a fake driver intended for backup# and when no outside source of synchronized time is available. The# default stratum is usually 3, but in this case we elect to use stratum# 0. Since the server line does not have the prefer keyword, this driver# is never used for synchronization, unless no other other# synchronization source is available. In case the local host is# controlled by some external source, such as an external oscillator or# another protocol, the prefer keyword would cause the local host to# disregard all other synchronization sources, unless the kernel# modifications are in use and declare an unsynchronized condition.#server# local clockfudge stratum 10# Drift file. Put this in a directory which the daemon can write to.# No symbolic links allowed, either, since the daemon updates the file# by creating a temporary in the same directory and then rename()ing# it to the file.#driftfile /var/lib/ntp/driftbroadcastdelay0.008# Keys file. If you want to diddle your server at run time, make a# keys file (mode 600 for sure) and define the key number to be# used for making requests.# PLEASE DO NOT USE THE DEFAULT VALUES HERE. Pick your own, or remote# systems might be able to reset your clock at will. Note also that# ntpd is started with a -A flag, disabling authentication, that# will have to be removed as well.#keys/etc/ntp/keys客户端ntp.conf# Permit time synchronization with our time source, but do not# permit the source to query or modify the service on this system.#restrict default nomodify notrap noquery# Permit all access over the loopback interface. This could# be tightened as well, but to do so would effect some of# the administrative functions.restrict # - CLIENT NETWORK -# Permit systems on this network to synchronize with this# time service. Do not permit those systems to modify the# configuration of this service. Also, do not use those# systems as peers for synchronization.# restrict mask nomodify notrap# - OUR TIMESERVERS - server 01 设置局域网时间服务器地址#server 0.#server 1.#server 2.# - NTP MULTICASTCLIENT -#multicastclient# listen on default # restrict mask 55 nomodify notrap# restrict mask nomodify notraprestrict 01 mask nomodifY# - GENERAL CONFIGURATION -# Undisciplined Local Clock. This is a fake driver intended for backup# and when no outside source of synchronized time is available. The# default stratum is usually 3, but in this case we elect to use stratum# 0. Since the server line does not have the prefer keyword, this driver# is never used for synchronization, unless no other other# synchronization source is available. In case the local host is# controlled by some external source, such as an external oscillator or# another protocol, the prefer keyword would cause the local host to# disregard all other synchronization sources, unless the kernel# modifications are in use and declare an unsynchronized condition.#server# local clockfudge stratum 10# Drift file. Put this in a directory which the daemon can write to.# No symbolic links allowed, either, since the daemon updates the file# by creating a temporary in the same directory and then rename()ing# it to the file.#driftfile /var/lib/ntp/driftbroadcastdelay0.008# Keys file. If you want to diddle your server at run time, make a# keys file (mode 600 for sure) and define the key number to be# used for making
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 第9课 依法行使民主权利教学设计-2023-2024学年中职思想政治经济政治与社会人教版
- 第28课 改革开放和社会主义现代化建设的巨大成就 教学设计 -2024-2025学年高一统编版2019必修中外历史纲要上册
- 第10课《凡尔赛条约》和《九国公约》说课稿
- 九年级化学上册 第2单元 实验活动1 氧气的实验室制取与性质说课稿 (新版)新人教版
- 五年级体育下册 第十九课 对墙投掷小沙包、立定跳远 游戏:迎面接力说课稿
- 关于公司职工工作总结5篇
- 辅警招聘考试行政职业能力测验(数量关系)模拟试卷附完整答案
- 商业地产店面转让与运营管理合同
- 条码打印机专业维修与定期保养服务合同-@-1
- 创始股东投资与知识产权归属协议书
- 护林员巡护安全知识培训课件
- 辽宁省2025年中考英语真题附答案
- 喷涂基础知识培训课件
- 2025年驻外内聘考试题库
- 中铁四局工作汇报与战略规划
- 幼儿园教师防恐防暴安全知识培训
- 中国禁毒法课件
- 浅谈机关干部身心健康
- 湖南省多测合一收费指导标准(试行)2024年版
- 企业融资培训课件
- 2025年抗菌药物合理使用培训
评论
0/150
提交评论