# How many /20-subnets are in the network 130.149.0.0/16?

I'm new to networking so please bear with me. My textbook gives 4 as an answer, but I'm not sure I understand the question:

1. What's a "/20-subnet"? My understanding is that a network mask (/20) is used to give structure to a classless IP-address, i.e provide a way to distinguish network bits from host bits. In this case the network mask is 11111111.11111111.11110000.00000000, so we could use 12 bits for hosts and subnets.

2. Why should a network address (in this case 130.149.0.0) have a mask? We know that the last 16 bits are 0's and can be used for hosts and subnets. What does the mask (/16) mean here?

I'm not sure how they arrived at the solution (4 bits). Can you please explain this to me?

• I'm not sure why the answer is $4$. It should be $16$. Late in your question you say that the answer is $4$ bits but it doesn't make sense for the answer to be expressed in bits (it should be a pure number). However, the number of bits available for your /20 subnetworks within a /16 network is $4$, and hence the number of subnetworks is $2^4=16$. Jul 19, 2021 at 21:23

A network mask of /16 means that $$16$$ of the $$32$$ bits (since we are using IPv4) are the common prefix used for the network, while the remaining $$32-16=16$$ (least-significant) bits are used to address to hosts in the network. This allows for $$2^{16}$$ different host addresses.
Similarly, a network mask of /20 fixes the first $$20$$ bits and leaves $$30-20=12$$ bits for the hosts in the subnetwork. This allows for $$2^{12}$$ addresses in the subnetwork.
Since we had $$2^{20}$$ addresses available in our /20 network, we can only create $$\frac{2^{16}}{2^{12}} = 2^4 = 16$$ subnetworks with netmask /16.
Alternatively you can arrive at the answer as follows: we have $$16$$ free bits to address to hosts in our network but we are allocating the $$12$$ least significant bits to the host of our subnetworks. This leaves us $$16-12=4$$ bits to address our subnetworks. With $$4$$ bits we can create $$2^{4}=16$$ distinct subnetworks.
• "With 4 bits we can create $2^{16} = 4$ distinct subnetworks." Can you explain what you mean by this? Shouldn't it be $2^4 = 16$ subnetworks then? Jul 19, 2021 at 21:21
• It should definitely be $2^4=16$, I just had a brain fart while typing. Thanks for spotting that. Jul 19, 2021 at 21:25