Network Time Protocol (NTP) is a protocol used to synchronize computer clock times in a network of computers. NTP uses Coordinated Universal Time (UTC) to synchronize computer clock times to a millisecond, and sometimes to a fraction of a millisecond. Setting up an NTP Server on Ubuntu & Linux Mint involves a series of steps which are detailed below.

Advertisement

Pre-requisites:

Before we begin, please ensure you have the following:

  • A machine running Ubuntu or Linux Mint.
  • Sudo or root access to run privileged commands.
  • A stable internet connection.

Step 1: Update Your System

First, update your system to the latest package versions. This helps to ensure that you have the latest security patches and system updates. Open Terminal and execute the following commands:

sudo apt-get update 
sudo apt-get upgrade 

Step 2: Install NTP

The next step is to install the NTP package which is available in the default Ubuntu & Linux Mint repositories. Run the following command to install NTP:

sudo apt-get install ntp 

Step 3: Configure NTP Server

Once installed, you need to configure the NTP server. The configuration file for NTP is located at /etc/ntp.conf. Use your favorite text editor to edit this file. For example, to use nano, type:

sudo nano /etc/ntp.conf 

In this configuration file, you can specify the NTP servers to which your machine will synchronize. These servers are specified in lines that begin with “server”. For example:

The iburst option allows the system to send a burst of packets if the server is unreachable.

Save your changes and close the editor.

Step 4: Allow NTP Through the Firewall

If you have a firewall enabled, you need to allow NTP through it. NTP uses UDP port 123, so you will need to allow this port through the firewall. If you’re using ufw firewall, you can do this with the following command:

sudo ufw allow 123/udp 

Step 5: Restart NTP Service

After making the changes, restart the NTP service for the changes to take effect. Use the following command to restart the NTP service:

sudo systemctl restart ntp 

Step 6: Verify NTP is Working

Finally, you should verify that NTP is working correctly. You can do this by querying the NTP service status and peers.

To check the status of the NTP service, use:

sudo systemctl status ntp 

To check the synchronization status, use:

ntpq -p 

This will display a list of configured NTP peers, along with information about the synchronization with each. Look for a * symbol next to one of the peers. This indicates that your NTP server is synchronizing with that peer.

Congratulations, you’ve set up an NTP server on your Ubuntu or Linux Mint machine!

Conclusion

Setting up an NTP server is a crucial task for maintaining correct time across all machines in a network. By following this guide, you now have a better understanding of how to install, configure, and verify the NTP server in Ubuntu & Linux Mint.

Bear in mind, managing an NTP server involves regular monitoring to ensure accurate synchronization of time. You should also keep your system and NTP software updated for best security and performance.

Share.
Leave A Reply


Exit mobile version