http://blogging.dragon.org.uk/setting-up-ntp-on-ubuntu-14-04/
This is a really quick post, as most Linux (or M$ Windows) installations will use/need an NTP server to keep the time in sync with other machines on the LAN.
BUT, if you want to use some time servers closer to your home. Go and have a look at http://www.pool.ntp.org/en/ there you will find lists of pool servers from all over the world. I live in England so I use the UK pool.
Edit the ntp configuration file.
Look for the lines similar to these and either remove or comment them out.
Replace them with the pool servers of your choice, I will be using
the UK pool. You need 3 servers to form a quorum for ntp, so always
configure at least 4 servers.
If this is running a machine that is turned on all the time or for
long periods, you can use this setup for your own local time server.
Which means you can point all of your other local machines at this one.
It will also save a very small amount of your broadband bandwidth. 
This line tell the ntp server to prefer the server at
your.ntp.server.local, change ithe hostname to point at your main NTP
server. The iburst sends requests quicker at the beginning so it can get
established quicker after a restart.
You should see some output similar to this
In the output from ‘pe’ , short for peers. One of the servers listed
has a condition of sys.peer. This is the one you are syncing to.
Looking at the output from ‘as’, associations, one of the servers has an ‘*’ by it this is the one you are syncing to.
The columns in the second out put show the following data.
This is a really quick post, as most Linux (or M$ Windows) installations will use/need an NTP server to keep the time in sync with other machines on the LAN.
Update and Install
As always, start with an up to date install. Installing the software is just two packages the server, ntp, and some utilities, ntpdate.sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install ntp ntpdate
Which pool to use
If you want a server that syncs its time to the Ubuntu pool that is all you need do. I told you it was a quick post.BUT, if you want to use some time servers closer to your home. Go and have a look at http://www.pool.ntp.org/en/ there you will find lists of pool servers from all over the world. I live in England so I use the UK pool.
Edit the ntp configuration file.
sudo nano /etc/ntp.conf
server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org # Use Ubuntu's ntp server as a fallback. server ntp.ubuntu.com
server 0.uk.pool.ntp.org server 1.uk.pool.ntp.org server 2.uk.pool.ntp.org server 3.uk.pool.ntp.org

Local clients
If you have a machine with the setup above and now you want to point your remaining local machines at it. Use the same setup but add the following line to /etc/ntp.conf, for the local clients.server your.ntp.server.local prefer iburst
Testing that you are using a time server
After the server has been running for 10-20 minutes it will get synced up and will be keeping your ntp server in time. Run the command below, note it uses watch so it will rerun the command every 2 seconds.watch ntpq -cpe -cas
ind assid status conf reach auth condition last_event cnt =========================================================== 1 45093 931a yes yes none outlyer sys_peer 1 2 45094 941a yes yes none candidate sys_peer 1 3 45095 9324 yes yes none outlyer reachable 2 4 45096 941a yes yes none candidate sys_peer 1 5 45097 961a yes yes none sys.peer sys_peer 1 remote refid st t when poll reach delay offset jitter ============================================================================== -84.52.184.247 193.2.1.117 2 u 27 64 377 61.189 -10.651 2.794 +de-ntp01.10g.ch 212.82.32.15 2 u 30 64 373 24.568 1.526 4.754 -mirror.muntinte 193.190.230.65 2 u 28 64 377 17.568 9.128 5.514 +smtp2.xipalia.c 131.188.3.221 2 u 21 64 267 26.973 -1.563 3.192 *golem.canonical 140.203.204.77 2 u 5 64 373 11.054 -0.279 6.532
Looking at the output from ‘as’, associations, one of the servers has an ‘*’ by it this is the one you are syncing to.
The columns in the second out put show the following data.
- st stratus, The lower the number the closer you are to the real GPS time source. anything below 3 is good.
- When the number of seconds before the next poll, or time check.
- reach This is a scrolling number in base 8. it show the status of the connections to the sever. When it reads 377 that is the best.
- delay is the time taken to get a reading from the server.
- Offset is how much time your server is out from the ones you are using.
- Jitter the amount of wobble on the time server.
Stopping and starting the ntp server.
To start, stop, restart the ntp server use the usual commandssudo service ntp start sudo service ntp stop sudo service ntp restart
No comments:
Post a Comment