IP Addresses & Routing

MAC Addresses vs. IP Addresses

See why every connection uses two kinds of address, what each one is for and how private Wi-Fi addresses change the picture.

Key takeaways

  • MAC addresses work only within one local network segment; IP addresses work across networks.
  • A MAC address is 48 bits long on Ethernet and Wi-Fi and usually written as six pairs of hex digits.
  • IP addresses are assigned according to where you connect, so they change as you move.
  • Modern phones and computers often use randomized MAC addresses on Wi-Fi for privacy.
  • Websites on the internet don't receive your MAC address through normal browsing.

A MAC address identifies a network interface on the local link, such as your laptop's Wi-Fi adapter, and gets a frame to the next device nearby. An IP address identifies where a device sits in a larger network and gets a packet all the way to its destination, across many links.

You need both. As data travels from your laptop to a distant server, the IP addresses stay essentially the same from end to end (translation aside), while the MAC addresses are replaced at every router along the way.

A postal analogy, with its limits

Think of the IP address as the full destination written on a parcel and the MAC address as the name of the next person to hand it to. The destination stays on the label. The next handler changes at each depot.

The analogy stops there. Neither address names a person, and both can be changed in software.

What a MAC address looks like

Parts of a 48-bit MAC address
00:00:5E 1 00:53:2A 2 First 24 bits Often an organization identifier registered with the IEEE. 1 Last 24 bits Chosen by that organization to distinguish its interfaces. 2 00:00:5E 1 00:53:2A 2 First 24 bits Often an organization identifier registered with the IEEE. 1 Last 24 bits Chosen by that organization to distinguish its interfaces. 2

An example value, split into its two halves.

The example uses a range reserved for documentation. You'll see MAC addresses written with colons, with hyphens (common on Windows) or as three dotted groups on some network equipment.

The first part of a globally assigned address usually identifies the manufacturer of the interface, through registrations kept by the IEEE. Some assignments are smaller blocks with longer identifiers. The MAC assignment lookup shows who a block is registered to, which is handy when identifying an unknown device. The registrant may be a component maker, not the brand on the box.

Two bits in the first byte carry special meaning. One marks group (multicast) addresses. The other marks an address as locally administered, meaning it was set by software and not taken from a registered block. The all-ones address ff:ff:ff:ff:ff:ff is broadcast, heard by everything on the segment.

What an IP address adds

An IPv4 address is 32 bits, such as 192.168.1.20. An IPv6 address is 128 bits, such as 2001:db8::20. Unlike a MAC address, it has structure that reflects location: the first part identifies a network, and the rest identifies a host within it. The boundary is given by the prefix length.

That structure is what lets routers work. A router doesn't need to know every device on earth. It only needs to know which direction leads to each block of addresses. MAC addresses have no such grouping by location, since cards from one maker end up all over the world.

MAC and IP side by side
MAC address Used on the local link 48 bits on Ethernet and Wi-Fi Set by the interface maker or randomized by software Replaced at each router hop Read mainly by switches and access points IP address Used across networks 32 bits in IPv4, 128 in IPv6 Assigned by the network you join Kept end to end unless translated Read by routers to choose paths VS MAC address Used on the local link 48 bits on Ethernet and Wi-Fi Set by the interface maker or randomized by software Replaced at each router hop Read mainly by switches and access points IP address Used across networks 32 bits in IPv4, 128 in IPv6 Assigned by the network you join Kept end to end unless translated Read by routers to choose paths

How they work together

Suppose your laptop wants to reach a server on the internet.

  1. It compares the destination IP with its own subnet and sees that the server is elsewhere.
  2. It decides to hand the packet to the default gateway.
  3. It finds the gateway's MAC address. IPv4 uses ARP; IPv6 uses Neighbor Discovery.
  4. It wraps the packet in a frame addressed to the router's MAC. The packet inside is addressed to the server's IP.
  5. The router removes the frame, looks at the IP address, chooses the next link and builds a new frame for it.

Each link may use a different technology, and some don't use MAC addresses at all. The IP packet is what survives the journey.

When the destination is on your own subnet, such as a printer, step 2 is skipped. Your laptop looks up the printer's MAC and sends directly.

Where each one shows up in settings

On Windows:

ipconfig /all
getmac /v

Look for "Physical Address". On Linux:

ip link
ip address

On macOS:

ifconfig en0

The interface name varies. On phones, the Wi-Fi network details screen usually shows both addresses.

A single device has several MAC addresses: one for Wi-Fi, one for Ethernet, one for Bluetooth and often more for virtual adapters. That matters when you set up router rules by hardware address, because plugging in a cable makes the same laptop look like a different device.

Randomized and private addresses

A fixed Wi-Fi address broadcast wherever you go would let anyone listening recognize your device across shops, stations and cafes. For that reason, current phone and computer operating systems can use a private or random MAC address, typically one per network, and some can rotate it over time.

These are locally administered addresses. In practice, the second hex digit of the first byte is 2, 6, A or E.

This improves privacy, with side effects:

  • A router reservation or allow list may stop matching after the address changes.
  • Parental controls tied to a MAC may treat the device as new.
  • A captive portal may ask you to sign in again.
  • Your device list may show unfamiliar manufacturers, or none.

On your own home network you can usually turn the feature off for that one network if you need a stable identity. Leave it on for public networks.

How switches use MAC addresses

A network switch builds a table of which MAC address lives behind which port. It learns by reading the source address of each frame it receives. When a frame arrives for a known destination, the switch sends it only out of that port. When the destination is unknown or is broadcast, it sends the frame out of all ports in that segment.

Entries age out after a few minutes of silence, so a device that moves to another port is relearned quickly. A basic switch needs no configuration and no IP addresses to do its job. Network switches explained covers choosing one.

Wi-Fi access points do something similar, tracking which wireless clients are associated and bridging frames between radio and cable. In a mesh or extender setup, some products substitute their own hardware address for clients behind them, which can make your device list look odd.

Which address to use for which job

Task Use Why
Reserve a fixed address for a printer MAC (in the router's DHCP settings) The router matches the interface and always offers the same IP
Connect to that printer from an app IP address or local name Applications work above the link layer
Forward a port from the internet IP address The rule rewrites packets by IP
Find which switch port a device uses MAC Switch tables are indexed by it
Wake a sleeping computer over the LAN MAC The wake packet carries the target's hardware address

Notice the first row. A reservation ties the two together: the hardware address identifies who is asking, and the IP address is what it receives. See static vs. dynamic addresses for the alternatives.

Mistakes that cause confusion

Reserving the wrong interface. A laptop's cable port and Wi-Fi radio have different MAC addresses. Reserve both if you want a stable address either way, using two different IP addresses.

Copying the router's address. Routers have separate hardware addresses on the internet side, the wired side and each Wi-Fi band. Some internet providers register the first MAC they see on the line, which is why a newly swapped router sometimes gets no connection until the modem is restarted or the provider updates its records. Many routers offer a "clone MAC" setting for this, intended for your own equipment on your own account.

Treating the manufacturer lookup as proof. A registered prefix tells you who received the block, and software can set any value. An unfamiliar name is a reason to investigate, and a familiar one isn't a guarantee.

Expecting MAC rules to work across routers. If a second router sits behind the first, the upstream one sees only the second router's address, not the devices behind it.

What it means for security

MAC filtering, which admits only listed addresses, sounds strong but isn't. Addresses travel unencrypted in Wi-Fi frame headers and can be changed in software. Use strong Wi-Fi encryption and a good passphrase instead; see securing home Wi-Fi.

MAC addresses are still useful for inventory. Comparing the list in your router with your known devices is a sensible habit, covered in how to see every device on your network.

IP addresses have their own privacy story, since servers must see an address to reply. What your IP address reveals explains the limits of that.

Can a website see your MAC address?

Not through ordinary network traffic. Your frame is discarded at your first router. A website sees your public IP address.

There are two caveats. Software installed on your device can read the address and send it anywhere it likes. And an older IPv6 method built part of the address from the MAC; modern operating systems generally use random or stable but unrelated identifiers instead.

Common questions

Why do I need an IP address if the MAC address is unique?

Uniqueness doesn't tell a router where a device is. IP addresses are assigned in blocks that routers can summarize, which is what makes a global network workable. Randomized and cloned addresses also mean MACs are not guaranteed to be unique.

Can two devices share a MAC address?

On the same segment, that causes confusion: a switch keeps seeing the address move between ports, and traffic goes to the wrong one at times. On separate networks it usually goes unnoticed.

Written for 4Internet with AI writing tools and not reviewed line by line by a person. Check anything you rely on with the maker, provider or standard concerned. Report an error.

Keep reading

All 45 articles in IP Addresses & Routing →

Latest news on this topic