MAC addresses and frames
On this page
You read link/ether in Reading a machine’s network settings. The router then changed the link header in Following one exchange. What do those addresses name? Here you will find the receiving interface, the sending interface and the carried type in one captured header.
Before you start
Section titled “Before you start”Finish Practice: Your First Packet Capture. Leave machine shells and run netlab reset from the VM terminal to restore the starting state. Keep modes off. Terminal 1 begins at learner@rootvolt:~$. Terminal 2 enters laptop with netlab shell laptop. Start the listener before sending. Answer sudo’s password questions when they appear.
Find the interface’s address
Section titled “Find the interface’s address”netlab shell <machine> -- <command> runs one command on that machine and returns to the VM prompt. Here, ip link show eth0 shows the named interface’s link information.
learner@rootvolt:~$ netlab shell laptop -- ip link show eth0[sudo] password for learner: 4: eth0@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 02:77:10:00:00:10 brd ff:ff:ff:ff:ff:ff link-netns sw-homelearner@rootvolt:~$ netlab shell phone -- ip link show eth06: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 02:77:10:00:00:11 brd ff:ff:ff:ff:ff:ff link-netns sw-homelearner@rootvolt:~$ Steps (9)
- Type
netlab shell laptop -- ip link show eth0 - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Output:
4: eth0@if3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 link/ether 02:77:10:00:00:10 brd ff:ff:ff:ff:ff:ff link-netns sw-home - Type
netlab shell phone -- ip link show eth0 - Press Enter
- Output:
6: eth0@if5: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000 link/ether 02:77:10:00:00:11 brd ff:ff:ff:ff:ff:ff link-netns sw-home
The value after link/ether is its MAC address, an address used to name an interface on a local link. It contains six bytes, written as six hexadecimal pairs separated by colons. Each pair represents one byte. Laptop’s address ends in 10; phone’s ends in 11. Read all six pairs when comparing addresses.
Catch a frame with its bytes
Section titled “Catch a frame with its bytes”An Ethernet frame is the link’s unit of data: its header names interfaces and describes the data carried inside. The destination comes first in the bytes. The source follows. EtherType is the two-byte field that says which kind of data the frame carries.
Save one frame with -w frame.pcap; -c 1 stops after one captured frame. The filter icmp keeps ping traffic. It leaves out the earlier frame asking who has an address; Reaching Another Device explains that question.
After terminal 2 sends, -r frame.pcap reads the saved file. Keep -n for numeric output and -e for the link summary. Add -xx to print the frame’s bytes in hex, starting with the link header. The other options were taught in Reading a capture as text.
Predict: the frame is going to phone. Whose address comes first in the bytes?
learner@rootvolt:~$ netlab shell phone[sudo] password for learner: learner@phone:~$ sudo tcpdump -i eth0 -n -c 1 -w frame.pcap icmp[sudo] password for learner: tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes1 packet captured
2 packets received by filter
0 packets dropped by kernellearner@phone:~$ tcpdump -n -e -xx -r frame.pcapreading from file frame.pcap, link-type EN10MB (Ethernet), snapshot length 262144
13:55:17.444900 02:77:10:00:00:10 > 02:77:10:00:00:11, ethertype IPv4 (0x0800), length 98: 10.77.10.10 > 10.77.10.11: ICMP echo request, id 178, seq 1, length 64
0x0000: 0277 1000 0011 0277 1000 0010 0800 4500
0x0010: 0054 875c 4000 4001 8a9e 0a4d 0a0a 0a4d
0x0020: 0a0b 0800 c2a2 00b2 0001 c5a2 016b 0000
0x0030: 0000 a8c9 0600 0000 0000 1011 1213 1415
0x0040: 1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
0x0050: 2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
0x0060: 3637learner@phone:~$ exitlogoutlearner@rootvolt:~$ Steps (19)
- Type
netlab shell phone - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Type
sudo tcpdump -i eth0 -n -c 1 -w frame.pcap icmp - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Output:
tcpdump: listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes - Terminal 2 on laptop finished sending. Return to terminal 1.
- Output:
1 packet captured 2 packets received by filter 0 packets dropped by kernel - Type
tcpdump -n -e -xx -r frame.pcap - Press Enter
- Output:
reading from file frame.pcap, link-type EN10MB (Ethernet), snapshot length 262144 13:55:17.444900 02:77:10:00:00:10 > 02:77:10:00:00:11, ethertype IPv4 (0x0800), length 98: 10.77.10.10 > 10.77.10.11: ICMP echo request, id 178, seq 1, length 64 0x0000: 0277 1000 0011 0277 1000 0010 0800 4500 0x0010: 0054 875c 4000 4001 8a9e 0a4d 0a0a 0a4d 0x0020: 0a0b 0800 c2a2 00b2 0001 c5a2 016b 0000 0x0030: 0000 a8c9 0600 0000 0000 1011 1213 1415 0x0040: 1617 1819 1a1b 1c1d 1e1f 2021 2223 2425 0x0050: 2627 2829 2a2b 2c2d 2e2f 3031 3233 3435 0x0060: 3637 - Type
exit - Press Enter
- Output:
logout
learner@laptop:~$ ping -c 1 10.77.10.11PING 10.77.10.11 (10.77.10.11) 56(84) bytes of data.
64 bytes from 10.77.10.11: icmp_seq=1 ttl=64 time=0.096 ms
--- 10.77.10.11 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.096/0.096/0.096/0.000 mslearner@laptop:~$ Steps (3)
- Type
ping -c 1 10.77.10.11 - Press Enter
- Output:
PING 10.77.10.11 (10.77.10.11) 56(84) bytes of data. 64 bytes from 10.77.10.11: icmp_seq=1 ttl=64 time=0.096 ms --- 10.77.10.11 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.096/0.096/0.096/0.000 ms
Read the Ethernet header bytes
13:55:17.444900 02:77:10:00:00:10 > 02:77:10:00:00:11, ethertype IPv4 (0x0800), length 98: 10.77.10.10 > 10.77.10.11: ICMP echo request, id 178, seq 1, length 64
0x0000: 0277 1000 0011 0277 1000 0010 0800 45000277 1000 00110277 1000 00100800Reading the output
Pick a step to match a marked part of the output to the picture.
Steps (3)
- Destination. Destination: 0277 1000 0011. Link layer. Shown on phone's eth0 as: Destination. The first six bytes name the receiving interface: phone.
- Source. Source: 0277 1000 0010. Link layer. Shown on phone's eth0 as: Source. The next six bytes name the sending interface: laptop.
- EtherType. EtherType: 0800. Link layer. Shown on phone's eth0 as: EtherType. These two bytes say that the frame carries IPv4.
Check your answer
Phone’s address comes first. The summary prints source, then destination around >, but the bytes store destination first. Do not use the summary’s printing order to guess the header’s byte order.
Count byte positions from zero. The four hex digits in each printed group hold two bytes. Colons belong to the address notation; they are not extra bytes in the frame.
| Bytes | Field | Value | What it names |
|---|---|---|---|
| 0–5 | Destination | 02:77:10:00:00:11 |
Phone’s interface |
| 6–11 | Source | 02:77:10:00:00:10 |
Laptop’s interface |
| 12–13 | EtherType | 0x0800 |
IPv4 inside |
The 4500 after 0800 starts the carried IPv4 header. Leave its fields for later. Stop reading this Ethernet header after the type. Your timestamps, ping identifiers and round-trip times will differ; those values do not change these three fields.
Recognize what an address can tell you
Section titled “Recognize what an address can tell you”On hardware with a manufacturer-assigned address, the first three bytes identify its assigned maker prefix. That is not a rule for every address you meet. The lab tool sets these addresses locally; their first byte, 02, marks them as locally administered. A maker lookup cannot identify the lab’s devices from that prefix.
A MAC address belongs to an interface. A computer with several interfaces can have several addresses. Software can change an interface’s address, so an address alone proves nothing about who controls a device. An unexpected address change is a reason to check other evidence, rather than proof of a particular person.
Mistakes to recognize
Section titled “Mistakes to recognize”“A MAC address identifies a computer everywhere.” These reads identify two local interfaces. They do not establish a permanent identity for either computer.
“The MAC address travels to the web server.” Recall the changed link header in Following one exchange. The next link names its own interfaces, while the carried request continues toward its destination.
Good to know
Section titled “Good to know”The one-frame listener stops itself. Wait for its prompt instead of pressing Ctrl+C.
Try it yourself
Section titled “Try it yourself”Reset from the VM. Before sending from phone to router, write down the expected destination, source and type. In terminal 1 enter router with netlab shell router and run sudo tcpdump -i eth0 -n -e -xx -c 1 icmp. In terminal 2 enter phone with netlab shell phone and run ping -c 1 10.77.10.1. Compare your prediction with the first fourteen captured bytes, explaining which interface each address names.
Solution
learner@rootvolt:~$ netlab shell router[sudo] password for learner: learner@router:~$ sudo tcpdump -i eth0 -n -e -xx -c 1 icmp[sudo] password for learner: tcpdump: verbose output suppressed, use -v[v]... for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes14:58:40.336730 02:77:10:00:00:11 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 98: 10.77.10.11 > 10.77.10.1: ICMP echo request, id 178, seq 1, length 64
0x0000: 0277 1000 0001 0277 1000 0011 0800 4500
0x0010: 0054 f580 4000 4001 1c83 0a4d 0a0b 0a4d
0x0020: 0a01 0800 0c3d 00b2 0001 a0b1 016b 0000
0x0030: 0000 8520 0500 0000 0000 1011 1213 1415
0x0040: 1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
0x0050: 2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
0x0060: 3637
1 packet captured
2 packets received by filter
0 packets dropped by kernellearner@router:~$ exitlogoutlearner@rootvolt:~$ Steps (16)
- Type
netlab shell router - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Type
sudo tcpdump -i eth0 -n -e -xx -c 1 icmp - Press Enter
- Output:
[sudo] password for learner: - Type the password (the terminal shows nothing)
- Press Enter
- Output:
tcpdump: verbose output suppressed, use -v[v]... for full protocol decode listening on eth0, link-type EN10MB (Ethernet), snapshot length 262144 bytes - Terminal 2 on phone finished sending. Return to terminal 1.
- Output:
14:58:40.336730 02:77:10:00:00:11 > 02:77:10:00:00:01, ethertype IPv4 (0x0800), length 98: 10.77.10.11 > 10.77.10.1: ICMP echo request, id 178, seq 1, length 64 0x0000: 0277 1000 0001 0277 1000 0011 0800 4500 0x0010: 0054 f580 4000 4001 1c83 0a4d 0a0b 0a4d 0x0020: 0a01 0800 0c3d 00b2 0001 a0b1 016b 0000 0x0030: 0000 8520 0500 0000 0000 1011 1213 1415 0x0040: 1617 1819 1a1b 1c1d 1e1f 2021 2223 2425 0x0050: 2627 2829 2a2b 2c2d 2e2f 3031 3233 3435 0x0060: 3637 1 packet captured 2 packets received by filter 0 packets dropped by kernel - Type
exit - Press Enter
- Output:
logout
learner@phone:~$ ping -c 1 10.77.10.1PING 10.77.10.1 (10.77.10.1) 56(84) bytes of data.
64 bytes from 10.77.10.1: icmp_seq=1 ttl=64 time=0.813 ms
--- 10.77.10.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.813/0.813/0.813/0.000 mslearner@phone:~$ Steps (3)
- Type
ping -c 1 10.77.10.1 - Press Enter
- Output:
PING 10.77.10.1 (10.77.10.1) 56(84) bytes of data. 64 bytes from 10.77.10.1: icmp_seq=1 ttl=64 time=0.813 ms --- 10.77.10.1 ping statistics --- 1 packets transmitted, 1 received, 0% packet loss, time 0ms rtt min/avg/max/mdev = 0.813/0.813/0.813/0.000 ms
The destination is 02:77:10:00:00:01, source is 02:77:10:00:00:11, and type is 0800.
Leave for later
Section titled “Leave for later”The check value at the end of an Ethernet frame is normally absent from these captures. VLAN tags belong to VLANs and Trunks later in the course.
- Read destination, source, then type in the bytes.
- Compare interface addresses, rather than permanent computer identities.
- Use a fresh capture to check your field prediction.
Next, How switches learn follows the source address into the switch’s table.
Further reading
Section titled “Further reading”- Ubuntu: tcpdump manual, for Ethernet output and hex bytes.
- Ubuntu: ip-link manual, for interface link addresses.