Study Guide
Network Hardware and Addresses
What a device needs to join a network: a network interface card with a MAC address fixed at manufacture, an IP address (IPv4 or IPv6, static or dynamic) given by the network, and a router that sends data to the right place, hands out addresses and links the local network to the internet.
Lesson 4.5 Networks, the Internet and Security
For: Cambridge IGCSE Computer Science learners, or anyone who has wondered how a message finds the right phone out of all the devices in a house
Stage: Think
A house full of devices
In a fictional house, Rina’s family has one broadband line and six devices on the Wi-Fi: two phones, a laptop, a tablet, a games console and a television. Rina starts a video call on her laptop. The pictures and sound from her friend’s computer have to reach her laptop, and not the television or the console.
Think it through
What would each device need, so that the packets of the video call find the laptop out of all six? And what must each device contain, to be able to join the Wi-Fi at all?
- Hint 1: How does the post find the right house in a street?
- Hint 2: Which part of the laptop turns data into radio signals for the Wi-Fi?
Show a model answer
Each device needs an address that no other device on the network shares, like the number of a house in a street, so packets can be sent to the right one. To join the Wi-Fi, each device needs a part that can send and receive the signals: a piece of hardware that connects it to the network.
Stage: Discover
The part that joins the network
A network interface card (NIC) is the hardware that lets a device connect to a network. It sends and receives the signals: electrical signals along a cable, or radio signals for Wi-Fi. A computer needs a NIC to access a network. In a modern laptop or phone the NIC is a small chip on the main board, not a card you can see, but it does the same job.
Check your understanding
Show the answer
Answer: C. Connect to a network, because it has no hardware to send and receive signals.
Without a NIC, the computer works on its own, but it cannot join a network.
Stage: Predict
An address stamped in the factory
Think it through
Millions of NICs are made every year, by many companies, and each can be plugged into any network in the world. Should two NICs ever have the same address? How could a factory make sure that none of its own NICs share one, and how could different companies avoid using the same addresses as one another?
- Hint 1: What would happen on one network if two devices both had the same address?
- Hint 2: Could each company be given its own part of the address, and number its NICs inside that part?
Show what happens
No: two devices with the same address on one network could not be told apart. A factory can give every NIC a different serial number, and the companies can avoid clashes if each one is given its own code to put at the start of every address it makes.
That is how a media access control address, a MAC address, is built. It is given to the NIC at the point of manufacture, so it belongs to the NIC and goes wherever the device goes. It is made of two parts:
- the manufacturer code: identifies the company that made the NIC (the first half);
- the serial code: a number that the manufacturer gives to each NIC it makes (the second half).
A MAC address has 48 bits. Forty-eight bits is too long to read easily, so it is usually written in hexadecimal: six pairs of hexadecimal digits, each pair standing for one byte (8 bits), separated by hyphens or colons. This one is made up for this lesson:
3C-A1-5B-7F-20-D4
manufacturer code: 3C-A1-5B serial code: 7F-20-D4- Count the pairs. There are six pairs of hexadecimal digits.
- Recall what a hexadecimal digit stands for. One hexadecimal digit stands for four bits, so one pair stands for 8 bits: for example, 3C is 0011 1100.
- Multiply. 6 pairs × 8 bits = 48 bits, or 12 hexadecimal digits × 4 bits = 48 bits, the same answer.
| Hexadecimal pair | Binary (8 bits) |
|---|---|
| 3C | 0011 1100 |
| A1 | |
| 5B | |
| 7F | |
| D4 |
- Write each hexadecimal digit as four bits, then put the two groups together.
- A = 1010 and F = 1111; 5 = 0101 and B = 1011.
Show the completed table
| Hexadecimal pair | Binary (8 bits) |
|---|---|
| 3C | 0011 1100 |
| A1 | 1010 0001 |
| 5B | 0101 1011 |
| 7F | 0111 1111 |
| D4 | 1101 0100 |
Check your understanding
Show the answer
Answer: A. It is given to the NIC at manufacture, and has a manufacturer code and a serial code.
A MAC address belongs to the NIC and is fixed when it is made.
Stage: Explain
An address that depends on where you are
A MAC address stays with the device. But a letter needs an address that says where the device is on the network.
Think it through
Rina takes her laptop from home to school. Its NIC, and so its MAC address, comes with it. Should the address that packets use to find the laptop be the same at school as at home? Why, or why not?
- Hint 1: Which network is the laptop on at home, and which at school?
- Hint 2: Think about someone who moves house: does their name change? Does their postal address?
Show what happens
No. The laptop joins a different network, and each network has its own set of addresses. Like a person who keeps their name when they move house but gets a new postal address, the laptop keeps its MAC address but gets a new address on the new network.
An internet protocol address, an IP address, identifies a device on a network and is used to deliver packets to it: it is the destination address, and the originator’s address, that you met in the header of a packet. Unlike a MAC address, it is allocated by the network that the device joins, so it can change.
There are two ways for a device to get one:
- a static IP address is set by hand and does not change. It suits a device that others must always be able to find, such as a school’s web server or a network printer;
- a dynamic IP address is given automatically by the network each time the device joins, and may be different next time. It suits laptops and phones that come and go. When a device leaves, its address can be given to another.
Apply it
Show the answer
Answer: B. A static address for the web server and a dynamic address for the phone.
The server needs an address that stays the same; the phone does not mind which free address it is given.
Do not confuse: Two addresses on one device
- Who?MAC address
- Identifies the NIC. Given by the manufacturer when the NIC is made, so it goes wherever the device goes.3C-A1-5B-7F-20-D4
- Where?IP address
- Identifies the device on a network. Given by the network, static or dynamic, so it can change from one network to another.192.0.2.25
A device keeps its MAC address; its IP address depends on the network it has joined.
| Statement | MAC address or IP address? |
|---|---|
| Assigned by the manufacturer when the NIC is made | |
| Allocated by the network that the device joins | |
| Can be static or dynamic | |
| Has a manufacturer code and a serial code |
- Who gives the address, and when?
- Does the address stay the same when the device joins a different network?
Show the completed table
| Statement | MAC address or IP address? |
|---|---|
| Assigned by the manufacturer when the NIC is made | MAC address |
| Allocated by the network that the device joins | IP address |
| Can be static or dynamic | IP address |
| Has a manufacturer code and a serial code | MAC address |
Apply it
Show the answer
Answer: A. The MAC address stays the same; it is the IP address that changes with the network.
The MAC address is fixed to the NIC. The IP address belongs to the network.
Stage: Experiment
Reading an IPv4 address
Think it through
The most common form of IP address is written as four numbers separated by dots, for example 192.0.2.25. Each number is stored in 8 bits. What is the smallest value that one number can have? What is the largest? How many bits does the whole address have?
- Hint 1: Eight bits all 0 is one pattern; all 1 is another.
- Hint 2: The largest 8-bit value was met in the lesson on binary.
Show what happens
Eight bits can hold 0 (all zeros) up to 255 (all ones), so each number is between 0 and 255. Four numbers of 8 bits make 32 bits in all.
This form is IPv4, version 4 of the internet protocol. An IPv4 address has 32 bits, written as four denary numbers, each between 0 and 255, separated by dots. Each number is called an octet, because it is 8 bits.
- Write the column values for 8 bits. 128, 64, 32, 16, 8, 4, 2, 1.
- Take the biggest column that fits. 192 − 128 = 64, so the 128 column is on, with 64 left over.
- Move to the next column. 64 fits exactly, so the 64 column is on, and 0 is left over.
- Switch every other column off. The answer is 1100 0000.
So the first number of 192.0.2.25 is 1100 0000 in binary. The 32-bit address is made up of four such groups.
| Number | Binary (8 bits) |
|---|---|
| 192 | 1100 0000 |
| 0 | |
| 2 | |
| 25 |
- Use the columns 128, 64, 32, 16, 8, 4, 2, 1.
- Switch a column on only if it fits in what is left.
Show the completed table
| Number | Binary (8 bits) |
|---|---|
| 192 | 1100 0000 |
| 0 | 0000 0000 |
| 2 | 0000 0010 |
| 25 | 0001 1001 |
Check your understanding
Show the answer
Answer: D. 192.0.2.256
Each number must be between 0 and 255, and 256 is outside that range.
Stage: Predict
Running out of addresses: IPv6
With 32 bits, an IPv4 address can have 2 × 2 × … (32 times) = 4 294 967 296 values: about 4.3 billion.
Think it through
There are billions of people, and each may have a phone, a laptop, a television and other connected devices. Is 4.3 billion addresses enough? What could be done to fix it, if every address had to stay unique?
- Hint 1: Compare the number of addresses with the number of devices.
- Hint 2: How does adding one bit to an address change the number of patterns?
Show what happens
Probably not: the number of connected devices is larger than the number of addresses. Every extra bit doubles the number of patterns, so the fix is to make addresses longer, with many more bits.
That is why IPv6 was introduced. An IPv6 address has 128 bits, written as eight groups of four hexadecimal digits, separated by colons. Each group is 16 bits (four digits × 4 bits), so 8 × 16 = 128. A fictional example:
2001:0db8:0000:0000:0000:0000:0000:0001Doubling 32 times is a lot; doubling 128 times gives about 3.4 × 10 to the power 38 addresses: so many that the supply is not expected to run out.
| IPv4 | IPv6 | |
|---|---|---|
| Length | 32 bits | 128 bits |
| How it is written | Four denary numbers from 0 to 255, separated by dots | Eight groups of four hexadecimal digits, separated by colons |
| Example | 192.0.2.25 | 2001:0db8:0000:0000:0000:0000:0000:0001 |
| Number of addresses | About 4.3 billion | About 3.4 × 10 to the power 38 |
| Why it exists | The first widely used version | Introduced because IPv4 addresses are running out |
Check your understanding
Show the answer
Answer: B. IPv4 has too few addresses for all the devices, and IPv6 has far more because it is longer.
IPv6 has far more addresses, because its addresses are 128 bits long instead of 32.
Go deeper Shortening an IPv6 address
A long IPv6 address is usually shortened. Leading zeros in a group can be left out, and one run of groups that are all zero can be replaced by two colons, once. So 2001:0db8:0000:0000:0000:0000:0000:0001 is written 2001:db8::1.
Stage: Experiment
The device that ties it together
Back in Rina’s house, one small box with flashing lights sits by the broadband line.
Think it through
Rina’s house has six devices and one broadband line to the internet. What jobs must the box do, so that every device can get online and the packets of the call find the laptop?
- Hint 1: Who decides which address each device gets?
- Hint 2: Where do packets for the internet go, and where do packets for the laptop go?
Show a model answer
It must connect the home network to the internet, because there is one line for all six devices. It must send each packet to the right destination, so that the call reaches the laptop and not the television. And, since each device needs an address, it can give one to every device that joins. That box is a router.
A router does three jobs. It:
- sends data to a specific destination, using the destination address in each packet;
- can assign IP addresses to the devices that join its network (dynamic addresses);
- connects a local network to the internet.
Each step names the device that acts. Notice the router’s three jobs.
Rina’s laptop and the router
Step 1 of 4: The laptop joins the home network
The laptop’s NIC, with its MAC address, asks to join the Wi-Fi. The router gives it a dynamic IP address, 192.0.2.25. This is the router assigning an IP address.
Rina’s laptop
Step 2 of 4: The laptop sends packets to the video call server
Each packet has a header with the destination address of the server, 203.0.113.80, and the laptop’s own address, 192.0.2.25, as the originator’s address.
The router
Step 3 of 4: The router connects the home network to the internet
The packets are for a destination outside the house, so the router passes them on along the broadband line, towards the server.
The router
Step 4 of 4: The reply comes back, and the router sends it to the laptop
Packets from the other caller arrive at the router, addressed to 192.0.2.25. The router sends them to that device, and not to the television or the console. This is the router sending data to a specific destination.
Apply it
Show the answer
Answer: A. The router, which assigns IP addresses to devices that join its network.
The router assigns IP addresses to devices that join its network.
Stage: Consolidate
Show what you know
Think it through
A friend asks why a phone needs two addresses, a MAC address and an IP address. Explain the difference to them, using the words NIC, manufacturer, network and router.
- Hint 1: Which address belongs to the hardware, and which to the network?
- Hint 2: Which one changes when the phone joins another network?
Show a model answer
A good answer: “The MAC address belongs to the phone’s NIC. The manufacturer gives it when the NIC is made, so it stays the same wherever the phone goes. The IP address belongs to the network that the phone joins. The router can assign it, and it can be different on a different network. The MAC address says which piece of hardware this is; the IP address says where it is on the network, so packets can be delivered.”
Apply it
Show the answer
Answer: C. It is an IPv6 address, with eight groups of four hexadecimal digits.
Eight groups of four hexadecimal digits, separated by colons: IPv6.
- A network interface card (NIC) is needed to access a network. It sends and receives the network’s signals.
- A MAC address is given to the NIC at manufacture. It has 48 bits, usually written as six pairs of hexadecimal digits: a manufacturer code and a serial code.
- An IP address is allocated by the network and can be static (set by hand, never changes) or dynamic (given automatically, may change).
- IPv4 has 32 bits, written as four numbers from 0 to 255 separated by dots. IPv6 has 128 bits, written as eight groups of four hexadecimal digits. IPv6 exists because there are too few IPv4 addresses.
- A router sends data to its destination, can assign IP addresses and connects a local network to the internet.
Sources and scope
- What this lesson is. The fifth lesson of the Networks, the Internet and Security module, written for this site. Its curriculum links are provisional: the wording of each linked specification point has been checked against the published specification, but no link has been verified by the site owner, and the links imply no endorsement by any examination board.
- Original material. Rina’s house, the school web server, Jo’s claim and the pupils’ devices are fictional. The MAC address 3C-A1-5B-7F-20-D4 is made up for this lesson, and does not belong to any real manufacturer. The IPv4 addresses (192.0.2.x and 203.0.113.x) and the IPv6 address (2001:db8::) are in the ranges set aside for examples in documents, so they are never given to real devices.
- Simplified on purpose. A MAC address can be changed by software, and many phones use a changing one for privacy; the lesson treats it as fixed, as the specification does. Real home routers give devices private addresses and share one public address given by the internet service provider; public and private addresses are not taught here. The name of the protocol that hands out addresses is not given. The lesson shows how IPv6 addresses are written but not how IPv4 and IPv6 work side by side.
The number system with only two digits, 0 and 1, in which each column is worth twice the column to its right.
A single binary digit: 0 or 1. The smallest unit of data a computer stores.
A group of eight bits, which can hold one of 256 different patterns.
The everyday number system with ten digits, 0 to 9, in which each column is worth ten times the column to its right.
An IP address given automatically each time a device joins a network, which may be different next time.
The number system with sixteen digits, 0 to 9 and then A to F, in which each column is worth sixteen times the column to its right.
An address allocated by a network to a device on it, used to deliver packets to that device.
The version of IP address with 32 bits, written as four numbers from 0 to 255 separated by dots.
The version of IP address with 128 bits, written as eight groups of four hexadecimal digits, introduced because IPv4 addresses are running out.
A 48-bit address given to a network interface card at manufacture, usually written as six pairs of hexadecimal digits: a manufacturer code then a serial code.
The hardware that lets a device connect to a network by sending and receiving its signals.
A small piece of data sent across a network, with a header, a payload and a trailer.
The first part of a packet: it holds the destination address, the packet number and the originator’s address.
A device that sends packets on towards their destination, can assign IP addresses and connects a local network to the internet.
An IP address that is set by hand and does not change.
A computer that stores the files of websites and sends a web page to a browser when it receives a request for it.
Your progress on this lesson
Saved in this browser only. It is not sent anywhere, does not follow you to another device, and is lost if you clear this site’s data.
This browser is not allowing the site to save progress, so it will be forgotten when you leave the page.