Based on the Linux Master 2 exam syllabusReport an error
192 . 168 . 0 . 10
└─┬┘ └─┬┘ └┬┘ └─┬┘
8 bits 8 bits 8 bits 8 bits = 32 bits
Each octet is 0 ~ 255Subnet calculation comes down to reading one 8-bit slot. Each position has a fixed value.
Place value 128 64 32 16 8 4 2 1
──────────────────────────────────────────────────
192 = 1 1 0 0 0 0 0 0 128 + 64
168 = 1 0 1 0 1 0 0 0 128 + 32 + 8
10 = 0 0 0 0 1 0 1 0 8 + 2
255 = 1 1 1 1 1 1 1 1 Add them all and you get 255| Class | First octet range | Default subnet mask | Notation | Use |
|---|---|---|---|---|
| A | 1 ~ 126 | 255.0.0.0 | /8 | Very large |
| B | 128 ~ 191 | 255.255.0.0 | /16 | Medium to large |
| C | 192 ~ 223 | 255.255.255.0 | /24 | Small |
| D | 224 ~ 239 | — | — | Multicast |
| E | 240 ~ 255 | — | — | Research |
192.168.0.1 starts with 192, so it is Class C.127.0.0.0/8 is reserved for loopback.| Class | Leading bits of first octet | Network / host bits | Hosts per network |
|---|---|---|---|
| A | 0 | 8 / 24 | 2²⁴ − 2 = 16,777,214 |
| B | 10 | 16 / 16 | 2¹⁶ − 2 = 65,534 |
| C | 110 | 24 / 8 | 2⁸ − 2 = 254 |
| D | 1110 | — | — |
0 the range is 0~127, if 10 it is 128~191, and if 110 it is 192~223. This interlocks directly with the 128, 64, 32 in the place-value table above.These are addresses used only inside an internal network, without going directly out to the Internet.
| Class | Private IP range |
|---|---|
| A | 10.0.0.0 ~ 10.255.255.255 |
| B | 172.16.0.0 ~ 172.31.255.255 |
| C | 192.168.0.0 ~ 192.168.255.255 |
192.168.x.x addresses handed out by a home or office router are exactly these.172.15.x.x and 172.32.x.x are public IPs. This range shows up as a trap.| Address | Meaning |
|---|---|
| 127.0.0.1 | Loopback — yourself (localhost) |
| 0.0.0.0 | All addresses / unspecified |
| All host bits are 0 | Network address |
| All host bits are 1 | Broadcast address |
| Sending method | Receivers | Example |
|---|---|---|
| Unicast | One | Ordinary one-to-one communication |
| Broadcast | Everyone on the same network | 192.168.0.255 |
| Multicast | A subset group that signed up | Class D 224.0.0.0 ~ 239.255.255.255 |
127.0.0.1; the entire range starting with 127 is reserved. By convention, 127.0.0.1 is the one used. 192.168.0.0 ← Host part is all 0s = network address
192.168.0.1 ┐
… ├─ Addresses that can actually be given to computers
192.168.0.254 ┘
192.168.0.255 ← Host part is all 1s = broadcast address2ⁿ − 2 (n = number of host bits). 1 Look at the last octet of the mask e.g.) 255.255.255.192 → 192
2 Subtract it from 256 256 − 192 = 64 ← block size
3 Subtract 2 64 − 2 = 62 ← number of usable hosts| Mask | Notation | Block size | Usable hosts | Number of subnets |
|---|---|---|---|---|
| 255.255.255.0 | /24 | 256 | 254 | 1 |
| 255.255.255.128 | /25 | 128 | 126 | 2 |
| 255.255.255.192 | /26 | 64 | 62 | 4 |
| 255.255.255.224 | /27 | 32 | 30 | 8 |
| 255.255.255.240 | /28 | 16 | 14 | 16 |
| 255.255.255.248 | /29 | 8 | 6 | 32 |
| 255.255.255.252 | /30 | 4 | 2 | 64 |
254 · 126 · 62 · 30 · 14 · 6 · 2 — memorize this row of numbers and you can answer immediately without calculating. It is the pattern of halving each time, with −2 attached.
Question In a Class C network with subnet mask
255.255.255.192, how many host IPs can be used in one subnet?
256 − 192 = 64 size of one block
64 − 2 = 62 the count after removing the network and broadcast addresses
Answer: 62Question What if the subnet mask is
255.255.255.224?
256 − 224 = 32
32 − 2 = 30 Answer: 30/26, 256 ÷ 64 = 4 subnets.Questions also ask not just the host count but "what are the network address and broadcast address of the network this IP belongs to?" Draw a table cut every block size and you are done. Applying /26 (block 64) to 192.168.10.0 splits it into four like this.
| Subnet | Network address | Usable hosts | Broadcast address |
|---|---|---|---|
| 1 | 192.168.10.0 | .1 ~ .62 | 192.168.10.63 |
| 2 | 192.168.10.64 | .65 ~ .126 | 192.168.10.127 |
| 3 | 192.168.10.128 | .129 ~ .190 | 192.168.10.191 |
| 4 | 192.168.10.192 | .193 ~ .254 | 192.168.10.255 |
Which subnet does 192.168.10.100 / 26 belong to
1 Block size 256 − 192 = 64
2 Draw boundaries 0 · 64 · 128 · 192
3 The slot that 100 falls into is 64 ~ 127
─────────────────────────────────────────
Network address 192.168.10.64
Broadcast address 192.168.10.127
Host range 192.168.10.65 ~ 192.168.10.126 (62 hosts)| Given value | Block | Network address | Broadcast | Host range |
|---|---|---|---|---|
| 192.168.10.77 /27 | 32 | .64 | .95 | .65 ~ .94 (30 hosts) |
| 192.168.10.200 /28 | 16 | .192 | .207 | .193 ~ .206 (14 hosts) |
| 192.168.10.130 /25 | 128 | .128 | .255 | .129 ~ .254 (126 hosts) |
.65 ~ .94, 94 − 65 + 1 = 30, which matches the 30 in the table.01100100 and 192 is 11000000; keeping only the places where both are 1 gives 01000000 = 64. This is how computers find the network address.| Requirement | Order of thinking | Answer |
|---|---|---|
| A subnet to hold 50 hosts | Add 2 to get 52 → the smallest block that holds it is 64 | 255.255.255.192 (/26) |
| 30 hosts | 32 → block 32, an exact fit | 255.255.255.224 (/27) |
| 31 hosts | 33 → 32 is not enough, so block 64 | 255.255.255.192 (/26) |
| Divide into 5 or more subnets | 4 is not enough, so 8 → block is 256 ÷ 8 = 32 | 255.255.255.224 (/27) |
/26, it is 4 subnets, 62 hosts per subnet./ notation convert by the number of 1s. 255.255.255.192 is 8 + 8 + 8 + 2 = /26, and in reverse /28 is 24 + 4, so the last octet has four 1s = 240.| Last octet | Binary | Borrowed bits |
|---|---|---|
| 0 | 00000000 | 0 |
| 128 | 10000000 | 1 |
| 192 | 11000000 | 2 |
| 224 | 11100000 | 3 |
| 240 | 11110000 | 4 |
| 248 | 11111000 | 5 |
| 252 | 11111100 | 6 |
255.255.255.100 cannot exist. Choices like this show up as wrong answers.| Item | IPv4 | IPv6 |
|---|---|---|
| Length | 32 bits | 128 bits |
| Notation | Dotted decimal | Colon-separated hexadecimal |
| Example | 192.168.0.1 | 2001:0db8::1 |
| Item | IPv4 | IPv6 |
|---|---|---|
| Grouping | 4 groups of 8 bits | 8 groups of 16 bits |
| Separator | Dot (.) | Colon (:) |
| Number base | Decimal | Hexadecimal |
| Address types | Unicast · broadcast · multicast | Unicast · anycast · multicast |
| Loopback | 127.0.0.1 | ::1 |
2001:0db8:0000:0000:0000:0000:0000:0001 16 bits × 8 groups = 128 bits
2001:db8:0:0:0:0:0:1 Leading zeros in each group are omitted
2001:db8::1 Consecutive all-zero groups are collapsed with :: in one go:: can be used only once in an address. If it were used twice, there would be no way to tell how many groups of zeros each one stands for.Tomorrow we cover the commands for actually configuring and checking these addresses on Linux.
/24.Click a choice to reveal the answer and explanation.
Question 1
In a Class C network with subnet mask 255.255.255.192, which of the following is the number of host IPs usable in one subnet?
Question 2
Which of the following is the address type that the IP address 172.20.10.5 belongs to?
Question 3
Which of the following is the class that the IP address 200.100.50.1 belongs to?
Question 4
Which of the following values can not be used as a subnet mask?
Question 5
Which of the following is the length of an IPv6 address?