Engineering

Network Packet

Network Packet

A network packet is a formatted unit of data carried by a packet-switched network. Computer communications links that do not support packets, such as traditional point-to-point telecommunications links, simply transmit data as a bitstream. When data is formatted into packets, the bandwidth of the communication medium can be better shared among users than if the network were circuit-switched.

A packet consists of two kinds of data: control information and user data (also known as payload). The control information provides data the network needs to deliver the user data, for example, source and destination network addresses, error detection codes, and sequencing information. Typically, control information is found in packet headers and trailers, with payload data in between.

Terminology

In the seven-layer OSI model of computer networking, packet strictly refers to a data unit at layer 3, the Network Layer. The correct term for a data unit at layer 2, the Data Link Layer, is a frame, and at Layer 4, the Transport Layer, the correct term is a segment or datagram. For the case of TCP/IP communication over Ethernet, a TCP segment is carried in one or more IP packets, which are each carried in one or more Ethernet frames.

Packet framing

Different communications protocols use different conventions for distinguishing between the elements and for formatting the data. For example in Point-to-Point Protocol, the packet is formatted in 8-bit bytes, and special characters are used to delimit the different elements. Other protocols like Ethernet, establish the start of the header and data elements by their location relative to the start of the packet. Some protocols format the information at a bit level instead of a byte level.

A good analogy is to consider a packet to be like a letter: the header is like the envelope, and the data area is whatever the person puts inside the envelope.

A network design can achieve two major results by using packets: error detection and multiple hosts addressing. A packet has the following components.

Network address

Modern networks usually connect three or more host computers together; in such cases, the packet header generally contains addressing information so that the packet is received by the correct host computer. Typically, two addresses are included, the destination address, which is where the packet is intended to go, and the transmitter’s address which is necessary if there is to be a reply sent. In addition, other fields may be present, to identify the particular applications that are running on the network host that is sending and waiting for packets.

Error detection and correction

Main article: Error detection and correction

Network packets often contain a checksum, parity bits, or cyclic redundancy checks to check for errors that occur during transmission.

At the transmitter, the calculation is performed before the packet is sent. When received at the destination, the checksum is recalculated, and compared with the one in the packet. If discrepancies are found, the packet may be corrected or discarded. Any packet loss is dealt with by the network protocol.

In some cases, routine modifications of the network packet can occur while routing. In that case, recalculation may be required.

Hop counts

Under fault conditions, packets can end up traversing a closed circuit. If nothing was done, eventually the number of packets circulating would build up until the network was congested to the point of failure. A time to live is a field that is decreased by one each time a packet goes through a network node. If the field reaches zero, routing has failed, and the packet is discarded.

Ethernet packets have no time-to-live field and are subject to broadcast radiation in the presence of a switch loop.

Packet length

There may be a field to identify the overall packet length. In some protocols, the length is implied by the duration of the transmission.

Class/priority

Some networks implement quality of service which can prioritize some types of packets above others. This field indicates which packet queue should be used; a high priority queue is emptied more quickly than lower priority queues at points in the network where congestion is occurring.

Payload

In general, the payload is the data that is carried on behalf of an application. It is usually of variable length, up to a maximum that is set by the network protocol and sometimes the equipment on the route. Some networks can break a larger packet into smaller packets when necessary.