Networking: Devices, Topologies & Protocols
🔒 Log in to trackIP addressing: IPv4 classes and IPv6
🔒 Log in to trackAn IPv4 address has 32 bits, written as four numbers from 0 to 255. The first number decides the class. IPv6 has 128 bits, written in hexadecimal with colons. 127.0.0.1 is loopback, and 192.168.x.x is a private range.
IPv4, the 32-bit address
An IPv4 address has 32 bits. It is written as four numbers from 0 to 255 with dots, like 192.168.1.1. Each number is an octet (8 bits). The first octet decides the class.
| Class | First octet | Default mask | Hosts per network | Use |
|---|---|---|---|---|
| A | 1 - 126 | 255.0.0.0 (/8) | 1,67,77,214 | huge networks |
| B | 128 - 191 | 255.255.0.0 (/16) | 65,534 | large organisations |
| C | 192 - 223 | 255.255.255.0 (/24) | 254 | small networks |
| D | 224 - 239 | none | none | multicasting |
| E | 240 - 255 | none | none | experimental or research |
Tip: Anchor the ruler at 1, 128, 192, 224 and 240. Drop the given number between them.
Usable hosts
Two addresses in each network are reserved: the network address and the broadcast address.
Example: Class C has 256 addresses. Take away 2. That leaves 254 usable hosts.
Special addresses
- 127.0.0.1 is loopback or localhost. A machine talks to itself. Pinging it tests your own TCP/IP stack.
- 0.0.0.0 is the unspecified address.
- 255.255.255.255 is the broadcast address.
- Private ranges are not routed on the Internet: 10.0.0.0/8, 172.16.0.0 to 172.31.255.255, and 192.168.0.0/16.
Watch: 127 is not a Class A network. Class A ends at 126. Home routers use 192.168.x.x, which is private.
IPv6, the 128-bit address
IPv4 has about 4.3 billion addresses. That is too few for the connected world. IPv6 uses 128 bits. It is written as eight groups of hexadecimal digits with colons, for example 2001:0db8::7334. A double colon can shorten a run of zeros.
MAC and IP compared
| MAC address | IP address | |
|---|---|---|
| Type | physical, burnt into the NIC | logical, assigned |
| Size | 48 bits | IPv4 32 bits, IPv6 128 bits |
| Changes | never | changes with the network |
| Used by | switches (layer 2) | routers (layer 3) |
DHCP gives IP addresses automatically. A static address is set by hand.
Worked class checks
Cover everything after the first dot. Look at the first octet only.
| Address | First octet | Class |
|---|---|---|
| 10.0.0.5 | 10 | A |
| 130.10.5.2 | 130 | B |
| 196.1.2.3 | 196 | C |
| 225.5.4.1 | 225 | D (multicast) |
| 245.0.0.1 | 245 | E |
Rule: 127.x.x.x is never a Class A host address. It is loopback.
Checking a private address
A private address starts with 10, or with 172 and a second number from 16 to 31, or with 192.168. A 172 address with second number 32 or more is public.
Question types you will see
Each type: how to recognise it, the method step by step, and one question to try.
IP class identification
An address is given (10.0.0.5, 130.10.5.2, 196.1.2.3, 225.5.4.1) and its class is asked, or the range of a class is asked.
Read only the first octet.
1-126 is A, 128-191 is B, 192-223 is C.
224-239 is D (multicast). 240-255 is E.
Treat 127 as loopback, not Class A.
The first octet alone fixes the class.
The IP address 196.20.5.1 belongs to which class?
Show solutionHide solution
The first octet is 196.
196 lies between 192 and 223.
Class C
Private ranges and loopback
Which is a private IP address, what is 127.0.0.1, or which address is reserved for testing or localhost.
Private: 10.x.x.x, 172.16 to 172.31.x.x, 192.168.x.x.
Home routers use 192.168.x.x.
127.0.0.1 is loopback (localhost).
169.254.x.x appears when automatic addressing fails (APIPA).
Private and loopback ranges are reserved and never routed on the Internet.
The address 127.0.0.1 is used for
Show solutionHide solution
127 is the reserved loopback block.
The computer talks to itself.
Loopback testing (localhost)
IPv4 vs IPv6 facts
IPv4 has how many bits, IPv6 is written in what form, how many groups in an IPv6 address, or why IPv6 was needed.
IPv4: 32 bits, four decimal octets, about 4.3 billion addresses.
IPv6: 128 bits, eight hexadecimal groups with colons.
IPv6 was needed because IPv4 addresses ran out.
More bits mean a far larger address space.
An IPv6 address is how many bits long?
Show solutionHide solution
IPv6 has eight groups.
Eight groups of 16 bits make 128 bits.
128 bits
MAC vs IP and usable-host counts
Difference between MAC and IP, how many hosts a Class C network can have, or which address changes when you move networks.
MAC: 48-bit, physical, permanent.
IP: logical, assigned, changes with the network.
Class C: 256 - 2 = 254 usable hosts.
Class B: 65,534. Class A: 1,67,77,214.
Two addresses in every network are reserved.
How many usable host addresses does a Class C network provide?
Show solutionHide solution
Class C has 256 addresses.
Take away the network and broadcast addresses: 254.
254
Default masks and special addresses
The default mask of a class, the broadcast address, or the unspecified address.
Class A: 255.0.0.0 (/8). Class B: 255.255.0.0 (/16).
Class C: 255.255.255.0 (/24).
0.0.0.0 is unspecified.
255.255.255.255 is the broadcast address.
The mask shows how many leading bits name the network.
What is the default subnet mask of a Class B network?
Show solutionHide solution
Class B has a /16 prefix.
Two full octets of 255.
255.255.0.0
DHCP and static addressing
Which protocol assigns IP addresses automatically, or how static addressing differs from it.
DHCP gives IP addresses automatically.
Static addressing sets them by hand.
DHCP uses ports 67 and 68.
Automatic assignment saves manual setup.
Which protocol assigns IP addresses automatically to devices?
Show solutionHide solution
Automatic assignment is the job of DHCP.
Its full form is Dynamic Host Configuration Protocol.
DHCP
Shortcuts that save time
Remember the cut-points 1, 128, 192, 224, 240. A starts at 1, B at 128, C at 192, D (multicast) at 224, E at 240. The number 127 is loopback, between A and B.
What is the class of 172.16.0.1?
Show solutionHide solution
Read only the first octet: 172.
172 lies in 128 to 191.
Class B
127.0.0.1 is localhost. Pinging it tests your own TCP/IP stack, not the cable. Any question with 127.x wants loopback.
Pinging 127.0.0.1 tests what?
Show solutionHide solution
127.0.0.1 is the machine itself.
It never leaves the computer.
The local machine's own TCP/IP setup
IPv4 is 32 bits in dotted decimal. IPv6 is 128 bits in colon-separated hexadecimal. If addresses are running out, IPv6 is the fix.
How many bits does an IPv6 address have?
Show solutionHide solution
IPv4 has 32 bits.
IPv6 has 128 bits.
128
Mistakes to avoid
Where most students lose marks on this subtopic.
Calling 127.0.0.1 a Class A host address.
127 is reserved for loopback. Class A networks end at 126.
Calling 192.168.1.1 a public address.
It is the classic private home-router address.
Confusing the MAC address with the IP address.
MAC is 48-bit, physical and burnt in. IP is logical and assigned.
Reading the whole address to find the class.
Only the first octet decides the class.
Giving all 256 addresses of Class C as usable hosts.
Two are reserved, so 254 are usable.
Quick revision
Read this the night before the exam.
IPv4 has 32 bits in four octets from 0 to 255. IPv6 has 128 bits in hexadecimal with colons.
Classes by first octet: A 1-126, B 128-191, C 192-223, D 224-239, E 240-255.
127.0.0.1 is loopback.
Private ranges: 10.x, 172.16 to 172.31.x, 192.168.x.
A Class C network has 254 usable hosts.
MAC is 48-bit and physical. IP is logical.
DHCP gives IP addresses automatically.
Practice: 16 questions
Sets of 10, mixed across the question types above. Every answer has a step-by-step explanation.
Topic test · 10 questions
Suggested time 5 min · wrong answers go to your mistake notebook automatically.