DebianDebian Based

How To Setting Up NTP Server and Client on Debian 12

Setting Up NTP Server and Client on Debian 12

In this tutorial, we will show you how to set up NTP Server and Client on Debian 12. Accurate time synchronization is crucial for any computer network. Network Time Protocol (NTP) plays a pivotal role in ensuring time consistency across systems, facilitating smooth data transfer, and effective coordination.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you step-by-step setup NTP Server and Client on a Debian 12 (Bookworm).


  • A server running one of the following operating systems: Debian 12 (Bookworm).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for NTP.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Setting Up NTP Server and Client on Debian 12 Bookworm

Step 1. Before we install any software, it’s important to make sure your system is up to date by running the following apt commands in the terminal:

sudo apt update
sudo apt upgrade

This command will refresh the repository, allowing you to install the latest versions of software packages.

Step 2. Installing NTP Packages on the Server and Client on Debian 12.

To start, we need to install the NTP package on both the server and client machines. This package will provide the necessary tools and daemons for NTP synchronization:

sudo apt install ntp

After the installation, check the status of the NTP service to ensure everything is running correctly:

sudo systemctl status ntp

Step 3. Configuring the NTP Server.

Now that the groundwork is laid, let’s proceed with the NTP server configuration. The NTP server is the central node that provides time information to other devices within the network:

sudo nano /etc/ntp.conf

In the configuration file, you can specify NTP server pools, which are a collection of NTP servers worldwide, managed by various organizations. Choose the pool closest to your location to minimize latency:

server <server-pool-name>

Additionally, you can specify preferred servers by adding a “prefer” statement. This will ensure that the NTP daemon prioritizes these servers when synchronizing time:

server <preferred-ntp-server> prefer

Step 4. Allow NTP Traffic Through the Firewall.

If your Debian 12 system has a firewall enabled (e.g., ufw), you’ll need to permit NTP traffic to pass through:

sudo ufw allow ntp

Now, restart the NTP service to apply the changes you made in the configuration file:

sudo systemctl restart ntp

Step 5. Configuring the NTP Client.

With the NTP server in place, we can proceed to configure the NTP client. The NTP client synchronizes its time with the NTP server to ensure uniformity throughout the network:

sudo nano /etc/ntp.conf

Similar to the server configuration, specify the NTP servers that the client will synchronize with:

server <ntp-server-1>
server <ntp-server-2>

To give priority to one server, use the “prefer” statement, just like in the server configuration:

server <preferred-ntp-server> prefer

After saving the client’s NTP configuration, it’s time to synchronize with the NTP server:

sudo systemctl restart ntp

To confirm that the NTP client successfully synchronized with the server, check the synchronization status:

ntpq -p

Step 6. Troubleshooting NTP Issues.

If you encounter any issues during the NTP setup process, follow these troubleshooting tips:

  • A. Check NTP Service Status
sudo systemctl status ntp
  • B. Examine NTP Logs for Errors
grep "error" /var/log/syslog

Congratulations! You have successfully installed NTP. Thanks for using this tutorial to set up NTP on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official NTP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button