Packet sizes, MTU, and MSS
To transfer data between different systems, packets are used. The maximum packet size that can be transmitted through a network (Maximum Transmission Unit — MTU) is dependent on the underlying network capabilities.
When a packet passes through a Hetzner private network, we add additional headers that allow us to distinguish the networks.
This results in the following size limits for packets that pass through our private networks:
header
header
If a packet is routed through several different interfaces and the packet MTU is less than or equal to the limit, it will pass through. If the packet MTU is greater than the limit, the system will attempt IP fragmentation. If unsuccessful, the packet is dropped.
The default packet configuration for the public interface, the Docker bridge interface, and other interfaces, usually looks like this:
Note the difference in the values for MSS and MTU compared to the values in a private network.
Path MTU Discovery (PMTUD)
Path MTU Discovery is a system mechanism that helps determine the maximum packet size that can travel to a specific destination without fragmentation.
If a packet gets dropped because it is too big and an ICMP error message with the correct MTU is returned, PMTUD learns that MTU for this destination and uses it for future packets. If the next packet is still too big because of another intermediary with an even smaller MTU further down the path, it will be dropped again, triggering another ICMP message. PMTUD will continue this process until it finds the smallest MTU required for the entire path between the source and the destination.
If the system doesn't receive an ICMP message or the message doesn't contain the MTU, PMTUD fails and large packets will continue to get dropped. This can happen, for example, when the local system or a router on the packet's path drops ICMP packets.
MSS Clamping
To initialize the TCP connection, the client (source) sends a TCP SYN packet, which includes its local MSS value, to the server (destination). The server now knows both its own local MSS value and the MSS provided in the TCP SYN packet of the client. For all response packets, the server will use the lower MSS value of the two, and also send back its own local MSS value to the client.
- By default, the TCP SYN packet uses a MSS value that corresponds to the MTU of the interface that the source uses to send the packet.
- When you enable MSS Clamping, you can define a custom MSS value that should be used instead of the default.
OSI model
Simplified explanation:
Information that is transmitted through a network is called a "protocol data unit" (PDU).
PDU | Send | Receive | |
---|---|---|---|
Layer 7 | The actual application message (HTTP request or other). You likely see a readable ASCII message. The system sees and passes on raw bits (see "Bytes to ASCII Converter"). | ||
Layer 4 | Segment | The data of layer 7 is split into several chunks (user data / payload). A TCP header (includes the source and destination port) is added to each chunk. | The TCP header is stripped off each segment. The remaining user data / payloads (chunks) are reassembled. |
Layer 3 | Packet | Adds an IP header (includes source and destination IP) to each segment. Determines the best route to forward the packet. | Checks if the destination IP matches its own. If yes, removes the IP header and passes the packet to Layer 4. If no, forwards the packet to the next hop/router. |
Layer 2 | Frame | Adds headers (include source and destination MAC) and a trailer (FCS) to each packet. | Validates the frame using frame check sequence (FCS) and checks the MAC address. If valid, removes the headers and trailer and passes the packet to layer 3. |
Layer 1 | Bit | Transmits the frame as a raw bitstream (1s and 0s) over a physical medium (e.g. via electrical, optical, or radio signals). This layer does not interpret the meaning of the bits, it just moves them from one place to another using signals. | Receives frames as raw bitstreams (1s and 0s) over a physical medium. Passes the bitstream to layer 2. |
Simplified visualization
01000111 01000101 01010100 00100000 0010111...
01000111 01000101
01010100 00100...