The content of the NTP configuration file, /etc/ntp.conf, really does not need to be complex. Basically, you just need three lines in it to create an NTP time server, as shown in Listing 20-1.
Listing 20-1. Example ntp.conf Configuration server 127.127.1.0
fudge 127.127.1.0 stratum 10
The first line in Listing 20-1 specifies what the NTP process should use if the connection with the NTP time server is lost for a longer period; this line makes sure the local clock in your server will not drift too much. This line references a local clock. Every type of local clock has its own IP address from the range of loopback IP addresses. The format of this address is 127.127.x.x; the third byte refers to the type of local clock that is used, and the fourth byte refers to the instance of the clock to which your server is connected. The default address to use to refer to the local computer clock is 127.127.1.0. Notice that all clocks that can be used as an external reference clock have their own predefined IP address (see the refclock.html file for more on that).
Tip Even if your server is connected to an NTP server that is directly on the Internet, it makes sense to use at least one local external reference clock on your network. This way you can ensure that time synchronization will continue to work properly if the connection to the Internet fails for a longer period of time.
The second line defines what should happen when the server falls back to the local external reference clock mentioned on the first line. This line starts with the keyword fudge to indicate a situation that is not normal. In this situation, the server should use the local clock, and the server sets its stratum to 10. By using this stratum, the server indicates that it is not very trustworthy but ensures that it can be used as a time source anyway.
The last line in the previous example shows what should happen under normal circumstances. This line ordinarily refers to an IP address or server name on the network of the Internet provider. This line will always be used if nothing strange is happening.
Tip Looking for an NTP time server to use? Several are available on the Internet.At http://www.ntp.org, you'll find a list of time servers that are publicly available. You can also set pool.ntp.org as your time server. This is a publicly available time server on the Internet.
Was this article helpful?