IP addresses and subnets with slash notation

262 views

So I was adding IP address ranges to AWS and ones I was adding had `/20` and `/16` on them. I realise this has an effect on the range, but I don’t understand what effect.

Part of the IP address stays the same and the other part(s) don’t.

Can someone explain what this means?

In: 9

4 Answers

Anonymous 0 Comments

The subnet mask tells the computer what part of the IP address denotes the network and what part of the IP address denotes the host. This allows it to easily distinguish (and appropriately label) messages intended for computers on the same network (which don’t need to be routed) and messages intended for computers on a different network (which do).

Since an IP address is simply a series of 32 bits, the easiest way to do this is to simply say the first X bits represent the network part and the remaining bits represent the host. When the subnet mask is written in slash notation, the number is X (the number of bits that represent the network).

So a /20 mask says the first 20 bits are the network and the remaining 12 bits represent the hosts. A /16 mask says the first 16 bits are the network and the remaining 16 bits represent the hosts. This effects the range because the more/fewer bits you have to represent hosts, the more/fewer hosts you can have on a network in that range.

With a /20 network and 12 bits for hosts, you can only have 2^(12) = 4,096^(*) hosts but with a /16 network and 16 bits for hosts you can have 2^(16) = 65,536^(*) hosts. Within each of those networks the first 20 and 16 bits of the IP address will stay the same, respectively.

^(* – the first and last IP addresses in the host range of a network are reserved and cannot be used for hosts, so it’s technically 4,094 and 65,534 hosts.)

You are viewing 1 out of 4 answers, click here to view all answers.