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?

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

A desktop computer has a perfectly good processor, memory and storage, but no NIC (and no network adapter plugged into it). What can it not do?
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?

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
  1. Count the pairs. There are six pairs of hexadecimal digits.
  2. 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.
  3. Multiply. 6 pairs × 8 bits = 48 bits, or 12 hexadecimal digits × 4 bits = 48 bits, the same answer.
The pairs of the MAC address 3C-A1-5B-7F-20-D4 in binary
Hexadecimal pairBinary (8 bits)
3C0011 1100
A1
5B
7F
D4

    Show the completed table
    Hexadecimal pairBinary (8 bits)
    3C0011 1100
    A11010 0001
    5B0101 1011
    7F0111 1111
    D41101 0100

    Check your understanding

    Which statement about a MAC address is correct?
    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?

    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

    A school’s web server must always be found at the same address, so that pupils’ bookmarks keep working. A pupil’s phone joins the school Wi-Fi each morning. Which kinds of address suit them?
    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.

    MAC address or IP address?
    StatementMAC 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

      Show the completed table
      StatementMAC address or IP address?
      Assigned by the manufacturer when the NIC is madeMAC address
      Allocated by the network that the device joinsIP address
      Can be static or dynamicIP address
      Has a manufacturer code and a serial codeMAC address

      Apply it

      Jo says: “When Rina takes her laptop to school, its MAC address changes, because it is on a different network.” What is wrong with what Jo says?
      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?

      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.

      1. Write the column values for 8 bits. 128, 64, 32, 16, 8, 4, 2, 1.
      2. Take the biggest column that fits. 192 − 128 = 64, so the 128 column is on, with 64 left over.
      3. Move to the next column. 64 fits exactly, so the 64 column is on, and 0 is left over.
      4. 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.

      The four numbers of 192.0.2.25 in binary
      NumberBinary (8 bits)
      1921100 0000
      0
      2
      25

        Show the completed table
        NumberBinary (8 bits)
        1921100 0000
        00000 0000
        20000 0010
        250001 1001

        Check your understanding

        Which of these cannot be an IPv4 address?
        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?

        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:0001

        Doubling 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.

        IPv4IPv6
        Length32 bits128 bits
        How it is writtenFour denary numbers from 0 to 255, separated by dotsEight groups of four hexadecimal digits, separated by colons
        Example192.0.2.252001:0db8:0000:0000:0000:0000:0000:0001
        Number of addressesAbout 4.3 billionAbout 3.4 × 10 to the power 38
        Why it existsThe first widely used versionIntroduced because IPv4 addresses are running out

        Check your understanding

        Which statement gives the main reason for IPv6?
        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?

        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:

        1. sends data to a specific destination, using the destination address in each packet;
        2. can assign IP addresses to the devices that join its network (dynamic addresses);
        3. connects a local network to the internet.
        Rina’s laptop joins the Wi-Fi and makes a video call

        Each step names the device that acts. Notice the router’s three jobs.

        1. 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.

        2. 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.

        3. 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.

        4. 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

        A pupil connects a new tablet to the school Wi-Fi, and the tablet is soon online with an address it did not have before. Which device most likely gave the tablet its IP address?
        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.

        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

        A technician reads the address 2001:0db8:0000:0000:0000:0000:0000:0001 on a router’s setting screen. Which statement about it is correct?
        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.