Loading...
Linux Interview Questions

NTP (Network Time Protocol)

1. What is NTP?
A) NTP (Network Time Protocol) is a protocol used to synchronize the system clocks of computers over a network.
It ensures accurate timekeeping across devices by synchronizing them with a reference clock, such as an atomic clock or GPS.

2. On which port does NTP run?
A) NTP runs on UDP port 123.

3. What are the main use cases of NTP?
A)

  • Ensuring consistent timestamps in logs across servers.
  • Synchronizing time for security protocols (e.g., Kerberos, certificates).
  • Accurate transaction processing in databases.
  • Maintaining time in distributed systems and IoT devices.

4. How does NTP synchronize time?
A) NTP works by exchanging time-stamped packets between a client and a server. It calculates offset and delay using fourtimestamps (T1–T4) and adjusts the client’s clock gradually to match the server.

5. What is the difference between ntpd and chronyd?
A)

  • ntpd: Traditional NTP daemon, used for long-term synchronization.
  • chronyd: Faster, works better on systems with intermittent network connectivity (e.g., laptops, VMs).

6. How do you check NTP synchronization in Linux?
A)

  •  ntpq -p (for ntpd)
  • chronyc sources (for chronyd)
  • timedatectl status (systemd based systems)

7. What happens if a system clock is too far off from the NTP server?
A) If the time difference is too large (e.g., minutes/hours), NTP won’t gradually adjust it. Instead, administrators must use commands like ntpd -gq or chronyd -q to force a one-time correction.

8. What is the difference between symmetric and client-server NTP modes?
A) Client-server mode: Client synchronizes with the server’s time.
Symmetric mode: Used between servers for redundancy and reliability.

9. What is the purpose of NTP authentication?
A) NTP authentication (using MD5 or SHA keys) ensures that time updates come from a trusted server and prevents spoofing or malicious manipulation of time.

10. How do you configure an NTP client in Linux?
A)  Edit /etc/ntp.conf (for ntpd)  or  /etc/chrony.conf (for chronyd).

Add server entries like:

server 0.pool.ntp.org iburst
server 1.pool.ntp.org iburst

Restart the NTP/chronyd service.

11. What is the “iburst” option in NTP configuration?
A) The iburst option makes the client send multiple requests at startup for faster synchronization instead of waiting for the default polling interval.

12. What are the common NTP status codes in ntpq -p output?

A)

  •  * – Current synchronization source.
  • + – Candidate servers.
  • – – Outlier (not considered).
  • x – False ticker.
  • # – Selected via a clustering algorithm.

13. What is the maximum accuracy NTP can provide?
A) NTP can typically synchronize time within 1–50 milliseconds over the internet, and better than 1 millisecond on a LAN.

14. How do you secure NTP traffic?
A)

  •  Restrict access in /etc/ntp.conf with restrict directives.
  • Enable NTP authentication.
  • Use firewalls to allow only trusted servers on port 123.
  • Prefer chronyd for better security features.
Leave a Reply

Your email address will not be published. Required fields are marked *