Skip to content

Instantly share code, notes, and snippets.

@danish-rehman
Last active August 29, 2015 14:13
Show Gist options
  • Save danish-rehman/19c5db1cce4c8f66b7b6 to your computer and use it in GitHub Desktop.
Save danish-rehman/19c5db1cce4c8f66b7b6 to your computer and use it in GitHub Desktop.
NTP Commands
# Install NTP from ubuntu repository
>> sudo apt-get install ntp
# View all the NTP master and their offset recieved
>> ./ntpd -p
# Exactly like the above command but with no ip address rather then name
>> ./ntpd -n
# Query a NTP master server
# This makes 4 request to the server before
# calculating and updating the system clock.
>> ./ntpdate -q boss.isi.deterlab.net
server 192.168.252.1, stratum 2, offset 0.000148, delay 0.02594
8 Nov 11:15:49 ntpdate[30431]: adjust time serve
>> sudo tcpdump -i eth0 port 123
11:15:43.555820 IP pc52.isi.deterlab.net.37713 > boss.isi.deterlab.net.ntp: NTPv4, Client, length 48
11:15:43.556260 IP boss.isi.deterlab.net.ntp > pc52.isi.deterlab.net.37713: NTPv4, Server, length 48
11:15:45.555797 IP pc52.isi.deterlab.net.37713 > boss.isi.deterlab.net.ntp: NTPv4, Client, length 48
11:15:45.556166 IP boss.isi.deterlab.net.ntp > pc52.isi.deterlab.net.37713: NTPv4, Server, length 48
11:15:47.555793 IP pc52.isi.deterlab.net.37713 > boss.isi.deterlab.net.ntp: NTPv4, Client, length 48
11:15:47.556152 IP boss.isi.deterlab.net.ntp > pc52.isi.deterlab.net.37713: NTPv4, Server, length 48
11:15:49.555797 IP pc52.isi.deterlab.net.37713 > boss.isi.deterlab.net.ntp: NTPv4, Client, length 48
11:15:49.556205 IP boss.isi.deterlab.net.ntp > pc52.isi.deterlab.net.37713: NTPv4, Server, length 48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment