NTP Request Packet

Sharpless512 picture Sharpless512 · Jan 5, 2013 · Viewed 26.9k times · Source

I'm trying to figure out what I need to send (client) in the NTP request package to retrieve a NTP package from the server. I'm working with the LWIP on Cortex M3, Stellaris LM3S6965

I understand that I will recieve a UDP header and then the NTP protocol with the different timestamps the remove the latency. I probable need to make an UDP header but what do I need to add as data?

wireshark image: enter image description here

I hope you guys can help me.

Answer

Tomuo picture Tomuo · May 23, 2014

The client request packet is the same as the server reply packet - just set the MODE bits in the first word to 3 (Client) to be sure.

Send the whole 48 byte packet to the server, it will reply with the same.

The simplest packet would be 0x1B followed by 47 zeroes. (Version = 3, mode = 3)