MAC Address
Media Access Control Address
- In Turkish
- MAC Adresi
- Pronunciation
- MAK AD-res or MAK uh-DRES
In short
A MAC address is a 48-bit hardware identifier assigned to a network interface and used to deliver data between devices on the same local network.
What is a MAC address?
A MAC (Media Access Control) address is a unique identifier assigned to a network interface, such as a laptop's Wi-Fi card or a server's Ethernet port. It is usually written as six pairs of hexadecimal digits, like 3c:22:fb:9a:41:0e, which together make up 48 bits. A device with several network interfaces, for example Wi-Fi and Ethernet, has a separate MAC address for each one.
The first half of the address traditionally identifies the manufacturer, through a registered block called an organizationally unique identifier (OUI), and the second half is chosen by the manufacturer for each interface. MAC addresses work at the data link layer, layer 2 of the OSI model: every Ethernet or Wi-Fi frame carries a source and a destination MAC address, and a network switch reads them to decide which port to send each frame out of. When a device knows only a neighbor's IP address, it uses ARP to find the matching MAC address, and the special address ff:ff:ff:ff:ff:ff is the broadcast address that every device on the local network receives.
If an IP address is like a postal address that changes when you move, a MAC address is closer to a name tag on the network card: it identifies the device to whoever is in the same room. Switches use MAC addresses to forward frames, DHCP servers use them to give reserved IP addresses to specific devices, and some Wi-Fi networks use them for simple allow lists. Modern phones and laptops often use a randomized, private MAC address for each Wi-Fi network, so shops and public hotspots can't track the same device from place to place.
A MAC address is often confused with an IP address. A MAC address only matters on the local network: each router along a path replaces the frame's MAC addresses with its own and the next hop's, while the IP addresses in the packet stay the same from source to destination. The acronym also clashes with MAC in cryptography, where it means message authentication code, which is unrelated. Finally, a MAC address is not a reliable security credential, because software can easily change, or spoof, the address a device reports.
Key takeaways
- A MAC address identifies a network interface, such as a Wi-Fi card or an Ethernet port.
- It is 48 bits long and written as six hexadecimal pairs, like
3c:22:fb:9a:41:0e. - MAC addresses are used only within the local network, at the data link layer (layer 2).
- ARP maps an IP address to a MAC address so a frame can be delivered locally.
- Many devices randomize their MAC address for each Wi-Fi network to protect privacy.
Example
# Show network interfaces and their MAC addresses (Linux)
ip link show
# e.g. "link/ether 3c:22:fb:9a:41:0e brd ff:ff:ff:ff:ff:ff"
# macOS and BSD
ifconfig en0 | grep ether
# Windows
getmac /v
# MAC addresses this machine has learned for its neighbors
ip neigh showReaders ask
What is the difference between a MAC address and an IP address?
A MAC address identifies a network interface and is used to deliver frames within one local network. An IP address identifies a device's location across networks, is used to route packets end to end, and can change when the device moves to another network.
Can a MAC address be changed?
The address built into the hardware is fixed, but the operating system can override the address a device uses, which is called MAC spoofing. Phones and laptops do this on purpose when they use a private, randomized MAC address for each Wi-Fi network.
Is every MAC address unique?
Manufacturers assign addresses from their own registered blocks, so each factory address should be globally unique. Duplicates are rare but possible, and randomized or manually set addresses only need to be unique on the local network.
See also
- IP AddressNetworking, p. 10An IP address is a numeric label assigned to each device on a network so that data can be routed to it, much like a postal address for a house.
- ARPNetworking, p. 1ARP is a network protocol that finds the MAC address belonging to an IPv4 address on the local network, so a device knows where to deliver each Ethernet frame.
- Network SwitchNetworking, p. 18A network switch is a device that connects devices on the same local network and forwards each frame only to the port where its destination MAC address lives.
- LANNetworking, p. 13A LAN is a network that connects devices within a small area such as a home, office or school, letting them reach each other directly and share resources fast.
- DHCPNetworking, p. 6DHCP is a network protocol that automatically gives devices an IP address and other settings, such as the router and DNS server, when they join a network.
- OSI ModelNetworking, p. 19The OSI model is a conceptual framework that splits network communication into seven layers, from physical cables up to the applications people use.
Spotted a mistake or something missing on this page?Suggest an edit