Internet Protocol¶
Payload of an Ethernet packet carries the message from the sender towards the
intended receiver. This message is processed per indicated protocol in the Ethertype
field of the packet. If the encapsulated message is of Internet Protocol (IP)
type (IPv4), the Ethertype is equal to 0x0800
and the encapsulated packet is an IP
packet in the Ethernet payload field.
Analogy: Encapsulation vs Mailing Envelope or Box
Networking protocols are languages used for communication between computing devices. In order to effectively carry the messages of different protocols in the unit of transmission, namely the packet, an encapsulation scheme is used:
An Ethernet packet encapsulates an IP packet.
An IP packet may encapsulate a Transmission Control Protocol (TCP) packet.
Each outer packet header has a field to indicate which protocol
it is encapsulating inside the
payload
section. This is similar to a mailing envelope: the envelope has
the To
and From
addresses along with its own shape and form, e.g., an
envelope, a box, a pouch, to indicate what type of mail it is carrying. The
source (from
address) and destination (to
address) along with the type
of payload being carried are the main components of most networking protocol
packet headers. In the same manner, Ethernet protocol headers have a field
called Ethertype to indicate the protocol being carried in the payload.
At layer 2, the address for source and destination for the packet are MAC addresses. Next field, Ethertype, indicates one of the type field values for various other media and network protocols as listed below:
VLAN (virtual LAN) tagged
IPv4 (and IPv6)
ARP (Address Resolution Protocol)
STP (Spanning Tree Protocol)
In general, packet of the higher layer protocol being carried is the payload for the lower layer protocol payload. Here is the IP packet header fields of interest:
IP protocol packet has a header with fields:
Source and destination IP addresses to be covered in IP subnet address ranges
Time to live (TTL) field that counts down the layer 3 network devices traversed as packet continues on its path towards the destination
The type of higher layer protocol packet this layer 3 packet carries which may be one of the following:
TCP (Transport Control Protocol)
UDP (User Datagram Protocol)
ICMP (Internet Control Messaging Protocol)
Other fields in the header that are specific to the Internet Protocol operation
Similar to the way Ethernet packet encapsulating an IP packet in its payload, the layer 3 IP packet may encapsulate a layer 4 packet in its payload:
Protocol, Type, and Addressing¶
Every protocol has an addressing scheme.
Ethernet end hosts and packets:
Host interface Ethernet MAC addresses
Type of Ethernet packet ( = what protocol an Ethernet frame is carrying in the packet payload)
IP end hosts and packets:
Host interface IP addresses
Protocol field in an IP packet indicating the layer 4 protocol packet being carried in the payload
This pattern follows on at higher layer protocol packets as well. During communications between computing systems, source and destination address, and the type of data being carried along with the data itself are key elements of each packet.
Tip
Implementation Insight
Why is there an IP packet encapsulated inside an Ethernet packet? Can we send just an Ethernet packet with a message in the payload?
The answer to the second question is yes. We can directly put the message within the payload portion of the Ethernet packet and send. As long as there is a corresponding listening device on the other end of the communication that is expecting a message within the payload of the Ethernet packet, these computing systems will be able to communicate.
Most networked systems are not built to only operate at layer 2. IP provides the networks to be connected to other networks. An IP address as covered in IP subnet address ranges provides both an identity and a constrain to connectivity to the device interfaces. When compared with a MAC address where the MAC address only uniquely identifies an end device in a network, IP addresses have more functionality. They also provide the means for the packets to be routed between networks.
Internet Protocol and layer 3 in general provide the network paths and the means of forwarding packets among the networks. Namely, as long as a packet is destined to an end device whose interface is within the Ethernet network that the sender belongs to, Ethernet network devices, bridges, will be able to forward this packet to its receiver. As soon as any of the devices try to reach a device out of the Ethernet network they are in, a layer 3 device, router, conducts the routing to forward the packet to its destination network.