Networking

Describe, using appropriate network protocols like TCP/IP, the typical contents of a packet

What a packet contains

Packets contain, in order from the first bit to the last bit:

Packet size

Packets are kept small so that individual packets don’t take too long to transfer, preventing other packets from moving. However, they shouldn’t be too small because otherwise, the combined sizes of the headers and trailers would make the transmission too inefficient.

Between 500 and 1,500 bytes is an ideal compromise.

Packet header

The packet header contains the destination IP address as well as the source address (so that replies can be sent).

The packet number is contained so the packets can be reassembled in order at the destination.

The total number of packets is contained so the destination knows everything has been received.

The Time To Live (TTL) or hop limit is also included. If a packet hops this many times, then it is discarded and thus fails to send.

Packet trailer

Contains error-checking components to verify the payload has not been corrupted during transmission.

These may include checksums, cyclical redundancy checks (CRCs) and parity bits which are used by receiving hosts to check for errors.

Checksums are calculated from the original data at the source. It is recalculated at the destination with the data; if the checksums don’t match, it means the data has been corrupted.

Gateways

Gateways are often combined with routers into one integrated device. They allow networks to communicate with one another even if they are using different protocols. They do this by stripping header data and a transmitting packet and reapplying it using the correct format for the destination network.