0
$\begingroup$

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?

$\endgroup$
1
  • $\begingroup$ 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$. $\endgroup$
    – Steven
    Jul 19, 2021 at 21:23

1 Answer 1

0
$\begingroup$

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.

An IP address as such does not need to have a mask. If you also specify a mask you are adding more information than the simple address: you are also splitting the address space into the network prefix and the host identifier. In your case the notation 130.149.0.0/16 is not representing the address of a single host but rather the addresses allocated to network. This is telling you that (i) the first 16 bits are part of the network prefix, and (ii) these bits are exactly those represented by the two octets 130 and 149 (here 16 is a multiple of 8 so the prefix is exactly an even number of octets).

$\endgroup$
2
  • 1
    $\begingroup$ "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? $\endgroup$
    – idmean
    Jul 19, 2021 at 21:21
  • $\begingroup$ It should definitely be $2^4=16$, I just had a brain fart while typing. Thanks for spotting that. $\endgroup$
    – Steven
    Jul 19, 2021 at 21:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.