Two addresses on every interface
MAC stands for Media Access Control. A MAC address identifies one piece of network hardware: a specific network interface. An IP address identifies where a device currently sits in a network, and it is given out by the network.
IP address · logical
Given by the network (DHCP). Can change. Used to find the way across networks.
192.168.1.23MAC address · physical
Set by the hardware maker. Normally stays the same. Used for delivery inside one local network.
a4:83:e7:2b:91:0c
A physical network interface (chapter 2) is real hardware that sends and receives signals, so it needs an address of its own. Every hardware interface has a MAC, even when it has no IP:
| Interface | IP | MAC | Note |
|---|---|---|---|
| en0 · WiFi | 192.168.1.23 | a4:83:e7:2b:91:0c | The one we followa chip with an antenna: radio signals |
| en1 · Ethernet | none | a4:83:e7:5c:02:7d | No cable, so no IPbut the hardware still has its MAC |
| Bluetooth | none | a4:83:e7:2b:91:0d | Short-range radioits own interface, its own MAC |
| lo0 · loopback | 127.0.0.1 | none | Not hardwarenothing is sent on a wire, so no MAC is needed |
Why an IP is not enough
An IP address is given by whatever network you join, so the same laptop gets different IPs over one week:
| Where | IP | MAC (WiFi) |
|---|---|---|
| Home, Monday | 192.168.1.23 | a4:83:e7:2b:91:0c |
| Home, after router restart | 192.168.1.31 | a4:83:e7:2b:91:0c |
| Kadé office, staff WiFi | 172.16.1.12 | a4:83:e7:2b:91:0c |
| Café | 10.0.4.17 | a4:83:e7:2b:91:0c |
The format: 6 bytes = 48 bits
A MAC address is always 6 bytes = 48 bits, everywhere. Each byte is written as two hex digits (so a4 is one byte). Only the separator changes with the tool you use:
| Where you see it | Same address, written as |
|---|---|
| macOS, Linux | a4:83:e7:2b:91:0c |
| Windows | A4-83-E7-2B-91-0C |
| Cisco network gear | a483.e72b.910c |
Hexadecimal in two minutes
Decimal uses 10 symbols (0 to 9). Binary uses 2 (0 and 1). Hexadecimal (hex, base 16) uses 16: 0 to 9, then A, B, C, D, E, F. After 9, instead of moving to two digits, hex carries on with letters up to F, which is 15.
- 000000
- 110001
- 220010
- 330011
- 440100
- 550101
- 660110
- 770111
- 881000
- 991001
- A101010
- B111011
- C121100
- D131101
- E141110
- F151111
Top: hex digit. Middle: its decimal value. Bottom: its 4 bits. The highlighted digits are the letters that come after 9.
One hex digit is exactly 4 bits, so two hex digits are exactly one byte. That is why hex is used for MACs and for the byte dumps in chapter 1. Reading a4: a = 1010, 4 = 0100, so the byte is 10100100, which is 10 × 16 + 4 = 164.
The two halves: maker and device
A MAC address splits into two halves, much like an IP splits into network part and host part (chapter 3):
OUI · the maker (3 bytes)
device part (3 bytes)
Each byte in hex (large) and in binary: one row of 4 bits for each hex digit. The two outlined bits at the end of the first byte have special meanings (section 6).
- First 3 bytes: OUI (Organizationally Unique Identifier). Assigned to a hardware maker by the IEEE, the body that runs this system. Every maker has one or more.
- Last 3 bytes: device part. Chosen by the maker, different for every interface it builds.
So devices from the same maker share the first half and differ in the second. The Kadé office bought its two PCs from the same maker:
| Device | MAC | Reading it |
|---|---|---|
| Front desk PC | 3c:7c:3f:10:22:01 | same maker, device 10:22:01 |
| Packing PC | 3c:7c:3f:10:9e:47 | same maker, device 10:9e:47 |
Two special bits in the first byte
The last two bits of the first byte have fixed meanings. They explain two things you will meet soon: broadcast MACs (used by ARP) and random MACs.
| Bit (of the first byte) | If 0 | If 1 |
|---|---|---|
| Last bitcalled I/G | Unicast: one interface | Group: multicast or broadcastff:ff:ff:ff:ff:ff (all 1s) = every device |
| Second-last bitcalled U/L | Universal: set by the maker, uses a real OUI | Local: set by softwarerandom "private" MACs, virtual machines |
| # | MAC | First byte in binary | Meaning |
|---|---|---|---|
| 1 | a4:83:e7:2b:91:0claptop WiFi | 10100100 | One interface, set by the maker |
| 2 | 5e:1a:0b:c3:77:e2phone (chapter 3) | 01011110 | One interface, locally set: the phone uses a random "private" MAC |
| 3 | 42:01:0a:0a:01:0akade-api in GCP | 01000010 | One interface, locally set by the cloud platform |
| 4 | ff:ff:ff:ff:ff:ffbroadcast | 11111111 | Every device on the local network (ARP uses this) |
"Fixed" has an exception: private MACs
A MAC is burned into the hardware, but the OS can send a different one. Modern phones and laptops (iOS, Android, Windows, macOS) do this on purpose: they use a random MAC for each WiFi network, so shops and cafés cannot track the same device across networks. The phone in the home DHCP table from chapter 3 (5e:1a:…) is doing exactly this.
One practical effect: a DHCP reservation is tied to a MAC. If a device switches to a new random MAC, its reservation no longer matches. For the office printer this is not a problem (printers use their real MAC), but it can surprise you with phones.
Try a MAC address
Paste any MAC in any format. The tool splits it and reads the two special bits.
OUI · the maker (3 bytes)
device part (3 bytes)
- macOS / Linux form
- 5e:1a:0b:c3:77:e2
- Windows form
- 5E-1A-0B-C3-77-E2
- Cisco form
- 5e1a.0bc3.77e2
- Last bit of first byte
- 0 → one interface (unicast)
- Second-last bit
- 1 → locally set (software)
- Reading
- Locally set: not a maker OUI. Probably a random private MAC or a virtual interface.
In the cloud
A cloud VM has a virtual network card, so the platform picks its MAC. You never set it. In GCP a VM's MAC usually starts with 42:01 and ends with its internal IP written in hex. For kade-api (10.10.1.10): 10 = 0a, 10 = 0a, 1 = 01, 10 = 0a, giving 42:01:0a:0a:01:0a. The 42 has the "locally set" bit on, as the table in section 6 shows.
Summary
| # | Idea | In one line | New terms |
|---|---|---|---|
| 1 | What it is | The hardware address of one network interface | MAC, Media Access Control |
| 2 | Why | IPs change with the network; hardware needs a fixed ID | |
| 3 | Format | 6 bytes = 48 bits, hex, colons or dashes | |
| 4 | Hex | 16 symbols 0-F; one digit = 4 bits; two = a byte | hexadecimal, nibble |
| 5 | Halves | First 3 bytes = maker (OUI), last 3 = device | OUI, IEEE |
| 6 | Special bits | Group vs one device; maker-set vs locally set | broadcast MAC, I/G, U/L |
| 7 | Exception | Phones and laptops use random private MACs per WiFi | private MAC, MAC spoofing |
| 9 | Cloud | The platform assigns VM MACs (GCP: 42:01 + IP in hex) |
Try it yourself
Every hardware interface and its MAC
- What to look for: WiFi, Ethernet, Thunderbolt ports, each with an "Ethernet Address".
- Runs on: macOS
- From section: 1. Two addresses on every interface
networksetup -listallhardwareportsInterfaces with MACs
- What to look for: The
link/ether(orether) value. Loopback shows 00:00:00:00:00:00 or none. - Runs on: Linux · macOS: ifconfig · Windows: getmac /v
- From section: 1. Two addresses on every interface
ip linkThe first byte in binary
- What to look for:
01011110: second-last bit is 1, so it is a locally set MAC. - From section: 6. Two special bits in the first byte
python3 -c "print(format(0x5e,'08b'))"The VM's MAC
- What to look for: Starts with
42:01. - Runs on: on a GCP VM
- From section: 9. In the cloud
curl -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/network-interfaces/0/mac