授时服务器 NTP 基本脚本
2015-08-18 11:13
633 查看
yum install ntp*
[root@07_NTP_59 ~]# yum install ntp*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Setting up Install Process
Package ntpdate-4.2.6p5-5.el6.centos.x86_64 already installed and latest version
Package ntp-doc-4.2.6p5-5.el6.centos.noarch already installed and latest version
Package ntp-perl-4.2.6p5-5.el6.centos.x86_64 already installed and latest version
Package ntp-4.2.6p5-5.el6.centos.x86_64 already installed and latest version
Nothing to do
NTP server的维护
----添加为服务
chkconfig --level 345 ntpd on
----启动
service ntpd start
service ntpd stop
加计划任务
crontab -e
*/10 * * * * ntpdate 202.120.2.101
上海交大ntp服务器:202.120.2.101
客户机
echo “00 */1 * * * root /usr/sbin/ntpdate 192.168.59.138;/sbin/hwclock -w”>>/etc/crontab
每小时同NTP server进行一次时钟同步,并写入本机BIOS IP为NTP服务器IP
1)修改/etc/ntp.conf文件
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#指定Internet上的时间服务器
restrict 207.46.232.182 mask 255.255.255.255 nomodify notrap noquery
server 207.46.232.182
server 127.127.1.0
fudge 127.127.1.0 stratum 10
keys /etc/ntp/keys
#指定NTP服务器日志文件
logfile /var/log/ntp
2)修改/etc/ntp/stpe-tickers文件,内容如下(当ntpd服务启动时,会自动与该文件中记录的上层NTP服务进行时间校对)
207.46.232.182
127.127.1.0
3)修改/etc/sysconfig/ntpd文件,内容如下:
#允许BIOS与系统时间同步,也可以通过hwclock -w 命令
SYNC_HWCLOCK=yes
4)在配置完成并重新启动服务后,可通过ntpstat 命令显示本机上一次与上层ntp服务器同步时间的情况,也可以使用ntpq -p 查看本机与上层ntp服务器通信情况
[root@07_NTP_59 ~]# yum install ntp*
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Setting up Install Process
Package ntpdate-4.2.6p5-5.el6.centos.x86_64 already installed and latest version
Package ntp-doc-4.2.6p5-5.el6.centos.noarch already installed and latest version
Package ntp-perl-4.2.6p5-5.el6.centos.x86_64 already installed and latest version
Package ntp-4.2.6p5-5.el6.centos.x86_64 already installed and latest version
Nothing to do
NTP server的维护
----添加为服务
chkconfig --level 345 ntpd on
----启动
service ntpd start
service ntpd stop
加计划任务
crontab -e
*/10 * * * * ntpdate 202.120.2.101
上海交大ntp服务器:202.120.2.101
客户机
echo “00 */1 * * * root /usr/sbin/ntpdate 192.168.59.138;/sbin/hwclock -w”>>/etc/crontab
每小时同NTP server进行一次时钟同步,并写入本机BIOS IP为NTP服务器IP
1)修改/etc/ntp.conf文件
restrict default kod nomodify notrap nopeer noquery
restrict 127.0.0.1
restrict -6 ::1
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap
#指定Internet上的时间服务器
restrict 207.46.232.182 mask 255.255.255.255 nomodify notrap noquery
server 207.46.232.182
server 127.127.1.0
fudge 127.127.1.0 stratum 10
keys /etc/ntp/keys
#指定NTP服务器日志文件
logfile /var/log/ntp
2)修改/etc/ntp/stpe-tickers文件,内容如下(当ntpd服务启动时,会自动与该文件中记录的上层NTP服务进行时间校对)
207.46.232.182
127.127.1.0
3)修改/etc/sysconfig/ntpd文件,内容如下:
#允许BIOS与系统时间同步,也可以通过hwclock -w 命令
SYNC_HWCLOCK=yes
4)在配置完成并重新启动服务后,可通过ntpstat 命令显示本机上一次与上层ntp服务器同步时间的情况,也可以使用ntpq -p 查看本机与上层ntp服务器通信情况
相关文章推荐
- 浅析php中jsonp的跨域实例
- PHP代码:获取指定URL页面中的所有链接
- php:验证码
- thinkphp 验证码
- 对慕课网 -- php模糊查询技术 的学习
- strace 监控所有php-fpm worker
- thinkphp:模板中使用的系统变量和常量
- PHP: mysql学习
- php:smarty模板的使用
- php:curl_init函数
- php:九个你必须知道而且又很好用…
- 十五套专为开发人员打造的PHP资源库
- phpcms-v9二次开发所必须知道的步骤
- PHP中mysqli使用2
- 怎么配置FTP站点
- php中DOMDocument简单用法(XML创建、添加、删除、修改)
- Php 获取xml中的节点值
- PHP对XML文件操作详细
- phpstorm常用设置
- TP缓存设计方案解析