CentOS6 client server NTP同步配置
2016-03-11 13:46
351 查看
公司局域网,已经配置好了一台NTP服务器,现配置客户机与服务端时间同步。
方法一:
crontab定时任务,ntpdate同步客户机与NTP服务器时间
每天7:30同步时间,并写入BIOS
[root@VMServer etc]# crontab -l
30 7 * * * /usr/sbin/ntpdate 10.191.130.130; /sbin/hwclock -w
[root@VMServer etc]#
方法二:
ntpd既是服务器端,又是客户端。
1)作为客户端运行时,修改ntp.conf文件增加server 192.168.1.1
vi /etc/ntp.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
server 192.168.1.1
2)ntpd设为开机启动并运行:
[root@VMServer etc]# chkconfig ntpd on
[root@VMServer etc]# chkconfig | grep ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@VMServer etc]# service ntpd start
Starting ntpd: [ OK ]
[root@VMServer etc]# service ntpd status
ntpd (pid 9897) is running...
[root@VMServer etc]#
两种方法的区别:
ntpd在实际同步时间是一点点的校准过来时间的,最终把时间慢慢的矫正对。
而ntpdate不会考虑其他程序是否会阵痛,直接调整时间。
一个是校准时间,一个是调整时间。
备注:
ntpd既是服务器端,也是客户端
作为服务器运行时:
1)修改/etc/ntp.conf增加
restrict 127.0.0.1
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
2)运行:
service ntpd start
作为客户端运行时:
1)修改/etc/ntp.conf增加
server 192.168.1.1
2)运行:
service ntpd start
其他都是默认设置。
方法一:
crontab定时任务,ntpdate同步客户机与NTP服务器时间
每天7:30同步时间,并写入BIOS
[root@VMServer etc]# crontab -l
30 7 * * * /usr/sbin/ntpdate 10.191.130.130; /sbin/hwclock -w
[root@VMServer etc]#
方法二:
ntpd既是服务器端,又是客户端。
1)作为客户端运行时,修改ntp.conf文件增加server 192.168.1.1
vi /etc/ntp.conf
# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (http://www.pool.ntp.org/join.html).
server 0.centos.pool.ntp.org iburst
server 1.centos.pool.ntp.org iburst
server 2.centos.pool.ntp.org iburst
server 3.centos.pool.ntp.org iburst
server 192.168.1.1
2)ntpd设为开机启动并运行:
[root@VMServer etc]# chkconfig ntpd on
[root@VMServer etc]# chkconfig | grep ntpd
ntpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
ntpdate 0:off 1:off 2:off 3:off 4:off 5:off 6:off
[root@VMServer etc]# service ntpd start
Starting ntpd: [ OK ]
[root@VMServer etc]# service ntpd status
ntpd (pid 9897) is running...
[root@VMServer etc]#
两种方法的区别:
ntpd在实际同步时间是一点点的校准过来时间的,最终把时间慢慢的矫正对。
而ntpdate不会考虑其他程序是否会阵痛,直接调整时间。
一个是校准时间,一个是调整时间。
备注:
ntpd既是服务器端,也是客户端
作为服务器运行时:
1)修改/etc/ntp.conf增加
restrict 127.0.0.1
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
2)运行:
service ntpd start
作为客户端运行时:
1)修改/etc/ntp.conf增加
server 192.168.1.1
2)运行:
service ntpd start
其他都是默认设置。
相关文章推荐
- 基于CentOS6.5环境之下的LNMP之编译安装mysql5.6.27
- linux中线程的实现以及跟windows系统的比较
- linux命令:配置sudo
- Linux下keepalived+mysql 实现高可用
- 开发--CentOS 6.4 图文安装教程(有些设置大部分教程没出现过)
- eclipse远程调试linux下的weblogic
- Linux驱动相关命令:
- 线程相关API集合(Linux)
- Linux下实现输入密码以星号显示
- CentOS 下的包管理工具RPM
- CentOS/Ubuntu 下 MySQL 的安装
- CentOS7.1 KVM虚拟化之linux虚拟机安装(2)
- 使用bochs和grub建立可引导硬盘镜像
- linux(centos)搭建svn服务器
- Linux论坛
- linux下U盘文件系统类型的识别以及挂载
- win上传Linux文件乱码问题解决办法
- Linux进程通信的几种方式
- linux编程之GDB调试
- Linux 2.6 中的页面回收与反向映射