To bind the Network Time Protocol (NTP) daemon (ntpd
) to specific IP addresses on a Linux or Unix system, you can use the interface
directive in the ntpd
configuration file, /etc/ntp.conf
.
For example, to bind ntpd
to the IP addresses 192.0.2.1
and 198.51.100.1
, you can add the following lines to the ntp.conf
file:
interface listen 192.0.2.1 interface listen 198.51.100.1
This will cause ntpd
to listen for incoming NTP requests on the specified IP addresses.
Note that you may need to restart ntpd
for the changes to take effect. You can do this by running the following command:
systemctl restart ntpd
Alternatively, you can use the ntpdc
utility to modify the ntpd
configuration while the daemon is running. For example:
ntpdc -c "interface listen 192.0.2.1" ntpdc -c "interface listen 198.51.100.1"
This will add the specified IP addresses to the list of interfaces that ntpd
is listening on without requiring a restart of the daemon.
It's also worth noting that you can use the interface ignore
directive to exclude specific IP addresses from being listened on. For example:
interface ignore 192.0.2.2
This will cause ntpd
to ignore incoming NTP requests on the specified IP address.