Basic rules:
- The total number of IP addresses in a subnet is a power of two. So that's: 1, 2, 4, 8, 16, ... etc.
- The first IP address in a subnet is a multiple (0, 1, 2, 3 ...) of the number of IP addresses in the subnet.
- 'x' in netmask '255.255.255.x' is 256 - number of IP addresses in the subnet.
- In slash-notation, the netmask is '/y', where y = 32 - n, and 2ⁿ is the number of addresses in the subnet.
So if we want 4 addresses in our subnet, the first address in this subnet iseither 0 or 4 or 8 or 12 or ... etc.
And 'x' in netmask '255.255.255.x' is: 256 - 4 = 252. So the netmask is:'255.255.255.252'.
4 = 2², so n = 2 and y is 32 - 2 = 30. The slash-notation netmask istherefore: '/30'.
Note: You can't actually use IP addresses a.b.c.0 or a.b.c.255
Size | Netmask | / |
---|---|---|
1 | 255.255.255.255 | /32 |
2 | 255.255.255.254 | /31 |
4 | 255.255.255.252 | /30 |
8 | 255.255.255.248 | /29 |
16 | 255.255.255.240 | /28 |
32 | 255.255.255.224 | /27 |
64 | 255.255.255.192 | /26 |
128 | 255.255.255.128 | /25 |
256 | 255.255.255.0 | /24 |
Size: 1
Netmask: 255.255.255.255 or /32
Any address.
Note: This is a rather small subnet.
Size: 2
Netmask: 255.255.255.254 or /31
Starts with even address.
Note: This is a rather small subnet.
Size: 4
Netmask: 255.255.255.252 or /30
Starts with multiple of 4;
1st - last | 1st - last | 1st - last | 1st - last |
---|---|---|---|
0 - 3 | 4 - 7 | 8 - 11 | 12 - 15 |
16 - 19 | 20 - 23 | 24 - 27 | 28 - 31 |
32 - 35 | 36 - 39 | 40 - 43 | 44 - 47 |
48 - 51 | 52 - 55 | 56 - 59 | 60 - 63 |
64 - 67 | 68 - 71 | 72 - 75 | 76 - 79 |
80 - 83 | 84 - 87 | 88 - 91 | 92 - 95 |
96 - 99 | 100 - 103 | 104 - 107 | 108 - 111 |
112 - 115 | 116 - 119 | 120 - 123 | 124 - 127 |
128 - 131 | 132 - 135 | 136 - 139 | 140 - 143 |
144 - 147 | 148 - 151 | 152 - 155 | 156 - 159 |
160 - 163 | 164 - 167 | 168 - 171 | 172 - 175 |
176 - 179 | 180 - 183 | 184 - 187 | 188 - 191 |
192 - 195 | 196 - 199 | 200 - 203 | 204 - 207 |
208 - 211 | 212 - 215 | 216 - 219 | 220 - 223 |
224 - 227 | 228 - 231 | 232 - 235 | 236 - 239 |
240 - 243 | 244 - 247 | 248 - 251 | 252 - 255 |
Example I
Network: 192.168.0.12Netmask: 255.255.255.252
Or;
192.168.0.12/30
IP addresses 192.168.0.12 to 192.168.0.15 are in this subnet (see table above).
Example II
Network: 172.16.0.116Netmask: 255.255.255.252
Or;
172.16.0.116/30
IP addresses 172.16.0.116 to 172.16.0.119 are in this subnet (see table above).
Example III
Network: 10.0.0.240Netmask: 255.255.255.252
Or;
10.0.0.240/30
IP addresses 10.0.0.240 to 10.0.0.243 are in this subnet (see table above).
Size: 8
Netmask: 255.255.255.248 or /29
Starts with multiple of 8;
1st - last | 1st - last | 1st - last | 1st - last |
---|---|---|---|
0 - 7 | 8 - 15 | 16 - 23 | 24 - 31 |
32 - 39 | 40 - 47 | 48 - 55 | 56 - 63 |
64 - 71 | 72 - 79 | 80 - 87 | 88 - 95 |
96 - 103 | 104 - 111 | 112 - 119 | 120 - 127 |
128 - 135 | 136 - 143 | 144 - 151 | 152 - 159 |
160 - 167 | 168 - 175 | 176 - 183 | 184 - 191 |
192 - 199 | 200 - 207 | 208 - 215 | 216 - 223 |
224 - 231 | 232 - 239 | 240 - 247 | 248 - 255 |
Example
Network: 192.168.1.24Netmask: 255.255.255.248
Or;
192.168.1.24/29
IP addresses 192.168.1.24 to 192.168.1.31 are in this subnet (see table above).
Size: 16
Netmask: 255.255.255.240 or /28
Starts with multiple of 16;
1st - last | 1st - last | 1st - last | 1st - last |
---|---|---|---|
0 - 15 | 16 - 31 | 32 - 47 | 48 - 63 |
64 - 79 | 80 - 95 | 96 - 111 | 112 - 127 |
128 - 143 | 144 - 159 | 160 - 175 | 176 - 191 |
192 - 207 | 208 - 223 | 224 - 239 | 240 - 255 |
Example
Network: 192.168.1.48Netmask: 255.255.255.240
Or;
192.168.1.48/28
IP addresses 192.168.1.48 to 192.168.1.63 are in this subnet (see table above).
Size: 32
Netmask: 255.255.255.224 or /27
Starts with multiple of 32;
1st - last | 1st - last | 1st - last | 1st - last |
---|---|---|---|
0 - 31 | 32 - 63 | 64 - 95 | 96 - 127 |
128 - 159 | 160 - 191 | 192 - 223 | 224 - 255 |
Example
Network: 192.168.1.96Netmask: 255.255.255.224
Or;
192.168.1.96/27
IP addresses 192.168.1.96 to 192.168.1.127 are in this subnet (see table above).
Size: 64
Netmask: 255.255.255.192 or /26
Starts with multiple of 64;
1st - last | 1st - last | 1st - last | 1st - last |
---|---|---|---|
0 - 63 | 64 - 127 | 128 - 191 | 192 - 255 |
Example
Network: 192.168.1.128Netmask: 255.255.255.192
Or;
192.168.1.128/26
IP addresses 192.168.1.128 to 192.168.1.191 are in this subnet (see table above).
Size: 128
Netmask: 255.255.255.128 or /25
Starts with multiple of 128;
Note: This is a rather large subnet.
1st - last | 1st - last |
---|---|
0 - 127 | 128 - 255 |
Size: 256
Netmask: 255.255.255.0 or /24
Starts with 0.
Note: This is not a subnet.
Other subnet sizes.