NTP客户端配置

来源:互联网 发布:天谕捏脸嘴巴数据 编辑:程序博客网 时间:2024/05/20 14:17
11G RAC  配置NTP服务器tip01的IP:162.20.1.228  NTP服务端tip02的IP:162.20.1.229  NTP客户端配置NTP服务器之前,确认服务器已装好NTP包[root@tip01 ~]# rpm -qa  | grep ntpntp-4.2.2p1-9.el5_4.1chkfontpath-1.10.1-1.1然后再把服务器的系统时钟与硬件时间同步一下先查看下系统[root@tip01 ~]# date2012年05月20日 星期日 22:07:01 CST查看硬件时钟[root@tip01 ~]# hwclock 2012年05月20日 星期日 13时33分46秒  -0.415712 seconds这里,系统时钟与硬件时钟不同步,我们通过以下命令来把硬件时钟与系统时钟同步[root@tip01 ~]# clock --systohc在查看下系统时钟与硬件时钟,已经同步了[root@tip01 ~]# date2012年 05月20日 星期日 22:08:07 CST[root@tip01 ~]# hwclock 2012年 05月20日 星期日 22时08分12秒  -0.154372 seconds[root@tip01 ~]# 编辑tip01节点的配置文件# vi /etc/ntp.conf restrict default kod nomodify notrap nopeer noqueryrestrict -6 default kod nomodify notrap nopeer noqueryrestrict 127.0.0.1 restrict -6 ::1server  162.20.1.228    #server  127.127.1.0     #local clockfudge   127.127.1.0 stratum 10driftfile /var/lib/ntp/driftkeys /etc/ntp/keysrestrict 162.20.1.228  mask 255.255.255.255 nomodify notrap noquery编辑tip02节点ntp.conf文件# vi /etc/ntp.conf server tip01restrict tip01 mask 255.255.255.255 nomodify notrap noquery3.分别在tip01,tip02上修改NTPD参数文件#vi /etc/sysconfig/ntpdSYNC_HWCLOCK=yesOPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"#RAC安装时需要检测的-x参# cd /etc/ntp# lskeys  ntpservers  step-tickers# more ntpservers #This file contains a list of ntp servers to show in the system-config-date user interface.#It is not recommended that you modify this file by hand.#添加ntp 服务器地址或者主机名 tip01注:注意查看step-tickers内容,如果step-tickers错误也会导致ntp不同步# more step-tickers # 在tip01,tip02上执行chkconfig,使NTP服务开机启动[root@tip01 ~]# chkconfig  ntpd on[root@tip02 ~]# chkconfig  ntpd on[root@tip01 ~]# service ntpd restart关闭 ntpd:[确定]ntpd: 同步时间服务器:[失败]启动 ntpd:[确定]确保该端口以udp方式开放。[root@tip01 ~]# netstat -an |grep 123udp        0      0 192.168.99.228:123          0.0.0.0:*                               udp        0      0 162.20.1.228:123            0.0.0.0:*                               udp        0      0 127.0.0.1:123               0.0.0.0:*                               udp        0      0 0.0.0.0:123                 0.0.0.0:*                               udp        0      0 ::1:123                     :::*                                    udp        0      0 fe80::250:56ff:fe9d:123     :::*                                    udp        0      0 :::123                      :::*查看ntp状态[root@tip01 ~]# ntpstat synchronised to local net at stratum 11    time correct to within 11 ms   polling server every 1024 s在tip02节点启动ntp服务[root@tip02 ~]# service ntpd startntpd: 同步时间服务器:[确定]同步硬件时钟到系统时钟 [确定]启动 ntpd:[确定]切换至事先配好的grid用户来验证两节点时间[grid@tip02 ~]$ ssh tip01 date2012年 05月 20日 星期日 22:21:46 CST[grid@tip02 ~]$ ssh tip02 date2012年 05月 20日 星期日 22:21:48 CST[grid@tip02 ~]$ 


0 0