Table of Contents
Network Time Protocol (NTP)
NTP will be used to keep the clocks syncronized between the VM Server and the VM Guests.
Configure Timezone Settings
<html><p>You need to make sure your machine is using the correct timezone settings, so that it will properly adjust the time based on the current timezone configuration.<br \><br \> At the prompt type:</p></html>
sudo /usr/bin/tzselect
<html><p>You will then be need to answer a series of questions.</p> <br /> <ul> <li>First, you will select your continent.</html>
Please identify a location so that time zone rules can be set correctly. Please select a continent or ocean. 1) Africa 2) Americas 3) Antarctica 4) Arctic Ocean 5) Asia 6) Atlantic Ocean 7) Australia 8) Europe 9) Indian Ocean 10) Pacific Ocean 11) none - I want to specify the time zone using the Posix TZ format. #? 2
<html>I used 2 for “Americas”.</li> <li>Second, you will select your country.</html>
Please select a country. 1) Anguilla 27) Honduras 2) Antigua & Barbuda 28) Jamaica 3) Argentina 29) Martinique 4) Aruba 30) Mexico 5) Bahamas 31) Montserrat 6) Barbados 32) Netherlands Antilles 7) Belize 33) Nicaragua 8) Bolivia 34) Panama 9) Brazil 35) Paraguay 10) Canada 36) Peru 11) Cayman Islands 37) Puerto Rico 12) Chile 38) St Barthelemy 13) Colombia 39) St Kitts & Nevis 14) Costa Rica 40) St Lucia 15) Cuba 41) St Martin (French part) 16) Dominica 42) St Pierre & Miquelon 17) Dominican Republic 43) St Vincent 18) Ecuador 44) Suriname 19) El Salvador 45) Trinidad & Tobago 20) French Guiana 46) Turks & Caicos Is 21) Greenland 47) United States 22) Grenada 48) Uruguay 23) Guadeloupe 49) Venezuela 24) Guatemala 50) Virgin Islands (UK) 25) Guyana 51) Virgin Islands (US) 26) Haiti #? 47
<html>I used 47 for “United States”.</li> <li>Third, you will select your time region; if applicable.</html>
Please select one of the following time zone regions. 1) Eastern Time 2) Eastern Time - Michigan - most locations 3) Eastern Time - Kentucky - Louisville area 4) Eastern Time - Kentucky - Wayne County 5) Eastern Time - Indiana - most locations 6) Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties 7) Eastern Time - Indiana - Pulaski County 8) Eastern Time - Indiana - Crawford County 9) Eastern Time - Indiana - Pike County 10) Eastern Time - Indiana - Switzerland County 11) Central Time 12) Central Time - Indiana - Perry County 13) Central Time - Indiana - Starke County 14) Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties 15) Central Time - North Dakota - Oliver County 16) Central Time - North Dakota - Morton County (except Mandan area) 17) Mountain Time 18) Mountain Time - south Idaho & east Oregon 19) Mountain Time - Navajo 20) Mountain Standard Time - Arizona 21) Pacific Time 22) Alaska Time 23) Alaska Time - Alaska panhandle 24) Alaska Time - Alaska panhandle neck 25) Alaska Time - west Alaska 26) Aleutian Islands 27) Hawaii #? 1
<html>I used 1 for “Eastern Time”</li> <li>Last, you will be asked to review your information for correctness:</html>
The following information has been given: United States Eastern Time Therefore TZ='America/New_York' will be used. Local time is now: Thu May 20 12:36:14 EDT 2010. Universal Time is now: Thu May 20 16:36:14 UTC 2010. Is the above information OK? 1) Yes 2) No #? 1
<html>I entered 1 because it was correct.</li></ul></html>
Install the NTP Package
To install NTP, first lets make sure that our sources list is current, and all the latest package updates are intalled, and then install the package ntp.
sudo sh -c "aptitude update && aptitude safe-upgrade -y && aptitude install -y ntp"
NTP should now be installed and running.
Configuring a NTP Server
<html><p style=“margin:0em; padding:0em;”>The VM Server, vmserver03, will be acting as a NTP server to the VM Guests.<br /> <br /> You need to edit /etc/ntp.conf using the editor of your choice to tailor things to your needs.</p></html>
sudo vim /etc/ntp.conf
<html><p style=“margin:0em; padding:0em;”>The ntp.conf file on our server is as follows:</p></html>
# /etc/ntp.conf # Local clock oscillation file driftfile /var/lib/ntp/ntp.drift # Allow statistics to be logged. statsdir /var/log/ntpstats/ # Logging configuration statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable # Access control configuration restrict default kod nomodify notrap nopeer noquery # Deny everybody by default restrict 127.0.0.1 # Allow unrestricted access to self restrict 10.80.3.0 mask 255.255.255.0 nomodify # Serve time to local network # NTP servers to syncronise with server juicebox.lair.lan # Allow localhost to serve as a back-up time server server 127.127.1.0 fudge 127.127.1.0 stratum 10
<html><p style=“margin:0em; padding:0em;”>Now restart the NTP service to implement the changes.</p></html>
sudo /etc/init.d/ntp restart
Configuring a NTP Client on a Virtual Machine
<html><p style=“margin:0em; padding:0em;”>Again, you need to edit /etc/ntp.conf using the editor of your choice to tailor things to your needs.</p></html>
sudo vim /etc/ntp.conf
<html><p style=“margin:0em; padding:0em;”>The ntp.conf file on our client is as follows:</p></html>
# /etc/ntp.conf # Disable the panic threshold to allow irregular clock offsets tinker panic 0 # Local clock oscillation file driftfile /var/lib/ntp/ntp.drift # Allow statistics to be logged. statsdir /var/log/ntpstats/ # Logging configuration statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable # Access control configuration restrict default kod nomodify notrap nopeer noquery # Deny everybody by default restrict 127.0.0.1 # Allow unrestricted access to self # NTP servers to syncronise with server vmserver03.student.lab
<html><p style=“margin:0em; padding:0em;”> The main difference between our client and our server ntp.conf files is that the client file does not have a restrict directive that allows it to serve time to other systems. It also does not look to itself as a server.<br /> We need to do some additional configuration before we restart the NTP service to apply the changes on our virtual macines.</p></html>
Special Settings for Virtual Machines
<html><p style=“margin:0em; padding:0em;”>Because the NTP clients for the purposes of this portfolio will be used on Xen Virtual Machines, a few special configuration enhancements need to be made. The first, is the line tinker panic 0 from our client version of the ntp.conf. This allows the NTP client to update from the NTP server, regardless of differences in current system time – there are instances where the VM will begin adjusting it's clock automatically due to various system errors. The other requirement is to create a step-tinkers file and place it in /etc/ntp directory. (You may need to create this directory as it is not created by default as part of the installation process for NTP.)</p></html>
sudo sh -c "mkdir /etc/ntp && vim /etc/ntp/step-tinkers"
# /etc/ntp/step-tinkers
vmserver03.student.lab
<html><p style=“margin:0em; padding:0em;”>Restart the NTP service to implement the changes.</p></html>
sudo /etc/init.d/ntp restart