所有分類 (63)
技術文章 (41)
旅遊 (5)
生活 (17)
ColorSwitch 00 01 02
views: 5573 times

ESX Server 2.0.1 and Later

To configure NTP on the service console, you must:

  1. Edit the following configuration files, as described in the following sections:
    1. /etc/ntp.conf
    2. /etc/ntp/step-tickers
    3. /etc/hosts

  2. 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

  3. 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).

  1. Log on to the service console as the root user.

  2. 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


  3. 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
    server 1.vmware.pool.ntp.org
    server 2.vmware.pool.ntp.org
    driftfile /var/lib/ntp/drift

    1. 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.

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

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

    4. 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.

Editing /etc/ntp/step-tickers

Perform the following steps as the root user on the service console.

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

    cp /etc/ntp/step-tickers /etc/ntp/step-tickers.bk

  2. Edit /etc/ntp/step-tickers so that the file looks like the following example:

    0.vmware.pool.ntp.org
    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.

  1. Edit /etc/hosts.

  2. 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.

  1. After you have edited the previous files, restart the NTP service.

    • To restart the service now, run:

      service ntpd restart

    • To enable the NTP daemon to autostart when the server is rebooted, run:

      chkconfig --level 345 ntpd on

  2. 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.

  3. Monitor the NTP service as desired:

    • To see the offset (in seconds) between the local clock and the source clock, run:

      ntpdate -q time_server_name_or_ip_address

      If the correction resulting from synchronizing the local clock with the time server is large enough, it could affect the operating systems or applications running in virtual machines when they synchronize their clocks with the ESX Server system on which they are running.

    • To watch the status of the ntpd process, run:

      watch "ntpq -p"

      Press Ctrl-c to stop watching the process.

      Note the information in the following columns:

      • The character in the first column indicates the quality of the source.

      • The asterisk ( * ) indicates the source is the current reference.

      • remote lists the IP address or host name of the source.

      • when indicates how many seconds have passed since the source was polled.

      • poll indicates the polling interval. This value increases depending on the accuracy of the local clock.

      • reach is an octal number that indicates reachability of the source. A value of 377 indicates the source has answered the last eight consecutive polls.

      • offset is the time difference between the source and the local clock in milliseconds.

Trackback Address :: http://diary.tw/willkao/trackback/489









articles
recent replies
recent trackbacks
notice
BLOG main image
技術文件,雜事,紀錄
34 76658
  rss skin by  m22m