IP and MAC addressing

GCSE Computer Science (OCR) · OCR J277 · Computer systems (Paper 1) › Networks, connections and protocols › Wired and wireless networks, protocols and layers

66 exam-style questions plus unlimited generated ones on this topic, at up to four difficulty levels, with full mark schemes. Notes and past-paper booklets are open to everyone. Practice needs a free account.

Or take a quick quiz: 10 questions on this subtopic in GCSE Computer Science (OCR), marked as you tap.

Revision notes

The two kinds of address used on networks: IP addresses, which identify a device on a network and are used to route data between networks, and MAC addresses, which are fixed to a device's network interface and used within a LAN. Expect questions on recognising the formats (IPv4, IPv6 and MAC), comparing the two types of address and explaining how each is used.

Key facts

  • IPv4: 32 bits; four denary numbers 0–255 separated by dots
  • IPv6: 128 bits; eight groups of four hex digits separated by colons
  • MAC: 48 bits; six pairs of hex digits separated by colons or hyphens
  • IP address: assigned by the network, can change; used by routers
  • MAC address: assigned by the manufacturer, fixed to the NIC; used by switches
  • IPv4 gives 232 ≈ 4.3 billion addresses; IPv6 gives 2128

Notes

IP addresses

diagram
  • An IP address identifies a device on a network. It is assigned by the network the device joins, so it can change, e.g. when a laptop moves from home to school.
  • Routers use the destination IP address to route packets between networks and across the Internet.
  • IPv4: 32 bits, written as four denary numbers from 0 to 255 separated by dots, e.g. 192.168.10.27. Each number is 8 bits.
  • 192110000008 bits.168101010008 bits.10000010108 bits.27000110118 bits4 × 8 bits = 32 bits
    IPv4: four numbers from 0 to 255, each stored in 8 bits
  • IPv4 gives 232 (about 4.3 billion) addresses, which is not enough for every phone, computer, server and smart device, so IPv6 was introduced.
  • IPv6: 128 bits, written as eight groups of four hexadecimal digits separated by colons, e.g. 2001:0db8:0a3c:0000:0000:7e21:04f0:9b15. It gives 2128 addresses.

MAC addresses

  • A MAC (Media Access Control) address is assigned to a device's network interface card (NIC) by the manufacturer. It is unique and does not change when the device moves to a different network.
  • 48 bits, written as six pairs of hexadecimal digits separated by colons or hyphens, e.g. 3C:4A:92:0B:E7:15.
  • Switches use MAC addresses to send data to the right device within a LAN.

Why both are needed

diagram
  • The IP address gets data to the right network; the MAC address gets it to the right device on that network.
  • Think of a letter to a block of flats: the street address gets it to the building, and the flat number gets it to the right door.
  • InternetHome network (LAN)RouterSwitchLaptopPhoneIP address → the right networkMAC address → the right device
    IP gets the data to the right network; MAC gets it to the right device on that network

How to answer each type of question

Identify the type of address

1 to 3 marksGrade 3
  1. Dots and four denary numbers (each 0 to 255) → IPv4.
  2. Colons and groups of up to four hex digits (eight groups in full) → IPv6.
  3. Six pairs of hex digits → MAC address.

Example. Identify the type of each address.
(a) 172.16.254.9 [1]
(b) 8C-1F-64-A2-3B-D0 [1]
(c) fe80:0000:0000:0000:02aa:00ff:fe28:9c5a [1]

Show the model answerHide the model answer
(a) IPv4
(1)
(b) MAC address
(1)
(c) IPv6
(1)

Compare or explain IP and MAC addresses

2 to 4 marksGrade 5
  1. Compare who assigns each address and whether it can change.
  2. Compare what each is used for: routing between networks, or delivery within a LAN.
  3. Compare formats: 32 or 128 bits for IP, 48 bits in hex for MAC.

Example. Amir's phone is connected to his home Wi-Fi. He then connects it to the Wi-Fi in a café. Explain what happens to the phone's IP address and to its MAC address. [4]

Show the model answerHide the model answer
The phone is given a new IP address (1), because an IP address is assigned by the network the device joins (1). The MAC address stays the same (1), because it is fixed to the phone's network interface card by the manufacturer (1).

Explain the IPv4 number range and IPv6

2 to 4 marksGrade 7
  1. Link each number in an IPv4 address to 8 bits.
  2. 8 bits give 28 = 256 values, from 0 to 255.
  3. For IPv6: IPv4 has about 4.3 billion addresses, and more devices than that need addresses.

Example. (a) Explain why 192.168.300.4 is not a valid IPv4 address. [2]
(b) Explain why IPv6 addresses were introduced. [2]

Show the model answerHide the model answer
(a) Each number in an IPv4 address is stored in 8 bits (1), which can only hold values from 0 to 255, so 300 is too large
(1).
(b) IPv4 has only about 4.3 billion addresses, which is not enough for all the devices connected to the Internet (1). IPv6 uses 128 bits, so it gives far more addresses
(1).

Don’t lose marks

  • Saying MAC addresses are used to send data across the Internet. Routers use IP addresses between networks.
  • Saying a device keeps the same IP address wherever it goes.
  • Writing IPv6 addresses in denary or IPv4 addresses in hexadecimal.
  • Saying an IPv4 address is 4 bits because it has four numbers. It is 32 bits (four 8-bit numbers).

More tips

Memory tricks

  • MAC is Manufactured (fixed); IP is Issued by the network (can change).
  • Count the separators: 3 dots → IPv4; 7 colons (in full form) → IPv6; 5 colons or hyphens between 6 pairs → MAC.
  • Bits in increasing order: IPv4 32, MAC 48, IPv6 128.

Exam technique

  • When comparing, write both sides in each point: 'An IP address… whereas a MAC address…'.
  • State who assigns each address: it is one of the most common mark points.
  • Link addresses to hardware: switch → MAC address, router → IP address.

What each grade needs

What you need to be able to do, from the first marks up to the top grade.

  1. Grade 3
    Recognise IPv4, IPv6 and MAC addressesIPv4: four denary numbers with dots; IPv6: groups of hex digits with colons; MAC: six pairs of hex digits.
  2. Grade 4
    State who assigns IP and MAC addressesThe network assigns the IP address; the manufacturer assigns the MAC address to the NIC.
  3. Grade 5
    Describe IPv4 and IPv6 formatsIPv4 is 32 bits written as four numbers from 0 to 255; IPv6 is 128 bits written as eight groups of four hex digits.
  4. Grade 5
    Explain why IPv6 was introducedIPv4 gives only about 4.3 billion addresses, which is not enough for all connected devices.
  5. Grade 6
    Explain how routers and switches use addressesRouters use IP addresses to route data between networks; switches use MAC addresses to deliver data within a LAN.
  6. Grade 7
    Explain why an IPv4 number cannot exceed 255Each part is 8 bits, which gives 28 = 256 values, from 0 to 255.

Quick recall

Cover the answers and test yourself. The app has these as flashcards that come back just before you'd forget them.

State what the letters MAC stand for in 'MAC address'.
Media Access Control
State how many bits are in an IPv4 address.
32
State how many bits are represented by one hexadecimal digit.
4
State the number of hexadecimal digits in a MAC address.
12
State the number of bits in an IPv6 address.
128
Write true or false for each statement. An IPv4 address has four parts separated by dots.
true

Sample questions

Written for this site in the style of OCR exam questions. They are not taken from real past papers.

Question 1Easy3 marks
(a) Which one of the following is a MAC address?
Tick (✓) one box.
[1]
  • 192.168.1.25
  • 2001:0db8:3c4d:0015:0000:0000:1a2f:1a2b
  • www.example.com
  • 2C-54-91-88-C9-E3
(b) State what the letters MAC stand for in 'MAC address'.
[1]
(c) State who assigns a MAC address to a device.
[1]
Show the answer and mark scheme
(a) Answer: 2C-54-91-88-C9-E3
(b) Answer: Media Access Control
  • Media Access Control
(c)
  • the manufacturer (of the network interface card)
Question 2Medium4 marks
Describe the differences between an IP address and a MAC address.
[4]
Show the answer and mark scheme
  • an IP address is assigned by the network / can change when the device joins a different network
  • a MAC address is assigned by the manufacturer / is fixed and unique to the network interface card
  • IP addresses are used to route data between networks / across the Internet
  • MAC addresses are used to identify devices within a local network, e.g. by switches
  • IPv4 addresses are 32 bits written in denary, whereas MAC addresses are 48 bits written in hexadecimal
Question 3Hard4 marks
Explain why data sent across the Internet uses both IP addresses and MAC addresses.
[4]
Show the answer and mark scheme
  • the destination IP address identifies the device / network the data is going to across the Internet
  • routers use the IP address to forward packets between networks
  • a MAC address identifies a particular device’s network interface on a local network
  • switches use MAC addresses to deliver data to the correct device within the LAN
  • so the IP address gets the data to the right network and the MAC address gets it to the right device on that network

More in Wired and wireless networks, protocols and layers

Stuck? Get 1-to-1 help.

Chhetri Academy tutors GCSE and A level Maths and Science online, with a free 30-minute trial lesson.