# Subnetting Interview Questions
## What is a subnet mask
A subnet mask is a 32-bit number that separates the network portion of an IP address from the host portion. All network bits are set to 1 and all host bits are set to 0. The subnet mask 255.255.255.0 means the first 24 bits are the network and the last 8 bits are for hosts.
## What is CIDR notation
CIDR notation represents the subnet mask as a prefix length after a slash. For example 192.168.1.0/24 means the first 24 bits are the network portion. The slash 24 is equivalent to the subnet mask 255.255.255.0.
## How many hosts can a /24 network support
A /24 network has 8 host bits. Two to the power of 8 is 256 total addresses. Subtract 2 for the network address and broadcast address. A /24 network supports 254 usable host addresses.
## How do you find the network address of a host
To find the network address perform a bitwise AND operation between the IP address and the subnet mask. For example for IP 192.168.1.50 with mask 255.255.255.0, AND the two values and you get 192.168.1.0 which is the network address.
## What is the broadcast address of 192.168.1.0/24
The broadcast address is found by setting all host bits to 1. For 192.168.1.0/24 the host portion is the last octet. Setting all 8 bits to 1 gives 255. So the broadcast address is 192.168.1.255.
## How many subnets and hosts does /26 give
A /26 borrows 2 bits from a /24 network. Two to the power of 2 gives 4 subnets. The remaining 6 bits are host bits. Two to the power of 6 is 64 total addresses per subnet. Subtract 2 for network and broadcast. Each subnet has 62 usable hosts.
## What are the four subnets of 192.168.1.0/26
The block size is 256 minus 192 which equals 64. The four subnets are 192.168.1.0/26 with hosts .1 to .62, then 192.168.1.64/26 with hosts .65 to .126, then 192.168.1.128/26 with hosts .129 to .190, and finally 192.168.1.192/26 with hosts .193 to .254.
## What subnet does 172.16.10.75/28 belong to
A /28 has 4 bits for hosts. The block size is 256 minus 240 which equals 16. Divide 75 by 16 to get 4 with remainder 11. Multiply 4 by 16 to get 64. So the subnet is 172.16.10.64/28. The usable hosts are .65 to .78 and the broadcast is .79.
## What is VLSM
VLSM stands for Variable Length Subnet Masking. It allows different subnets within the same network to use different subnet masks. This allows efficient use of IP addresses by allocating only as many addresses as each subnet needs. For example a subnet needing 100 hosts can use /25 and a subnet needing 5 hosts can use /29 within the same larger network.
## How many /28 subnets can you get from a /24 network
A /24 has 24 network bits and 8 host bits. A /28 has 28 network bits. The difference is 4 bits. Two to the power of 4 gives 16 subnets. Each /28 subnet has 14 usable hosts.
## What is the subnet mask for /20
A /20 means 20 bits are the network portion. The first two octets are all ones giving 255.255. In the third octet the first 4 bits are 1 and the last 4 are 0 giving 11110000 in binary which is 240 in decimal. The fourth octet is all zeros giving 0. So /20 is 255.255.240.0.
## What is supernetting
Supernetting is the process of combining multiple smaller networks into a single larger network for routing purposes. It reduces the number of entries in routing tables. For example the four networks 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, and 192.168.3.0/24 can be summarized as 192.168.0.0/22.
## What is the difference between a network address and a host address
A network address has all host bits set to zero. It identifies the network itself and cannot be assigned to a device. A host address has at least one host bit set to 1 and can be assigned to a device. The broadcast address has all host bits set to 1 and is used to send data to all hosts on the subnet.
## How do you calculate the number of usable hosts in a subnet
The number of usable hosts is calculated as two to the power of h minus 2, where h is the number of host bits. Two is subtracted for the network address and the broadcast address which cannot be assigned to hosts.
## What private IP address ranges exist
The three private IP address ranges are 10.0.0.0 to 10.255.255.255 which is a /8 block, 172.16.0.0 to 172.31.255.255 which is a /12 block, and 192.168.0.0 to 192.168.255.255 which is a /16 block. These addresses are not routable on the public internet.Back to Subject