How to bind ntpd to specific IP addresses on Linux/Unix

The process for binding the Network Time Protocol (ntpd) daemon to specific IP addresses on Linux or Unix depends on the version of ntpd you are using. Here are some general steps that should work for most versions:

  1. Open the ntpd configuration file, which is usually located at /etc/ntp.conf.

  2. Find the line that starts with server, which specifies the NTP servers that ntpd should use for time synchronization.

  3. Add the interface option to the server line, followed by the IP address or hostname of the interface you want to bind to. The format should look like this:

     
    server <NTP server hostname or IP> interface <interface IP or hostname>
  4. Save the changes to the configuration file and exit the editor.

  5. Restart the ntpd daemon to apply the changes. This can typically be done using the systemctl or service command, depending on your operating system. For example, on a system using systemctl, you would run:

     
    sudo systemctl restart ntp

After the ntpd daemon has restarted, it should only use the specified IP addresses for communication with NTP servers. You can verify this by using the ntpq command to check the status of the ntpd service.

Leave a Comment