UnixDroid

Lesson 4 of 5 · 6 min

MAC addresses and ARP

How devices on the same network actually find each other, and why that makes ARP spoofing possible.

An IP address gets data to the right network. But on your local network, switches and Wi-Fi deliver frames using a different address: the MAC address, burned into every network card.

A MAC address looks like 3c:22:fb:9a:41:0e. The first half identifies the manufacturer, which is why tools like Nmap can sometimes tell you a device is made by Apple or Samsung.

How ARP connects the two

How ARP finds the MAC address for an IP address on a local network
How ARP finds the MAC address for an IP address on a local network

When your laptop wants to send data to the router at 192.168.1.1, it needs the router's MAC address. So it shouts to the whole network, "who has 192.168.1.1?", and the router replies with its MAC. Your laptop saves the answer in its ARP table so it doesn't have to ask every time.

See your own ARP table:

ip neigh      # Linux
arp -a        # Windows

Why ARP is a security problem

ARP was designed decades ago, when everyone on a network was trusted. It has no authentication. Any device can send a reply saying "I'm 192.168.1.1", even if nobody asked.

That's ARP spoofing. An attacker on the same Wi-Fi tells your laptop "I'm the router" and tells the router "I'm the laptop". Now all your traffic flows through the attacker. This is a classic man-in-the-middle attack, and tools like Ettercap and Bettercap can do it in a lab.

How networks defend against it

  • Dynamic ARP Inspection on managed switches checks ARP replies against known addresses.
  • HTTPS everywhere means that even if traffic is intercepted, the attacker can't read or change it easily.
  • Watching for changes: if the router's MAC in your ARP table suddenly changes, something is wrong. Tools like arpwatch alert on this.

This is also why public Wi-Fi is risky: you share the network, and the ARP trust, with strangers.

Try it yourself
  1. Run ip neigh or arp -a and find your router's IP and MAC address.
  2. Look up the first half of that MAC on any "MAC vendor lookup" website to see who made the router.
  3. In your lab, run ip neigh on Kali after pinging Metasploitable. Is Metasploitable's MAC now in the table?
No Linux machine? Practise in the free online terminal

Quick check

Which protocol maps an IP address to a MAC address on a local network?

Need a hint?

Three letters, and the lesson title.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →