Communication

Communication

IP addresses and subnetting

Networks including the internet AS Level 15 min read

On this page
  1. What you need to be able to do
  2. IPv4
  3. IPv6
  4. Public and private, static and dynamic
  5. Subnetting
  6. Mark-scheme focus
  7. Worked examples
  8. Summary
  9. Can I do this?
  10. Quiz

What you need to be able to do

Syllabus 2.1 Networks including the internet
  • 2.1Describe the format of IPv4 and IPv6 addresses and decide whether an address is valid.
  • 2.1Explain subnetting: network ID and host ID, subnet masks, and why networks are subnetted.
  • 2.1Explain how an IP address is associated with a device on a network.
  • 2.1Explain public vs private (and the security implications) and static vs dynamic IP addresses.

You need: binary, denary and hex from Chapter 1, and routers. Next: URLs and DNS.

An IP address identifies a device (strictly, its network connection) so that packets can be routed to it across networks. It is a logical address that can change; the MAC address of the network card is a fixed hardware address used inside one LAN.

IPv4

Format

32 bits written as 4 groups (octets) of 8 bits, each shown in denary 0 to 255, separated by full stops: 192.168.3.2

How many?

\(2^{32}\approx4.3\) billion addresses: not enough for every device now online. That shortage is why IPv6 was introduced (and why LANs use private addresses behind one public one).

AddressValid IPv4?Why
192.168.3.2yes4 groups, each 0-255, full stops
256.0.0.1no256 is more than 255 (8 bits hold 0-255)
10.4.7noonly 3 groups
172.16.300.1no300 > 255
256.0.0.Ano (and not IPv6 either)256 > 255; A is not a denary digit; not IPv6 because it uses full stops not colons and has too few groups

IPv6

Format

128 bits written as 8 groups of 4 hexadecimal digits (each group 16 bits, 0000-FFFF), separated by colons: 2001:0db8:0000:0000:0000:ff00:0042:8329

Shortening

Leading zeros in a group can be dropped (0db8 → db8). One run of consecutive all-zero groups can be replaced by a double colon “::”, only once in an address: 2001:db8::ff00:42:8329

How many?

\(2^{128}\approx3.4\times10^{38}\) addresses: enough for every device for the foreseeable future, so no need to share public addresses.

IPv4IPv6
Size32 bits128 bits
Groups4 groups of 8 bits8 groups of 16 bits
Written indenary (0-255)hexadecimal (0-FFFF)
Separatorfull stopscolons; “::” for consecutive zero groups
“::” is a double colon. A single colon was the commonest wrong answer in June 2023. And it can appear only once: 2001:db8::1::5 is invalid because the reader couldn't tell how many zero groups each one stands for.

Public and private, static and dynamic

TypeMeaning (credited wording)Notes
Publicassigned to a device to allow it to be visible on / directly accessed from the internetunique across the whole internet; e.g. the router's internet-facing address, a web server
Privatecan only be accessed by other devices in the same LAN; assigned by the router within the LANreused in every LAN (e.g. 192.168.x.x, 10.x.x.x); never seen on the internet
Staticdoes not change each time the device connects to the networkset manually or reserved; needed for servers, printers, anything others must always find
Dynamicmay change each time the device connects (re-joins) the networkhanded out automatically (DHCP) from a pool; most phones and laptops

A router has both: a public address so it is visible to the internet / WAN, and a private address so the computers within the LAN can identify it. Through Network Address Translation it lets every device on the LAN share the one public address.

Security implication of private addresses

Devices with private addresses cannot be reached directly from the internet: an outsider sees only the router's public address, which (with its firewall) filters what gets in. A public address is directly visible, so it is more exposed to attack.

How an IP address gets onto a device

Dynamic: when a device joins the LAN, the router (DHCP server) allocates it an IP address from its pool, for a limited time (a lease). Static: the address is configured manually or reserved in the router for that device's MAC address.

Subnetting

Subnetting divides a network into smaller networks (subnetworks). Each IP address is then split into two parts: the network ID (which subnetwork) and the host ID (which device in it).
  1. Every device in a subnetwork has the same network ID; each subnetwork has a different network ID.
  2. The host ID uniquely identifies the device within its subnetwork.
  3. A subnet mask shows where the split is: the octets that are 255 (all 1s in binary) mark the network ID; the octets that are 0 mark the host ID.
  4. The device / router finds the network ID by ANDing the IP address with the mask, bit by bit: 1 keeps the bit, 0 clears it.
IP addressSubnet maskNetwork IDHost ID
192.168.5.77255.255.255.0192.168.577
172.16.40.9255.255.0.0172.1640.9
10.10.12.1255.0.0.01010.12.1
In the last octet the mask is 0, so ANDing clears it: that octet belongs to the host ID, not the network ID.
IP 7701001101
mask 0AND00000000
→ host part00000000

Why subnet?

ReasonBecause…
Reduces network traffic / congestion, improves performancedata sent between devices in the same subnet stays in that subnet, so it doesn't flood the whole network
Improves securitynot all devices can access all segments; a compromised device does not expose the whole network; devices don't receive data not meant for them
Easier maintenance / managementfaults can be isolated: one subnetwork can be taken down or changed while the rest continues
Easier to expand / control growthnew subnetworks can be added in an organised way
The June 2023 report: many described the general benefits of any network instead of the benefits of subnetting, and wrote “Network IP / Host IP” instead of network ID / host ID.

Mark-scheme focus

Complete the description of IPv4 and IPv6 (5 marks)

9618/11/M/J/23 Q4Paper 1 · Theory fundamentalsPart (d)(i)5 marksFull size
(d) The CCTV cameras transfer data wirelessly. (i) Complete the description: An IPv4 address contains … groups of digits. Each group is represented in … bits and the groups are separated by full stops. An IPv6 address contains … groups of digits. Each group is represented in … bits. Multiple groups that only contain zeros can be replaced with a … . [5]
Credited
  • IPv4: 4 groups, 8 bits each B2
  • IPv6: 8 groups, 16 bits each B2
  • zero groups replaced with :: (a double colon) B1
Not credited
  • IPv6 groups of 4 bits (it is 4 hex digits = 16 bits)
  • a single colon “:”

From: 9618/11/M/J/23 Q4(d)(i)

Identify and describe the two parts of an IP address in a subnetwork (3 marks)

9618/13/M/J/23 Q2Paper 1 · Theory fundamentalsPart (e)3 marksFull size
(e) One site has split the network into several subnetworks. An IP address in a subnetwork is divided into two parts. Identify and describe the two parts of an IP address in a subnetwork. [3]
Credited
  • Network ID and host ID B1
  • Each device in a subnetwork has the same network ID // each subnetwork has a different network ID B1
  • Every device in a subnetwork has a different host ID // the host ID uniquely identifies the device within the subnetwork B1
Not credited
  • “Network IP and host IP”
  • Public and private (a different idea)

From: 9618/13/M/J/23 Q2(e)

Complete the table of IP address types (4 marks)

9618/12/O/N/23 Q7Paper 1 · Theory fundamentalsPart (d)4 marksFull size
(d) Complete the table of types of IP addresses and descriptions: (type missing) an IP address assigned to a device to allow direct access on the internet; static IP address (description missing); (type missing) an IP address used for internal LAN communication only; dynamic IP address (description missing). [4]
Credited
  • public IP address B1
  • static: fixed / doesn't change each time a device re-joins a network B1
  • private IP address B1
  • dynamic: may be refreshed / changed each time a device re-joins a network B1
Not credited
  • static = “stays still”; dynamic = “moves”
  • mixing public/private with static/dynamic

From: 9618/12/O/N/23 Q7(d)

  • IP addresses in almost every paper: fill-in descriptions (5-6 marks), IPv4 vs IPv6 differences (2), valid / invalid with justification (2), types (2-4).
  • Subnetting: purpose / benefits (2-4), network ID and host ID (3), reading a subnet mask (2).

Worked examples

Example 1 · Static and public; is 256.0.0.A valid? (Paper 1, 4 marks) ★ Easy
9618/11/O/N/25 Q7Paper 1 · Theory fundamentalsParts (a) and (b)4 marksFull size
Web browsers use IP addresses. (a) Complete the table by describing these types of IP address: Static, Public. [2] (b) Consider the IP address 256.0.0.A. Circle whether it is IPv4, IPv6 or an invalid IP address. Justify your choice. [2]
1 Read it with me what is actually happening?

(b) test it against both formats: is every IPv4 group 0-255? Does it look like IPv6 (8 hex groups with colons)?

  • justifyno mark for circling; 2 for reasons
2 What is it asking for? the target, part by part
  • (a)two descriptions2
  • (b)justification2
3 What do we know? everything the question gives us
  • 256.0.0.A
4 Plan the route work backwards from what we want
FindKey ideaAlready have itWork out firstTrap
  • (b)Invalid
    • Not IPv4256 > 255
    • Not IPv6full stops, too few groups
5 Now solve it have a go on paper first, then open the worked solution
  1. (a) Static: an IP address that does not change each time a device connects to the network B1; Public: assigned to a device to allow it to be visible on the internet B1
  2. (b) Invalid (no mark): not IPv4 because the maximum denary value is 255 and it uses 256 B1; not IPv6 because it uses full stops not colons // there are not enough groups B1
6 Check it does the answer make sense?

“A” could be a hex digit, but hex belongs to IPv6, which this can't be ✓.

Example 2 · IP address fill-in (Paper 1, 6 marks) ★ Easy
9618/12/M/J/25 Q6Paper 1 · Theory fundamentalsPart (c)6 marksFull size
(c) Devices that connect to the WAN have an IP address. Complete the description: IPv4 is displayed as four groups of 8-bit numbers separated by … . Each IPv4 address is 32 bits. IPv6 is made of eight groups of 4 … numbers separated by colons. Multiple consecutive groups of … can be replaced with a double colon. Each IPv6 address is … bits. A … IP address can change each time the computer connects to a network. A … IP address can only be accessed by other devices in the same LAN and is assigned by the router within the LAN. [6]
1 Read it with me what is actually happening?

Six gaps: four about format, two about types. Read the clue after each gap.

    2 What is it asking for? the target, part by part
    • (c)six words6
    3 What do we know? everything the question gives us
      4 Plan the route work backwards from what we want
      FindKey ideaAlready have itWork out firstTrap
        5 Now solve it have a go on paper first, then open the worked solution
        1. full stops
        2. hexadecimal
        3. zeros
        4. 128
        5. dynamic
        6. private B6
        6 Check it does the answer make sense?

        128 = 8 groups × 16 bits ✓.

        Example 3 · Subnetting benefits and reading subnet masks (Paper 1, 4 marks) ★★★ Hard
        9618/13/O/N/22 Q7Paper 1 · Theory fundamentalsPart (c)4 marksFull size
        (c) LANs can be made up of several subnetworks. (i) Give two benefits of dividing a network into subnetworks by subnetting the LAN. [2] (ii) Two devices are in different subnetworks: 10.10.12.1 with subnet mask 255.0.0.0, and 192.168.12.4 with subnet mask 255.255.255.0. Identify the network ID for the device with IP address 10.10.12.1, and the host ID for the device with IP address 192.168.12.4. [2]

        Why it is hard: most candidates had never applied a mask; the octet-by-octet line-up is all it takes.

        1 Read it with me what is actually happening?

        (ii): line the mask up with the address, octet by octet. 255 → that octet is network ID; 0 → host ID.

        • 255.0.0.0first octet network, last three host
        • 255.255.255.0first three network, last host
        2 What is it asking for? the target, part by part
        • (c)(i)two benefits of subnetting2
        • (c)(ii)network ID, host ID2
        3 What do we know? everything the question gives us
          4 Plan the route work backwards from what we want
          FindKey ideaAlready have itWork out firstTrap
          • (ii)
            • Device 1mask 255 only in octet 1 → network ID 10
            • Device 2mask 0 only in octet 4 → host ID 4
          Why is the network ID of 10.10.12.1 not 10.10?

          Only the first octet of its mask is 255.

          What did the report say?

          “A small number of correct answers … many need to improve their understanding of subnet masks.”

          5 Now solve it have a go on paper first, then open the worked solution
          1. (i) improves security B1; reduces congestion // allows extension of the network // aids day-to-day management // improves performance B1
          2. (ii) network ID of 10.10.12.1 = 10 B1
          3. host ID of 192.168.12.4 = 4 B1
          6 Check it does the answer make sense?

          10.10.12.1 AND 255.0.0.0 = 10.0.0.0 ✓; 192.168.12.4 has host part .4 under the 0 octet ✓.

          Example 4 · A router's public and private address; why subnet (Paper 1, 4 marks) ★★ Medium
          9618/13/O/N/24 Q9Paper 1 · Theory fundamentalsPart (d)4 marksFull size
          (d) The LAN has a router with a public IP address and a private IP address. (i) State the purpose of a public IP address and a private IP address. [2] (ii) The LAN uses subnetting. Describe the purpose of subnetting in a network. [2]
          1 Read it with me what is actually happening?

          (i): who each address is for. (ii): what subnetting does + one consequence.

            2 What is it asking for? the target, part by part
            • (d)(i)two purposes2
            • (d)(ii)purpose2
            3 What do we know? everything the question gives us
              4 Plan the route work backwards from what we want
              FindKey ideaAlready have itWork out firstTrap
                5 Now solve it have a go on paper first, then open the worked solution
                1. (i) Public: so that the router is visible to the internet / external network / WAN B1; private: so that the router is identified to the computers within the LAN B1
                2. (ii) Divides the network into smaller networks B1 … which reduces traffic / congestion because traffic only travels through the parts necessary // easier maintenance B1
                6 Check it does the answer make sense?

                ✓

                Summary

                • IPv4: 32 bits, 4 × 8-bit denary groups (0-255), full stops. IPv6: 128 bits, 8 × 16-bit hex groups, colons, “::” once for zero groups.
                • Public: visible on the internet. Private: within the LAN only, assigned by the router (more secure). Static: never changes. Dynamic: may change at each connection (DHCP).
                • Subnetting: network ID + host ID; mask 255 = network part, 0 = host part; less traffic, more security, easier management.
                If you see…do this
                “is this IPv4 / IPv6 / invalid?”check group count, value range, separator, digits
                a subnet mask255 octets → network ID; 0 octets → host ID
                “purpose of subnetting”divides network + consequence (traffic, security, management)
                public / private vs static / dynamicvisibility vs permanence: two separate ideas

                Can I do this?

                Anything unticked: revise that section first. All ticked: take the quiz.

                Quiz

                The multiple-choice and guided questions need JavaScript. The concept checks and exam practice below work without it.

                Concept checks

                Answer each one in your head first, then open it.

                1Why can two different homes both use 192.168.1.5?Show answer

                It is a private address: it only has to be unique inside each LAN. On the internet both homes appear as their routers' different public addresses.

                2Why does IPv6 use hexadecimal?Show answer

                128 bits in denary groups would be very long; each hex digit is exactly 4 bits, so 8 groups of 4 hex digits write it compactly.

                3Why must “::” appear only once?Show answer

                It stands for “as many zero groups as needed to make 8”; with two of them you couldn't tell how many zeros each one replaces.

                Exam-style practice

                New questions, not used above. Do them on paper, then mark your work against the official mark scheme.

                Q19618/12/M/J/21 Q5Paper 1 · Theory fundamentalsPart (d)4 marksFull size
                (d) Draw one line from each term (public, private, dynamic, static IP address) to its most appropriate description: only visible to devices within the LAN; increments by 1 each time the device connects; a new one is reallocated each time a device connects to the internet; can only be allocated to a router; visible to any device on the internet; does not change each time a device connects to the internet. [4]
                Show the mark scheme
                PartAnswer / workingMarksGuidance
                (d)Public → it is visible to any device on the internetB1
                Private → it is only visible to devices within the LANB1
                Dynamic → a new one is reallocated each time a device connects to the internetB1
                Static → it does not change each time a device connects to the internetB1
                Total: 4 marks
                Q29618/13/M/J/24 Q5Paper 1 · Theory fundamentalsPart (d)1 markFull size
                (d) The devices in the office have static private IP addresses. State what is meant by a static private IP address. [1]
                Show the mark scheme
                PartAnswer / workingMarksGuidance
                (d)Static: the IP for that device does not change; private: it can only be accessed / seen / used within the LANB1both ideas needed
                Total: 1 mark
                Q3Past-paper style3 marks

                A device has IP address 192.168.20.33 and subnet mask 255.255.255.0.

                1. (a)
                  State the network ID and the host ID.
                  [2]
                2. (b)
                  State whether 2001:db8::1::7 is a valid IPv6 address. Justify your answer.
                  [1]
                Show the mark scheme
                PartAnswer / workingMarksGuidance
                (a)Network ID: 192.168.20B1
                Host ID: 33B1
                (b)Invalid: “::” is used twice (it may only appear once)B1
                Total: 3 marks

                Your progress on this note is saved when JavaScript is on.