AQA 7517, section 4.9.4.3
An IP address identifies a device on a network, so that packets can be delivered to it. Every device that communicates using TCP/IP needs one.
The structure of an IPv4 address
An IPv4 address is 32 bits long. For readability, it is split into four 8-bit groups (called octets or bytes), each written as a decimal number from 0 to 255, separated by dots. This is dotted decimal notation.
So 192.168.1.25 stands for the 32-bit number 11000000 10101000 00000001 00011001.
Each octet can be from (0) to (255), which is why no part of an IPv4 address is larger than 255.
Two parts: network and host
An IP address is split into two parts.
| Part | What it identifies |
|---|---|
| Network identifier (network ID) | Which network the device is on |
| Host identifier (host ID) | Which device (host) within that network |
All devices on the same network share the same network identifier, and each has a different host identifier. It works like a postal address: the street name (network) is the same for all houses on the street, and the house number (host) is different for each.
Example: 192.168.1.25, where the first three octets are the network part.
Another device on the same network might be 192.168.1.30. It has the same network ID (192.168.1) but a different host ID (30). A device at 192.168.2.25 is on a different network.
Why split the address?
- Routing: routers only need to look at the network part to decide where to send a packet. They don't need a route for every single host, which keeps routing tables small.
- Delivery: once the packet reaches the right network, the host part tells the final router which device should receive it.
- Is it local? A device compares the destination's network ID with its own. If they match, the destination is on the same local network, and the packet is sent directly. If not, it is sent to the default gateway (the router) to go elsewhere.
Where is the split?
The dividing line isn't always in the same place. It can come after the first, second, third or any other bit, depending on the size of the network. A subnet mask shows where it is (see 4.9.4.4).
| Network part | Host part | Number of hosts |
|---|---|---|
| First 8 bits | Last 24 bits | Over 16 million |
| First 16 bits | Last 16 bits | 65 534 |
| First 24 bits | Last 8 bits | 254 |
The more bits in the host part, the more devices the network can hold, and the fewer bits in the network part, the fewer networks.
Special addresses
Within a network, two host values are reserved, so a network with host bits has usable addresses:
- All host bits 0: the network address itself (such as 192.168.1.0).
- All host bits 1: the broadcast address, used to send to every device on the network (such as 192.168.1.255).
Worked example
Task: for the address 172.16.5.40 with the first 16 bits as the network part, give the network ID, the host ID, and decide whether 172.16.9.1 is on the same network.
- Network ID: the first two octets, 172.16.
- Host ID: the last two octets, 5.40.
172.16.9.1has the network ID 172.16, which is the same, so it is on the same network (with host ID 9.1).
If the first 24 bits were the network part instead, 172.16.5 and 172.16.9 would differ, so the two devices would be on different networks. The position of the split matters.
Exam tip: state that an IP address is split into a network identifier and a host identifier, and give the reason: routers use the network part to route, and the host part to identify the individual device.
Check yourself
How many bits are there in an IPv4 address, and why is no part larger than 255?
32 bits, in four 8-bit groups. The largest 8-bit value is .
What are the two parts of an IP address?
The network identifier (which network) and the host identifier (which device on that network).
Why do routers use only the network part of the address?
It keeps routing tables small, as a router needs one entry for each network and not for every device, and it can send the packet towards the correct network.