We know every ethernet frame has a source and destination MAC address, but most of us probably don’t think about the third field in the header, the ethertype. In frame or packet headers every field (usually) has a reason for being, the ethertype’s purpose is a surprisingly important one.
As the Layer-2 portion of the router processes the frame it has to figure out what to do with it at Layer-3. Most networks only run a single Layer-3 protocol (IPv4) but what about when we have a dual-stack environment with IPv4 and IPv6 or if the router is also running MPLS for label switching? How does the router know how to do the correct Layer-3 processing?
This is the role of the Ethertype. The Ethertype values are defined by the IEEE and are well known, almost like a port number for Layer-2. The different Ethertype values tell the Layer-2 software which Layer-3 component is responsible for processing Layer-3 information.
A router could be running IPv4, IPv6 and MPLS all at the same time. The source and destination MAC address could be the same. It’s up to the Ethertype value to help the router determine if an IPv4 routing lookup, IPv6 routing lookup or MPLS label lookup needs to be done.
Ethertypes help clearly show how Layer-2 interacts with Layer-3 in the OSI model. As you look up the stack, this idea continues. At Layer-3, within IPv4 there is a protocol field to determine if it is TCP, UDP, ICMP or something else. At Layer-4, within TCP and UDP, as I mentioned, we have the port to determine which application should handle the packet. Even ICMP has a type field to determine how to properly handle the ICMP message.
Why Do I Care?
Reading this feels like another academic exercise, like subnetting by hand, where’s the actual value in knowing this kind of information? Concepts like Ethertype are so fundamental to networking that they appear over and over again. Once you understand the problem it solves you can start making very accurate educated guesses as to how problems are solved. If a new Layer-2 protocol is created you know there has to be a way for it to pass information to the upper layer. It can make it easier to fit the puzzle pieces together faster the next time you learn a new technology. Some of the best engineers I’ve ever worked with excel because of their ability to identify these kinds of patterns and quickly apply the concepts to the new technologies in front of them.