红帽5和6的NTP时间同步
2016-04-05 16:06
375 查看
本机ip:12.18.10.33
首先检查是否有ntp包
# rpm -q ntp
如果没有则用yum配置即可
# yum install ntp
############################# rhel 5.x ######################################################
同一网段同步
vi /etc/ntp.conf
修改添加部分
# Hosts on local network are less restricted.
# 允许内网其他机器同步时间
restrict 12.18.10.0 mask 255.255.255.0 nomodify notrap
server 0.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
配置文件修改完成,保存退出,启动服务。
# service ntpd start
配置NTP服务为自启动
# chkconfig ntpd on
等待5分钟左右
手动同步:ntpdate 12.18.10.33
定时任务自动同步: root用户下crontab -e 编辑* * * * * /usr/sbin/ntpdate –u 12.18.10.33
--------------------------------------------------------------------------------------------
任何主机都同步
restrict default kod nomodify
restrict -6 default kod nomodify
server 0.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
####################################### rhel 6.x ###############################################################
同一网段同步
vi /etc/ntp.conf
修改添加部分
# Hosts on local network are less restricted.
# 允许内网其他机器同步时间
restrict 12.18.10.0 mask 255.255.255.0 nomodify notrap
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn
server 210.72.145.44 perfer # 中国国家受时中心
server 202.112.10.36 # 1.cn.pool.ntp.org
server 59.124.196.83 # 0.asia.pool.ntp.org
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
# 外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
首先检查是否有ntp包
# rpm -q ntp
如果没有则用yum配置即可
# yum install ntp
############################# rhel 5.x ######################################################
同一网段同步
vi /etc/ntp.conf
修改添加部分
# Hosts on local network are less restricted.
# 允许内网其他机器同步时间
restrict 12.18.10.0 mask 255.255.255.0 nomodify notrap
server 0.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
配置文件修改完成,保存退出,启动服务。
# service ntpd start
配置NTP服务为自启动
# chkconfig ntpd on
等待5分钟左右
手动同步:ntpdate 12.18.10.33
定时任务自动同步: root用户下crontab -e 编辑* * * * * /usr/sbin/ntpdate –u 12.18.10.33
--------------------------------------------------------------------------------------------
任何主机都同步
restrict default kod nomodify
restrict -6 default kod nomodify
server 0.cn.pool.ntp.org
server 1.asia.pool.ntp.org
server 2.asia.pool.ntp.org
####################################### rhel 6.x ###############################################################
同一网段同步
vi /etc/ntp.conf
修改添加部分
# Hosts on local network are less restricted.
# 允许内网其他机器同步时间
restrict 12.18.10.0 mask 255.255.255.0 nomodify notrap
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
# 中国这边最活跃的时间服务器 : http://www.pool.ntp.org/zone/cn
server 210.72.145.44 perfer # 中国国家受时中心
server 202.112.10.36 # 1.cn.pool.ntp.org
server 59.124.196.83 # 0.asia.pool.ntp.org
# Undisciplined Local Clock. This is a fake driver intended for backup
# and when no outside source of synchronized time is available.
# 外部时间服务器不可用时,以本地时间作为时间服务
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
相关文章推荐
- 树莓派linux驱动学习之LED控制
- linux下,使用lvm 创建、扩充 、缩减 逻辑磁盘大小,以及相应的文件系统大小
- 红帽5和6的网卡绑定
- CentOS 6 升级MySql (5.1.x 到 5.5, 再到5.6)
- 重新学习linux运维,努力让自己走上正轨~!
- 20135337朱荟潼 Linux第七周学习总结——可执行程序的装载
- CentOS下OpenSSL的安装和使用
- Linux练习题
- Centos Netdata 安装与配置
- Linux下同步工具inotify+rsync使用详解
- 树莓派linux驱动学习之hello world
- ArchLinux mount U盘
- Linux下对MySql数据库备份与恢复
- CentOS 6 编译安装Git 2.8.1
- Linux下动态共享库加载时的搜索路径详解
- 查看Linux服务器内存使用情况
- Linux常见命令
- linux 系统安装wifidog
- 快速诊断Linux性能
- linux内核参数注释与优化