Find Host with Subnet ID and Subnet Mask

Francis Edward del Rosario
2 min readJul 10, 2021

Given:

Subnet ID = 198.200.100.240
Subnet Mask = /30

Find:

  1. The network class
  2. First host IP address
  3. Last host IP address
  4. Broadcast IP address

Solution steps:

  1. Determine the first octet of Subnet ID
  2. Determine class using the first octet
  3. Given CIDR notation /n, represent subnet mask bits
  4. Determine octet of interest (OOI) and its value
  5. Determine magic number
  6. Add 1 to subnet ID to get the first IP address
  7. Add the magic number to OOI subnet ID to get the next subnet ID
  8. Subtract 1 from the next subnet ID to get the previous subnet ID’s broadcast IP
  9. Subtract 1 from the broadcast IP to get the previous subnet ID’s last host IP address

Detailed solution:

1. Determine the first octet of Subnet ID = 198

2. Determine Class using the first octet:

A = 0–127

B = 128–191

C = 192–223

198 is between 192 and 223, therefore Class C

3. Determine Subnet Mask in CIDR notation /30:

a. /30 notation means 30 network bits are turned on and contiguous

111111111111111111111111111111

b. IP address consists of 4 octets, 32 bits

/32 bits = /n of network bit + /n of host bits

Host bits = /32 — /n of network bit

= /32 — /30

= /2

Takeaway: A subnet mask is a 32-bit address, since we have 30 bits of network bits, we can assume 2 bits are allotted for the host

Subnet Mask in bits:

11111111111111111111111111111100

c. Group the Subnet Mask into 4 groups

11111111. 11111111. 11111111. 11111100

d. Convert binary bits into decimal

255. 255. 255. 252

4. Determine octet of interest (OOI) and its value

The octet interest is where the last network bit is located

11111111. 11111111. 11111111. 11111100

The last network bit is in the 4th octet

OOI = 4th octet

4th octet decimal value = 252

5. Determine the magic number

Magic number = 256 — OOI decimal value

= 256–252

= 4

6. Add 1 to subnet ID to get the first IP address

198. 200. 100. 240

+1

198. 200. 100. 241 First Host IP

7. Add the magic number to the subnet’s octet of interest to get the next subnet ID 198. 200. 100. 240

+4

198. 200. 100. 244 is the next Subnet ID

8. Subtract 1 from the next subnet ID to get the broadcast IP

198. 200. 100. 244 Next Subnet ID

-1

198. 200. 100. 243 Broadcast IP

9. Subtract 1 from the broadcast IP to get the last host IP address

198. 200. 100. 243 Broadcast IP

-1

198. 200. 100. 242 Last Host IP

Answers:

Class = C

First IP address = 198.200.100.241

Last IP address = 198.200.100.242

Broadcast address = 198.200.100.243

--

--