CIE AS & A Level Computer Science, section 2.1 (Networks including the internet)
What an IP address is
An IP (Internet Protocol) address is a unique number that identifies a device on a network, so that packets can be delivered to it.
IPv4 and IPv6
| IPv4 | IPv6 | |
|---|---|---|
| Size | 32 bits | 128 bits |
| Written as | four numbers 0 to 255 separated by dots, e.g. 192.168.1.10 |
eight groups of 4 hex digits separated by colons, e.g. 2001:0db8:0000:0000:0000:0000:0000:0001 |
| Number of addresses | billion | (vastly more) |
IPv6 was introduced because IPv4 addresses are running out.
Subnetting
An address has two parts: the network ID (which network) and the host ID (which device). A subnet mask shows which bits are the network ID. Subnetting divides a network into smaller subnetworks, which can reduce traffic and improve security and management.
For 192.168.1.10 with mask 255.255.255.0, ANDing the address with the mask gives the network ID 192.168.1.0.
Public and private
- A public IP address is unique on the internet and can be reached from outside.
- A private IP address is used inside a LAN (ranges such as
192.168.x.x) and is not routed on the internet. A router uses NAT to share one public address. Private addresses give better security, because devices are not directly reachable.
Static and dynamic
- Static: the address is fixed and never changes. Used for web servers and printers.
- Dynamic: the address is assigned temporarily by a DHCP server and may change. Cheaper and easier to manage.
Common mistake: saying an IPv4 address has "4 bytes written as 4 digits". Each of the four numbers is 0 to 255, which is 8 bits. Also, a private address is not "hidden": it simply cannot be routed on the internet.
Exam tip: know the sizes (32 and 128 bits) and an example format of each. When explaining subnetting, mention the network ID, host ID and subnet mask. Give a reason for choosing static (servers) or dynamic (home devices).
Check yourself
How many bits does an IPv6 address have?
Give one difference between a public and a private IP address.
A public address is unique on the internet and reachable from outside, while a private address is only used inside a LAN.
Why does a web server usually have a static IP address?
Its address must not change, so that users and DNS records can always find it.