Part 6 — MAC, IP and ARP
Welcome back. Last issue we looked at MAC addresses. There I made this promise. It’s been hinted at and teased several times. But we’re finally here. The relationship between MAC and IP as well as the protocol that bridges them, ARP. The last theory issue before we can once again head into Packet Tracer. It’s been a ride, so let’s keep up the momentum and finish this final marker.
Do you like MECHs?
Little me used to LOVE them. Now why did I ask about MECHs all of a sudden? Well, would you believe me if I told you that MAC and IP work somewhat similarly to MECHs and Pilots when they’re together? Nope. But you will at the end of the issue. But in order to get there, we’ll first cover some background. The PDU and Encapsulation.
The PDU
- Let’s look back at the order of OSI layers. In that model, MAC falls under layer 2, while IP falls under layer 3, which sits on top of layer 2. You might recall from issue 3 that each layer, the message is called by a different name. This is called the PDU (Protocol Data Unit), and each layer has a different name for the PDU. Here’s all of it in order.
- Layer 1 — Bit
- Layer 2 — Frame
- Layer 3 — Packet
- Layer 4 — Segment
- Layer 5 — Data
- Layer 6 — Data
- Layer 7 — Data
- Layer 5–7 all call the PDU
Data, but every other layer has its own unique name.
Encapsulation
- Encapsulation is the process of sealing up something with a cover. Think of a medicine capsule. At first, you have a medicine powder. Then, you package it up with a digestible cover, and now you have a medicine capsule. It’s still the same medicine, but how it looks changed. And so did the name. We now call it a medicine capsule.
- The same thing happens down the OSI layers.
1) Data > Segment
- First, from layer 7–5, we have Data.
- At the transport layer, we add TCP/UDP headers that contain the sender and receivers’ TCP/UDP port numbers. We
encapsulatedata with them. Now, the combination ofData+TCP/UDP headersis called aSegment
2) Segment > Packet
- Once the Network Layer receives the Segment, it also adds its own signature to it. It’s like saying
IP has been here. - Network layer takes the segment and adds an IP header containing the sender and receiver IP addresses. Then, it brands the combination of
IP header + TCP/UDP headers + Dataas apacket.
3) Packet > Frame
- Now, Data Link is a bit of a gremlin. Up until now, each layer marked its territory using just one header.
- However, Data Link wants to one-up everyone else. This is the one layer that adds both a
header and trailerto the PDU. - The
headercontains theMAC addressof thesender and reciever. Thetrailercontains theFCS(Frame Check Sequence). - The
FCSfield is used to prove data integrity.
4) Physical layer Bits
- The physical layer doesn’t add a header nor a trailer. It just translates the frames into physical signals such as electronic(ex: Copper media) or Light (ex: Optical Fiber)
- As we just learned, when the segment reaches the Network Layer, it adds the IP header. The IP header contains the sender and receiver IP addresses.
- The sender IP address tells us who sent the packet, while the receiver IP address tells us where to send the packet. Now let’s see how a packet travels from sender to receiver.
Segment’s Journey
- Meet our hero for this segment… Segment (Pun intended). Segment is minding his business, safe in his little home inside castle PC 1. But unfortunately for Segment, he’s in for a rude awakening.
1) The Call to Action
- The kingdom of PC 1 is under attack. The king decides to call the kingdom’s ally nation PC 2 for help.
- But taking this message to PC 2 is not easy. It’s an arduous journey comprising
multiple check points, and the only way to do so is to pilot the kingdoms' priced MECH. - And unfortunately for Segment, he just so happens to be the only one who can.
Get Kaveeshgoonasekara’s stories in your inbox
Join Medium for free to get updates from this writer.
2) I dub thee Sir Packet
- The king recognized how dangerous Segment’s journey is. And as a way to honor his undertaking, he decided to promote Segment to Packethood, under the name Sir Packet of PC 1’s IP to PC 2 IP. Long name… But Packet doesn’t mind. He’s ready for his journey.
3) Mobile Suit . . . FRAME!
- Sir Packet of PC 1’s IP to PC 2 IP… Yeah no, that’s a mouthful. Let’s just call him Sir Packet for our sanity(but his name is still
Sir Packet of PC 1's IP to PC 2 IP). - Anyway, Sir Packet finally reaches the deepest cave beneath Castle PC 1 and comes face to face with MAC; the kingdoms’ priced MECH suit.
- Sir Packet took a deep breath and finally climbed into MAC’s cockpit. The controls were… Kinda easy? Chosen one plot armor, right?
4) Hello, I’m ARP!
- Sir Packet almost had a panic attack. What was that!? Oh… It’s just the friendly neighborhood AI that’s been lying dormant in the MECH, ARP.
- And just like any helpful AI, ARP decided it knows everything and broadcasts ARP requests to every house in Kingdom PC 1. ARP’s way of trying to help Sir Packet locate
PC 2 IP. - But alas, PC 2 IP is not part of Kingdom PC 1, so just tells Sir Packet to find border patrol Captain R1.
- Sir Packet facepalms, decides the AI is more trouble than help and shuts it down because it’s being too helpful. Typical chatbot. At least he thought he did. Unfortunately for him, ARP isn’t going to stay silent forever…
5) Resourceful Captain, R1
- With ARP’s intel, Sir Packet fills out the empty destination MAC address in FRAME’s control panel as captain R1’s address and the source as castle PC 1. FRAME finally starts moving and runs towards R1.
- Once there, Sir Packet gets an earful from R1 for when ARP decided to do its thing earlier. But he calms down rather quickly when he realizes Packet’s task.
- R1 looks at Sir Packet’s last name
PC 2 IP. He recognizes that it's not his, nor one that belongs inside the PC 1 kingdom. - So, R1 looks at his trusty log book
Routing Tableto find if he has adirect connectionwith kingdom PC 2. Nope. But not to worry. R1 is resourceful. You don't get to become Captain of border Patrol otherwise. In his Routing Table, he sees a path to kingdom PC 2 through the neighboring border Patrol Captain R2, someone R1 has a good direct connection with. - ARP wakes up again, bamboozles both Sir Packet and R1 and finds out R2’s MAC address using R1’s direct connection. They both decide to let it slide and Sir Packet updates FRAME’s destination MAC address as R2’s and since they’re now starting from R1, changes the source to R1’s MAC. Same Sir Packet, different start and end MAC addresses.
6) The Next Hop to R2
- FRAME gathers up its energy and Hops from R1 to R2 through the direct connection.
- R2 stops FRAME before it can go any further, opens it up and looks inside to find Sir Packet of PC 1’s IP to PC 2 IP. Long name… But that’s okay. He’s kinda chill about it.
- He then looks at
PC 2 IP. Not his own either. But… It's part of kingdom PC 2, which R2 is directly connected to. - ARP fires off again, and Sir Packet just gives up trying to hold it down. R2 doesn’t seem to mind either. ARP comes back with a match-made-in Kingdom PC 2.
PC 2 IPmatched with castle PC 2, and ARP came back with castle PC 2's MAC address.
7) Destination PC 2
- Sir Packet changes the source and destination MACs for FRAME again, bids R2 farewell and starts the MECH towards castle PC 2.
- The guards at Castle PC 2 open up FRAME and the ally king looks at Sir Packet, realizes that he’s the intended recipient and welcomes Sir Packet inside.
- At castle PC 2, the ally king receives PC 1’s message. Since Sir Packet of PC 1’s IP to PC 2 IP is already exhausted, the king treats him to a well-deserved rest in castle PC2.
8) Full Circle
- At the same time, the king sends his own trusty Packet, Sir Packet of PC 2’s IP to PC 1 IP, piloting one of kingdom PC 2’s own FRAMES.
- Sir Packet of PC 2’s IP to PC 1 IP takes the exact path that Sir Packet of PC 1’s IP to PC 2 IP in reverse and reaches kingdom PC 1 with the confirmation of AID from the ally kingdom.
Back to reality: What we covered
- That’s enough Sci-Fi for one issue. Okay. What did we cover? We just looked at how data travels from one device to another over a network. Yes, that’s a bunch of heavy theory right there. But it wasn’t boring, now, was it?
- We looked at what a PDU is, how it changes, encapsulation, decapsulation, ARP and also routing all in one issue.
- We even looked at a bit that confused me as well when I was learning these at first. That
Source and Destination MAC changes each hop, but IP stays the same. - I can’t believe we did all that either, but here we are.
And That’s it
With that, we come to the end of the issue. Now, do you believe that MAC and IP work somewhat similarly to MECHs and Pilots when they're together? You'd better, cuz otherwise I gave myself a headache trying to weave that story for nothing. Anyway, that's a wrap. Hope you had fun reading this issue. And just as promised, we'll finally go back to Packet Tracer in the next issue. See you there. Until then, take care.







