View on GitHub


Harsh Kapadia's talks and interviews.

‘MAC and IP Routing’ Talk Content

Table of Contents


It is not intuitive to understand why MAC addresses are required for routing when IP addresses exist and how both MAC addresses and IP addresses work together to get packets/frames to their final destinations. This piece attempts to demystify this.

Slide deck

OSI Layers

OSI Layers vs TCP/IP Layers

Internet Topology

Internet Topology
Image credits

IP Addresses vs MAC Addresses

IP Routing

MAC Address Requirement

If IP addresses can help identify and route to a host on the internet, then why are MAC addresses required?

Can’t solely IP addresses be used to do routing?

Yes, just IP addresses can be used for routing without needing MAC addresses, but unfortunately the way things work today and how a lot of hardware (like NICs) is made, they only understand a certain way of doing things, which is to use MAC addresses. IP addresses are encapsulated as the payload of Ethernet frames. If hardware, protocols, servers and the entire internet can be changed to just use IP addresses for routing, it will work, but well changing the entire internet is no mean feat, to put it mildly.

MAC Routing

Why can’t we have constant/hard coded MAC addresses?

NOTE: Remember that MAC addresses are manufacturer dependent and so are baked into a device.

We could hard code MAC addresses and do away with ARP, but devices keep joining and leaving networks, leading to too many configuration overheads if MAC addresses were hard coded. Automatic initial MAC address discovery would be difficult without ARP as well and would have to be done manually for a device to be able to join the network.

Also, the same IP address can have differences devices using it at various times.

For example, a router will usually be available at the IP address on a local network and it will have its own MAC address. If that router breaks down and needs to be replaced, the new router will be configured at the same IP address, but it will have a different MAC address. Hard coding the MAC address would lead to users having to manually re-configure it, which is not that great and adds complexity for non-technical users.

Hard coding MAC addresses thus adds manual configuration complexities and with the frequency at which devices join and leave networks, it probably isn’t a good idea to hard code MAC addresses. So ARP is a good idea.

A parallel can be drawn from IP addresses, domain names and DNS, because domain names are not only easy to remember, but if IP addresses for a domain change, users don’t have to care about it as they just use the domain name and rely on DNS to translate it to an IP address. Thus, it makes sense to have domain names rather than just using IP addresses.

Simplified Typical Frame Structure

Simplified Typical Frame Structure

Routing Example

Understanding how MAC and IP routing work together with an example, with the goal of routing packets from node-a to node-c.

Network Topology

Demo network topology

The image above shows a network topology with three nodes/clients (node-a, node-b and node-c), three routers (router-1, router-2 and router-3) and four subnets (net-1, net-2, net-3 and net-4).

IP Configuration

At node-a

Demo frame

Demo frame

At router-1

Demo frame

Demo frame

Demo frame

At router-3

Demo frame

Demo frame

Demo frame

At node-c

Demo frame

Response from node-c to node-a

Demo frame


Please follow the instructions in the repository below.


Distributing IP Routing Information

Internet Topology
Image credits