linux配置域名ntp,在linux上配置NTP

操作系统: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  ]

时间同步完成!

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

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值