Jaime Frutos Morales's blog

31/08/2010

How to install and configure a NTP server for your network on Ubuntu Server 10.04

Filed under: SysAdmin, Ubuntu — acidborg @ 13:29

Description: The Network Time Protocol (NTP) is a protocol for synchronizing the clocks of computer systems over a network. It is very useful if you want all the computers on your network to share the same time because file accesses, logs, tasks, etc will be synchronized. I’m going to explain how to install a NTP server on your network so that the rest of computers can synchronize with it.

Installation: apt-get install ntp

Configuration:

  1. Go to www.pool.ntp.org, select your continent on the Active servers list and your country (or the nearest one) on the next list.
  2. You will be given a list of public NTP servers to synchronize your server with. For example, if you live in Spain, you will be given the following list of NTP servers: server 2.es.pool.ntp.org , server 0.europe.pool.ntp.org , server 2.europe.pool.ntp.org .
  3. Edit your /etc/ntp.conf file using the list of servers you were given:
    server 1.es.pool.ntp.org
    server 0.europe.pool.ntp.org
    server 2.europe.pool.ntp.org
    restrict -4 default kod notrap nomodify nopeer noquery
    restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap noquery
    restrict 127.0.0.1
    driftfile /var/lib/ntp/ntp.drift
  4. Change the line “restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap noquery” with your subnet IP and netmask.
  5. Restart your NTP server: /etc/init.d/ntp restart

Some seconds later, your NTP server will begin to synchronize with the external time servers. It may take a couple of minutes to get your computer’s clock synchronized, so please be patient. You can check your NTP server’s stats and status with the following command: ntpq -p .

NOTE: your NTP server must be reachable on port 123 (UDP) from the remote time servers, so make sure your firewall allows it.

On my next post, I will explain how to synchronize your GNU/Linux computers with the NTP server you have just installed.

Blog at WordPress.com.