Suppose you’re in your room, surfing the net in USA and you visit an Indian website. The server in India is in different time zone. It’s 22nd March 2015 in USA and 23rd March 2015 in India and the server’s digital certificate is only valid from 23rd March 2015 to 23rd March 2017. Your machine will reject this certificate and so you can’t access the website.
Now this confusion occurs because of different time zones at different places and can been easily avoided with a NTP server. In this post, we will look at what is NTP server, how it works and why is it useful?
What is NTP server?
An NTP or Network Time Protocol server is used to synchronize time between various network infrastructure devices. The client/device synchronizes its time with the server and hence all the clients/devices and server have the same time. Synchronizing time might between devices might look like a trivial and useless task, but it in the world of networking NTP plays a very important role.
How NTP works:
NTP protocol runs on UDP port 123. The working of NTP server is simple and easy to understand.
- A client/device asks the NTP server for time.
- NTP server responds with its current time.
- The client/device updates its time accordingly.
We can either manually synchronize the time by writing a command on the client or we can run a script and add it to cron-job so it periodically keeps the time updated with the NTP server.
NTP protocol uses the Coordinated Universal Time, which is also known as UTC to set its time.
In case of client on some different network, it checks the certificate of the server after synchronizing time with its NTP server and then verifies if the certificate is real or fraud.
Uses of NTP server:
You can keep your own local time in your server but as soon as you connect to internet, you can see the complications of having different time from the rest of the world. You might get an email from a future date, or you can get a reply from a future time stamp which can cause a lot of confusion.
NTP server is used for many purposes like checking digital certificate, for time based ACLs or for logging messages. If a client machine tries to connect to banking server and both the server and client are in different time zones, there’s a high chance that the client machine might reject the server’s digital certificate. This will prevent client accessing the bank’s website.
ACLs or Access control lists turn off some ports based on certain time of the day. If there is a time difference between client and server, it can lead to malfunctioning of the services at the client side, since the port server wants to communicate with will be off at that time.
Logs are the best way to troubleshoot any problems you’re facing. If the client and server have different time and server tries to use logs of a certain service on the client, the server will not understand anything since the timestamps will be totally different from the current time on server.
Features of NTP:
- NTP uses a reference clock to set its time. All the devices and clients are synchronized to that time.
- NTP uses UTC to set its time.
- NTP is highly scalable. Multiple clocks can exist in the network.
- It has high fault tolerance and will select any time best suitable for the device/client.
- If the network is down, NTP can use past measurements to estimate current time and error.
- It also maintains accuracy of local time.
If you want to know more about NTP, follow this link -> http://www.ntp.org/ntpfaq