Well, I was able to get my NTP stuff straightened out, so here is the overview that I wanted to write. NTP is fairly straight forward, but there are a few tricky parts in terms of how it works on Cisco devices (or at least I thought so). So hopefully this will make things clear.
The first thing to know about NTP is that Cisco devices will only learn time from a device that has synchronized to an existing time source. So in order to get the ball rolling with NTP in your Cisco network, you have 3 main options
- Synchronize to an external NTP server with one or more of your Cisco devices
- Synchronize to an internal NTP server with one or more of your Cisco devices (maybe a Linux box acting as a time server)
- Use the ntp master command on one of your Cisco devices to have it “synchronize” with itself. In a Cisco lab, this is really your only option.
Now that we have at least one device synchronized, we can start advertising time throughout the network. There are two main modes of advertising time. Client/Server mode and Symmetric Active (or Peer) mode. It’s important to know how each of these work. Before I get into the details, here are the 2 commands that we’ll be using.
ntp server (IP address) will specify a device to learn time from (used in client/server mode)
ntp peer (IP address) will specify a device to learn time from, as well as a device that time can be served to (used in peer mode)
Now that you know the basic commands, here is how things will operate. By default, if a Cisco device has synchronized its time, it will allow any other device to learn time from it. If a device uses the ntp server command, it will learn time from the specified device, but will not allow that device to learn time from it. If a device uses the ntp peer command, it will learn time from the specified device and also allow the device to learn time from it. Here are some examples to illustrate all of the different permutations.
In the following examples, Router A has synchronized its time and router B has not. Router B will attempt to learn time from Router A.
- Router B specifies Router A as its server, Router A does not specify router B as anything. Result= Router B gets time from Router A.
- Router B specifies Router A as its peer, Router A does not specify router B as anything. Result= Router B gets time from Router A.
- Router B specified Router A as its server, Router A specifies Router B as its peer. Result= Router B gets time from Router A.
- Router B specified Router A as its peer, Router A specifies RouterB as its peer. Result= Router B gets time from Router A.
- Router B specified Router A as its server, Router A specifies RouterB as its server. Result= Router B will not get time from Router A.
- Router B specified Router A as its peer, Router A specifies RouterB as its server. Result= Router B will not get time from Router A.
So basically it comes down to the following in terms of allowing other devices to learn time from a router (assuming the router is synchronized).
- The router does not specify the other device as a server or peer= it will serve time to the other device
- The router specifies the other device as a peer= it will serve time to the other device
- The router specifies the other device as a server= it will not serve time to the other device
So knowing this, what might be a good way to set up NTP in your network? First you’ll want to start off with one or more external time sources to learn from. The lower the stratum number (measurement of accuracy), the better. Have a handful of core network devices use these as ntp servers. Next, have all of these core network devices specify each other as ntp peers. That way, if any of the core network devices lose connection to their servers, they can keep each other on synchronized time. Finally, have your other devices use these core devices as their servers.
Depending on the size of your network, this might be overkill, or you’ll need a more expanded solution. But it’s a good starting point in terms of how to build a heirarchical NTP network.