NTP Server Configuration

Problem

You want to configure the NTP server to provide time to your routers.

Solution

To configure an NTP server to provide time to your network, use the commands in Example 14-1.

Example 14-1. /etc/ntp.conf

#Define NTP Servers
#
server 10.1.1.1
server 10.2.2.2
server 10.3.3.3
#
#Define Access Control
restrict 10.1.1.1 nomodify notrap nopeer noquery
restrict 10.2.2.2 nomodify notrap nopeer noquery
restrict 10.3.3.3 nomodify notrap nopeer noquery
#
#Define NTP Drift File 
driftfile /var/log/ntp.drift

Warning

The NTP servers used in this example are fictitious. Please read the Discussion section to learn how to locate publicly available NTP servers.

Discussion

To find publicly available NTP servers to synchronize to, perform an nslookup on domain name pool.ntp.org. This DNS entry contains a number of Stratum 2 NTP servers that have agreed to participate in the DNS round robin group. Please be sure to perform the nslookup yourself to ensure you choose active and accurate NTP servers. The ones listed in the following example may have grown stale since the publication of this book:

Freebsd% nslookup pool.ntp.org
Server:  dns.oreilly.com
Address:  172.25.1.99

Non-authoritative answer:
Name:    pool.ntp.org
Addresses:  194.231.42.100, 216.52.237.151, 64.81.87.189, 65.111.164.224
          66.17.252.26, 66.180.134.50, 67.128.71.75, 72.21.46.202, 80.190.241.157, 84.16.227.201, 84.45.18.237, 139.140.181.133

Freebsd%

We strongly recommend that you use the IP addresses, since the restrict commands ...

Get Cisco IOS Cookbook, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.