IP Subnetting

Performing IP Subnetting is part art and mostly science (at least maths).  You need somewhere to start and an understanding of what and how you are going to break up the address space, that is the art part, the science comes with calculating out all the address break points.

For a reference on how to do IP address subnetting, check out IP Addressing and Subnetting for New Users

These are tables to help in the understanding and generation of VLSM (Variable Length Subnet Masks) networks and CIDR (Classless Inter Domain Routing) which is what the Internet currently uses to route packets on the Internet Backbone.  It makes it possible to represent the millions of networks which form the Internet to be represented by less than 100,000 routes.

For a WAN link you would use 255.255.255.252, which would give you for example 203.8.7.248 for a subnet address and 203.8.7.249 and 203.8.7.250 for each end and 203.8.7.251 as the broadcast address. The next subnet would be 203.8.7.252.

To calculate the number of address in a subnet mask you would subtract the final byte from 255 and add 1, ie 255 - 252 + 1 = 4 which is the number of address for that subnet mask. The reason for adding one is because the numbering range is 0 to 255 which actually gives you 256, hence the add 1. This works for all masks to. Then you get to reverse bit masking too. I have been meaning to write some simple rules to help with this but have been quite busy.

IP Subnet Mask, Bits and Wildcard for CIDR (Classless Inter Domain Routing) Addressing

A handy table to translate the subnet mask to the number of bits and the wildcard for OSPF and ACL's and Firewalls.

Subnet Mask Bits Wildcard Mask
255.0.0.0 8 0.255.255.255
255.128.0.0 9 0.127.255.255
255.192.0.0 10 0.63.255.255
255.224.0.0 11 0.31.255.255
255.240.0.0 12 0.15.255.255
255.248.0.0 13 0.7.255.255
255.252.0.0 14 0.3.255.255
255.254.0.0 15 0.1.255.255
255.255.0.0 16 0.0.255.255
255.255.128.0 17 0.0.127.255
255.255.192.0 18 0.0.63.255
255.255.224.0 19 0.0.31.255
255.255.240.0 20 0.0.15.255
255.255.248.0 21 0.0.7.255
255.255.252.0 22 0.0.3.255
255.255.254.0 23 0.0.1.255
255.255.255.0 24 0.0.0.255
255.255.255.128 25 0.0.0.127
255.255.255.192 26 0.0.0.63
255.255.255.224 27 0.0.0.31
255.255.255.240 28 0.0.0.15
255.255.255.248 29 0.0.0.7
255.255.255.252 30 0.0.0.3
255.255.255.254 31 0.0.0.1
255.255.255.255 32 0.0.0.0

IP Subnetting Breakpoints

This table pretty much makes IP subnetting easy, once you get your head around it.

Subnet Mask Subnet No. Subnet Address Address Range B'dcast Address
192 0 0 1-62 63
  1 64 65-126 127
  2 128 129-190 191
  3 192 193-254 255
224 0 0 1-30 31
  1 32 33-62 63
  2 64 65-94 95
  3 96 97-126 127
  4 128 129-158 159
  5 160 161-190 191
  6 192 193-222 223
  7 224 225-254 255
240 0 0 1-14 15
  1 16 17-30 31
  2 32 33-46 47
  3 48 49-62 63
  4 64 65-78 79
  5 80 81-94 95
  6 96 97-110 111
  7 112 113-126 127
  8 128 129-142 143
  9 144 145-158 159
  10 160 161-174 175
  11 176 177-190 191
  12 192 193-206 207
  13 208 209-222 223
  14 224 225-238 239
  15 240 241-254 255
248 0 0 1-6 7
  1 8 9-14 15
  2 16 17-22 23
  3 24 25-30 31
  4 32 33-38 39
  5 40 41-46 47
  6 48 49-54 55
  7 56 57-62 63
  8 64 65-70 71
  9 72 73-78 79
  10 80 81-86 87
  11 88 89-94 95
  12 96 97-102 103
  13 104 105-110 111
  14 112 113-118 119
  15 120 121-126 127
  16 128 129-134 135
  17 136 137-142 143
  18 144 145-150 151
  19 152 153-158 159
  20 160 161-166 167
  21 168 169-174 175
  22 176 177-182 183
  23 184 185-190 191
  24 192 193-198 199
  25 200 201-206 207
  26 208 209-214 215
  27 216 217-222 223
  28 224 225-230 231
  29 232 233-238 239
  30 240 241-246 247
  31 248 249-254 255
252 0 0 1-2 3
  1 4 5-6 7
  2 8 9-10 11
  3 12 13-14 15
  4 16 17-18 19
  5 20 21-22 23
  6 24 25-26 27
  7 28 29-30 31
  8 32 33-34 35
  9 36 37-38 39
  10 40 41-42 43
  11 44 45-46 47
  12 48 49-50 51
  13 52 53-54 55
  14 56 57-58 59
  15 60 61-62 63
  16 64 65-66 67
  17 68 69-70 71
  18 72 73-74 75
  19 76 77-78 79
  20 80 81-82 83
  21 84 85-86 87
  22 88 89-90 91
  23 92 93-94 95
  24 96 97-98 99
  25 100 101-102 103
  26 104 105-106 107
  27 108 109-110 111
  28 112 113-114 115
  29 116 117-118 119
  30 120 121-122 123
  31 124 125-126 127
  32 128 129-130 131
  33 132 133-134 135
  34 136 137-138 139
  35 140 141-142 143
  36 144 145-146 147
  37 148 149-150 151
  38 152 153-154 155
  39 156 157-158 159
  40 160 161-162 163
  41 164 165-166 167
  42 168 169-170 171
  43 172 173-174 175
  44 176 177-178 179
  45 180 181-182 183
  46 184 185-186 187
  47 188 189-190 191
  48 192 193-194 195
  49 196 197-198 199
  50 200 201-202 203
  51 204 205-206 207
  52 208 209-210 211
  53 212 213-214 215
  54 216 217-218 219
  55 220 221-222 223
  56 224 225-226 227
  57 228 229-230 231
  58 232 233-234 235
  59 236 237-238 239
  60 240 241-242 243
  61 244 245-246 247
  62 248 249-250 251
  63 252 253-254 255

 

IP Addressing History

The following tables are not really relevant any more, if anyone says to you, thats a Class C address, the correct response is, not that is a 24 bit address.  If they want to argue about it, tell them to send me an email.  However it is always important to consider our history and this was how it started, these large chunks of address space.

Network Address Ranges by Class 

IP network addresses are issued as follows:

Class Range Default Mask
Class A 1-127 255.0.0.0
Class B 128-191 255.255.0.0
Class C 192-223 255.255.255.0

Maximum Number of Hosts by Class

Class No. of Addresses
Class A  2^24 16,777,216
Class B 2^16 65,536
Class C 2^8 256

Subnet Masks - Binary Representations

Useful if you need to do some IP Subnetting using binary (not sure why you would). For each byte in a subnet mask the following applies.

Decimal Binary
.192 11000000 2 bits
.224 11100000 3 bits
.240 11110000 4 bits
.248 11111000 5 bits
.252 11111100 6 bits
.254 11111110 7 bits
.255 11111111 8 bits