Introduction

This chapter discusses the details involved in using the Ethernet and Wi-Fi link layers, how the Point-to-Point Protocol (PPP) is used, and how link-layer protocols can be carried inside other (link- or higher-layer) protocols, a technique known as tunneling.

When referring to link-layer protocol data units (PDUs), we usually use the term frame, so as to distinguish the PDU format from those at higher layers such as packets or segments, terms used to describe network- and transport-layer PDUs, respectively.

Frame formats usually support a variable-length frame size, the upper bound of which is called the maximum transmission unit (MTU). Some network technologies, such as modems and serial lines, do not impose their own maximum frame size, so they can be configured by the user.

Ethernet and the IEEE 802 LAN/MAN Standards

[p80]

The IEEE 802 LAN/MAN Standards

[p82]

The Ethernet Frame Format

The figure below shows the current layout of an Ethernet frame and how it relates to a relatively new term introduced by IEEE, the IEEE packet.

The Ethernet (IEEE 802.3) frame format contains source and destination addresses, an overloaded Length/Type field, a field for data, and a frame check sequence (a CRC32). Additions to the basic frame format provide for a tag containing a VLAN ID and priority information (802.1p/q) and more recently for an extensible number of tags. The preamble and SFD are used for synchronizing receivers. When half-duplex operation is used with Ethernet running at 100Mb/s or more, additional bits may be appended to short frames as a carrier extension to ensure that the collision detection circuitry operates properly.

Full Duplex, Power Save, Autonegotiation, and 802.1X Flow Control

Bridges and Switches

Wireless LANs—IEEE 802.11(Wi-Fi)

Point-to-Point Protocol (PPP)

Loopback

In many cases clients want to communicate with servers on the same computer using Internet protocols such as TCP/IP. To enable this, most implementations support a network-layer loopback capability that typically takes the form of a virtual loopback network interface. It acts like a real network interface but is really a special piece of software provided by the operating system to enable TCP/IP and other communications on the same host computer.

IPv4 addresses starting with 127 are reserved for this, as is the IPv6 address ::1 (Chapter 2). Traditionally, UNIX-like systems including Linux assign the IPv4 address of 127.0.0.1 (::1 for IPv6) to the loopback interface and assign it the name localhost.

An IP datagram sent to the loopback interface must not appear on any network. Although we could imagine the transport layer detecting that the other end is a loopback address and shortcircuiting some of the transport-layer logic and all of the network-layer logic, most implementations perform complete processing of the data in the transport layer and network layer and loop the IP datagram back up in the network stack only when the datagram leaves the bottom of the network layer. This can be useful for performance measurement, for example, because the amount of time required to execute the stack software can be measured without any hardware overheads. In Linux, the loopback interface is called lo.

Linux% ifconfig lo
lo Link encap:Local Loopback
 inet addr:127.0.0.1 Mask:255.0.0.0
 inet6 addr: ::1/128 Scope:Host
 UP LOOPBACK RUNNING MTU:16436 Metric:1
 RX packets:458511 errors:0 dropped:0 overruns:0 frame:0
 TX packets:458511 errors:0 dropped:0 overruns:0 carrier:0
 collisions:0 txqueuelen:0
 RX bytes:266049199 (253.7 MiB)
 TX bytes:266049199 (253.7 MiB)

This local loopback interface:

We would not expect to see errors on the local loopback device, given that it never really sends packets on any network

MTU and Path MTU

From Figure 3-3, there is a limit on the frame's size available for carrying the PDUs of higher-layer protocols in link-layer networks. This usually limits the number of payload bytes to about 1500 for Ethernet and often the same amount for PPP in order to maintain compatibility with Ethernet.

This characteristic (the limit of frame's size to carry higher-layer PDUs) of the link layer is called the maximum transmission unit (MTU). Most packet networks (like Ethernet) have a fixed upper limit:

MTU on networks:

The path MTU between any two hosts need not be constant over time:

Path MTU discovery (PMTUD) is used to determine the path MTU at a point in time (and is required of IPv6 implementations).

Doubts and Solutions

Verbatim

p146 on loopback

An IP datagram sent to the loopback interface must not appear on any network. Although we could imagine the transport layer detecting that the other end is a loopback address and shortcircuiting some of the transport-layer logic and all of the network-layer logic, most implementations perform complete processing of the data in the transport layer and network layer and loop the IP datagram back up in the network stack only when the datagram leaves the bottom of the network layer.