Chinaunix

标题: ESX3.5 NTP配置出错解决方法 [打印本页]

作者: eagleking05    时间: 2009-09-08 08:41
标题: ESX3.5 NTP配置出错解决方法

ESX3.5 NTP配置出错解决方法

本文主要解决利用GUI方式配置esx3.5 ntp时出现的"Failed to change host configuration"错误。解决的思路是:采用手工修改配置文件的方式进行。
注意:手工修改完成后,在VIC中看到的时间配置信息与实际不符,为了保持一致,重新启动mgmt-vmware即可,启动方法为:/etc/init.d/mgmt-vmware restart。
手工修改配置文件详细过程如下(红色部分为必须,其它可选):

Installing and Configuring NTP on VMware ESX Server
Products



VMware ESX
Details



How do I install and configure NTP on an ESX Server system?
Solution



Note: This article was updated March 16, 2007 to add vmware to the pool designation. All examples for x.pool.ntp.org have been changed to x.vmware.pool.ntp.org. The last line pool.ntp.org in /etc/ntp/step-tickers and /etc/hosts has been removed from the examples. This line is no longer required.

Beginning with ESX Server 2.0.1, NTP is installed by default during the installation of ESX Server. See the following instructions to configure this service.
For ESX Server 2.0.0, see the instructions later in this article to install and configure NTP.
ESX Server 2.0.1 and Later
To configure NTP on the service console, you must:
  • Edit the following configuration files, as described in the following sections:
  • /etc/ntp.conf
  • /etc/ntp/step-tickers

  • /etc/hosts

  • For ESX Server 3.0 only, run the following command. This opens the appropriate ports and enables the NTP daemon to talk with the external server.
    [root@esxhost]# esxcfg-firewall --enableService ntpClient
  • Restart ntpd.
    Editing /etc/ntp.conf
    Specify a pool of NTP servers to which your ESX Server system will sync (for more information about using NTP server pools, see
    http://www.pool.ntp.org/use.html
    ).
  • Log on to the service console as the root user.

  • You are going to replace the content of /etc/ntp.conf, so make a backup copy of this file:
    cp /etc/ntp.conf /etc/ntp.conf.bk

  • Edit the contents of the default /etc/ntp.conf, which the ESX Server installation creates for you, so the file looks like this:
    restrict 127.0.0.1
    restrict default kod nomodify notrap
    server 0.vmware.pool.ntp.org (可以使用IP地址)
    server 1.vmware.pool.ntp.org
    server 2.vmware.pool.ntp.org
    driftfile /var/lib/ntp/drift


  • restrict – The first restrict is required because ntpd needs to resolve hostname addresses via the loopback network. If this entry does not exist, the system log ( /var/log/messages) will show something like this:
    ntpd_initres: ntpd returns a permission denied error
    For systems directly connected to the Internet, the second restrict line provides a basic level of protection from general UDP spoofing of NTP.

  • kod – Sends a KoD packet when an access violation occurs.

  • nomodify – Denies ntpq and ntpdc queries that attempt to modify the run-time configuration of the server. Queries that return information are permitted.

  • notrap – Declines to provide mode 6 control message trap service to matching hosts. The trap service is a subsystem of the ntpdq control message protocol, which is intended for use by remote event logging programs.
    For better protection, you may want to add noquery, which prevents remote queries, and nopeer, which prevents a host from trying to peer with your server and to allow a rogue server to control the clock.
    Refer to
    http://www.eecis.udel.edu/~mills/ntp/html/accopt.html
    for a full description of these access control commands.
    The 0, 1, and 2.vmware.pool.ntp.org names point to a random set of servers that change every hour.
    The driftfile line indicates the name of the file where the value for the system's clock drift (frequency error) is stored. For a more complete definition of driftfile, see
    http://www.eecis.udel.edu/~mills/ntp/html/notes.html
    .
    Editing /etc/ntp/step-tickers
    Perform the following steps as the root user on the service console.

  • If you want, make a backup copy of your /etc/ntp/step-tickers file:
    cp /etc/ntp/step-tickers /etc/ntp/step-tickers.bk

  • Edit /etc/ntp/step-tickers so that the file looks like the following example:
    0.vmware.pool.ntp.org(可以使用IP地址)
    1.vmware.pool.ntp.org
    2.vmware.pool.ntp.org
    Editing /etc/hosts
    Perform the following step as the root user on the service console.
  • Edit /etc/hosts.

  • Add the following list of NTP pool servers to the end of your existing hosts list.
    0.vmware.pool.ntp.org
    1.vmware.pool.ntp.org
    2.vmware.pool.ntp.org
    Adding this list of NTP servers minimizes the impact of DNS lookup failures during NTP synchronization.
    ESX 3.0 Only: Enabling NTP Client for Firewall
    As noted earlier in this article, remember to run the following command. This opens the appropriate ports and enables the NTP daemon to talk with the external server.
    [root@esxhost]# esxcfg-firewall --enableService ntpClient
    Restarting and Monitoring the NTP Service
    Perform these steps as root on the service console.
  • After you have edited the previous files, restart the NTP service.


  • Now you can set the local hardware clock to the NTP synchronized local system time. Run:
    hwclock --systohc

    As ntpd successfully polls NTP servers, the kernel automatically sets the hardware clock to the system clock time periodically.
  • Monitor the NTP service as desired:

    Additional documentation for NTP is available at
    http://ntp.isc.org/bin/view/Main/DocumentationIndex
    .
    ESX Sever 2.0.0
    To install and configure NTP on the console operating system (service console):
  • Log on to the console as the root user.

  • Mount the ESX Server CD on the console:
    mount /mnt/cdrom
  • Change to the /mnt/cdrom/RedHat/RPMS directory.

  • Install the NTP package:
    rpm -Uhv ntp-*.i386.rpm
  • Change to the /etc directory.

  • You should be able to find a file called ntp.conf (after the rpm installation) in the /etc directory (you changed into this directory in step 5). Edit this file using:
    vi ntp.conf

  • Find the the line that reads:
    server 127.127.1.0 # local clock
    Change it to:
    server 192.6.38.127 # This is an example only
    Save the file.
  • Create a file named step-tickers in the /etc/ntp directory. In this file, list the host name of your reference time server.

  • To enable the ntp daemon to autostart when the server is rebooted, run:
    chkconfig ntpd on

  • To start it now without rebooting, run:
    /etc/rc.d/init.d/ntpd start
    The time drift corrects after a while.

  • Wait a few seconds (up to a minute), then run:
    ntpq -p
    This lists the current status.

  • Use umount to unmount the ESX Server CD:
    umount /mnt/cdrom
    These examples use a source server IP address obtained from a list of open access NTP servers. You may select one that suits you from
    http://ntp.isc.org/bin/view/Servers/WebHome
    .
    Product Versions



    VMware ESX Server 2.1.x
    VMware ESX Server 2.5.x
    VMware ESX Server 3.0.x
    Keywords



    1339; 868; urlz; kssfeedback
    Last Modified Date: 04-26-2008

    ID: 1339


    本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/90963/showart_2047779.html




    欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2