NTP 时间服务的设置

  • 格式:docx
  • 大小:16.56 KB
  • 文档页数:2

NTP 时间服务的设置

Solaris 下NTP Server的设置

1、查看是否安装了NTP软件包(默认是安装的),有下面两行则是已安装 # pkginfo | grep ntp

system SUNWntpr NTP, (Root)

system SUNWntpu NTP , (Usr)

2、编辑配置文件ntp.conf #vi /etc/inet/ntp.conf

server 202.112.7.150 prefer

server 127.127.1.0

fudge 127.127.1.0

#broadcast 224.0.1.1 ttl 4

enable auth monitor

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type day enable

filegen loopstats file loopstats type day enable

filegen clockstats file clockstats type day enable

keys /etc/inet/ntp.keys

trustedkey 0

requestkey 0

controlkey 0

3、创建drift文件 touch /var/ntp/ntp.drift

4、停止、启动NTP服务器 /etc/init.d/xntpd start

/etc/init.d/xntpd stop

5、查看服务 ps -ef|grep ntp

查看进程 snoop |grep -i ntp 查看是否存在ntp包

6、查看其他服务器时间

ntpdate -q 132.118.64.25

7.检查服务器是否加成功

检查方法:ntpq –p

cd /usr/sbin/

里有NTP的相关,命令可用,可MAN查看一下

ln -s /etc/init.d/xntpd /etc/rc0.d/K10xntpd

ln -s /etc/init.d/xntpd /etc/rc2.d/S99xntpd

iostat -xnp 2

Linux NTP服务器的设置

1. 编辑 /etc/ntp.conf

restrict 127.0.0.1

restrict 192.168.10.0 mask 255.255.255.0 nomodify notrap

server

server server

server 127.127.1.0 # local clock

fudge 127.127.1.0 stratum 10

driftfile /var/lib/ntp/drift

broadcastdelay 0.008

keys /etc/ntp/keys

2. chkconfig –level 2345 ntpd on

3. service ntpd start

Linux客户端的设置

定期执行命令

/usr/sbin/ntpdate 192.168.10.1; /sbin/hwclock –w

/sbin/hwclock –w 是将时间写入BIOS

如果有防火墙,需要开放udp 123,tcp 123号端口

修改防火墙配置需要修改 /etc/sysconfig/iptables

-A RH-Lokkit-0-50-INPUT -p udp -m udp --dport 123 -j ACCEPT

-A RH-Lokkit-0-50-INPUT -p tcp -m tcp --dport 123 -j ACCEPT

Windows 2003客户端同步时间失败解决

在 Windows Server 2003 中尝试与非 Windows NTP 服务器同步时,时间同步可能失败

要解决此问题,请对“Windows 时间”进行配置,使它在与时间服务器同步时使用客户端模式。为此,请按照下列步骤操作:

1.单击“开始”,单击“运行”,键入 cmd,然后按 Enter 键。

2.在命令提示符处,按给出的顺序键入以下命令。键入每个命令后,按 Enter 键。

w32tm /config /manualpeerlist: 192.168.10.1,0x8 /syncfromflags:MANUAL

net stop w32time

net start w32time

w32tm /resync

H3C交换机与时间服务器同步的设置

>clock timezone GMT add 08:00:00

#ntp-service authentication enable

#ntp-service unicast-server 192.168.10.1