Subnetting:Main Page

From SoylentWiki

Jump to: navigation, search

Contents

IP v4 Subnet-Mask numbers

IP mask numbers are used to divide internet addresses into blocks called subnets. The mask number represents the number of 1s in the binary of the address that is 'masked" against the address so that it ignores the last bits which are for the group of IP addresses in the masked address.

The first address of a subnet block (all 0s) is called the network address or network ID. The last address (all 1s) is the broadcast address of the network. Typically the network address +1 or the broadcast address -1 is the gateway to the internet. The 'slash' notation (ie /24) is known as CIDR format, while the more conventional 255.255.255.0 notation is considered a subnet mask.

Net bits Subnet mask Inverse mask total-addresses
/20 255.255.240.0 0.0.15.255 4096
/21 255.255.248.0 0.0.7.255 2048
/22 255.255.252.0 0.0.3.255 1024
/23 255.255.254.0 0.0.1.255 512
/24 255.255.255.0 0.0.0.255 256
/25 255.255.255.128 0.0.0.127 128
/26 255.255.255.192 0.0.0.63 64
/27 255.255.255.224 0.0.0.31 32
/28 255.255.255.240 0.0.0.15 16
/29 255.255.255.248 0.0.0.7 8
/30 255.255.255.252 0.0.0.3 4

The first address of a subnet block (all 0s) is called the network address or network ID. The last address (all 1s) is the broadcast address of the network. Typically the network address +1 or the broadcast address -1 is the gateway to the internet. This leaves us with total number of IP numbers -3 left over for host address with in a sub net block. That's why you either get 1 IP (4-3= 1) or if you ask for one more you get 5 (8-3=5).

Here is an example:

192.168.1.0/25 would include all address between 192.168.1.0 and 192.168.1.127

while 192.168.1.128/25 would include 192.168.1.128 and 192.168.1.255

Mask table

Masks Listed by Number of Bits

Network ID Bits Host ID Bits Subnet Example Notation # of Subnets # of Hosts on Each Subnet
24 8 .0 192.168.1.1/24 1 254
25 7 .128 192.168.1.1/25 2 126
26 6 .192 192.168.1.1/26 4 62
27 5 .224 192.168.1.1/27 8 30
28 4 .240 192.168.1.1/28 16 14
29 3 .248 192.168.1.1/29 32 6
30 2 .252 192.168.1.1/30 64 2

Mask = /24 : 255.255.255.0

Subnet Number Network Address Starting Host Address Ending Host Address Broadcast Address
1 0 1 254 255

Mask = /25 : 255.255.255.128

Subnet Number Network Address Starting Host Address Ending Host Address Broadcast Address
1 .0 .1 .126 .127
2 .128 .129 .254 .255

Mask = /26 : 255.255.255.192

Subnet Number Network Address Starting Host Address Ending Host Address Broadcast Address
1 .0 .1 .62 .63
2 .64 .65 .126 .127
3 .128 .129 .190 .191
4 .192 .193 .254 .255

Mask = /27 : 255.255.255.224

Subnet Number Network Address Starting Host Address Ending Host Address Broadcast Address
1 .0 .1 .30 .31
2 .32 .33 .62 .63
3 .64 .65 .94 .95
4 .96 .97 .126 .127
5 .128 .129 .158 .159
6 .160 .161 .190 .191
7 .192 .193 .222 .223
8 .224 .225 .254 .255

Mask = /28 : 255.255.255.240

Subnet Number Network Address Starting Host Address Ending Host Address Broadcast Address
1 .0 .1 .14 .15
2 .16 .17 .30 .31
3 .32 .33 .46 .47
4 .48 .49 .62 .63
5 .64 .65 .78 .79
6 .80 .81 .94 .95
7 .96 .97 .110 .111
8 .112 .113 .126 .127
9 .128 .129 .142 .143
10 .144 .145 .158 .159
11 .160 .161 .174 .175
12 .176 .177 .190 .191
13 .192 .193 .206 .207
14 .208 .209 .222 .223
15 .224 .225 .238 .239
16 .240 .241 .254 .255

Mask = /29 : 255.255.255.248

Subnet Number Network Address Starting Host Address Ending Host Address Broadcast Address
1 .0 .1 .6 .7
2 .8 .9 .14 .15
3 .16 .17 .22 .23
4 .24 .25 .30 .31
5 .32 .33 .38 .39
6 .40 .41 .46 .47
7 .48 .49 .54 .55
8 .56 .57 .62 .63
9 .64 .65 .70 .71
10 .72 .73 .78 .79
11 .80 .81 .86 .87
12 .88 .89 .94 .95
13 .96 .97 .102 .103
14 .104 .105 .110 .111
15 .112 .113 .118 .119
16 .120 .121 .126 .127
17 .128 .129 .134 .135
18 .136 .137 .142 .143
19 .144 .145 .150 .151
20 .152 .153 .158 .159
21 .160 .161 .166 .167
22 .168 .169 .174 .175
23 .176 .177 .182 .183
24 .184 .185 .190 .191
25 .192 .193 .198 .199
26 .200 .201 .206 .207
27 .208 .209 .214 .215
28 .216 .217 .222 .223
29 .224 .225 .230 .231
30 .232 .233 .238 .239
31 .240 .241 .246 .247
32 .248 .249 .254 .255

Mask = /30 : 255.255.255.252

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

Netmasks

Netmask Inverse Netmask Netmask (binary) CIDR Notes
255.255.255.255 0.0.0.0 11111111.11111111.11111111.11111111 /32 Host (single addr)
255.255.255.254 0.0.0.1 11111111.11111111.11111111.11111110 /31 Unuseable
255.255.255.252 0.0.0.3 11111111.11111111.11111111.11111100 /30 2 useable
255.255.255.248 0.0.0.7 11111111.11111111.11111111.11111000 /29 6 useable
255.255.255.240 0.0.0.15 11111111.11111111.11111111.11110000 /28 14 useable
255.255.255.224 0.0.0.31 11111111.11111111.11111111.11100000 /27 30 useable
255.255.255.192 0.0.0.63 11111111.11111111.11111111.11000000 /26 62 useable
255.255.255.128 0.0.0.127 11111111.11111111.11111111.10000000 /25 126 useable
255.255.255.0 0.0.0.255 11111111.11111111.11111111.00000000 /24 "Class C" 254 useable
255.255.254.0 0.0.1.255 11111111.11111111.11111110.00000000 /23 2 Class C's
255.255.252.0 0.0.3.255 11111111.11111111.11111100.00000000 /22 4 Class C's
255.255.248.0 0.0.7.255 11111111.11111111.11111000.00000000 /21 8 Class C's
255.255.240.0 0.0.15.255 11111111.11111111.11110000.00000000 /20 16 Class C's
255.255.224.0 0.0.31.255 11111111.11111111.11100000.00000000 /19 32 Class C's
255.255.192.0 0.0.63.255 11111111.11111111.11000000.00000000 /18 64 Class C's
255.255.128.0 0.0.127.255 11111111.11111111.10000000.00000000 /17 128 Class C's
255.255.0.0 0.0.255.255 11111111.11111111.00000000.00000000 /16 "Class B"
255.254.0.0 0.1.255.255 11111111.11111110.00000000.00000000 /15 2 Class B's
255.252.0.0 0.3.255.255 11111111.11111100.00000000.00000000 /14 4 Class B's
255.248.0.0 0.7.255.255 11111111.11111000.00000000.00000000 /13 8 Class B's
255.240.0.0 0.15.255.255 11111111.11110000.00000000.00000000 /12 16 Class B's
255.224.0.0 0.31.255.255 11111111.11100000.00000000.00000000 /11 32 Class B's
255.192.0.0 0.63.255.255 11111111.11000000.00000000.00000000 /10 64 Class B's
255.128.0.0 0.127.255.255 11111111.10000000.00000000.00000000 /9 128 Class B's
255.0.0.0 0.255.255.255 11111111.00000000.00000000.00000000 /8 "Class A"
254.0.0.0 1.255.255.255 11111110.00000000.00000000.00000000 /7 2 Class A's
252.0.0.0 3.255.255.255 11111100.00000000.00000000.00000000 /6 4 Class A's
248.0.0.0 7.255.255.255 11111000.00000000.00000000.00000000 /5 8 Class A's
240.0.0.0 15.255.255.255 11110000.00000000.00000000.00000000 /4 16 Class A's
224.0.0.0 31.255.255.255 11100000.00000000.00000000.00000000 /3 32 Class A's
192.0.0.0 63.255.255.255 11000000.00000000.00000000.00000000 /2 64 Class A's
128.0.0.0 127.255.255.255 10000000.00000000.00000000.00000000 /1 128 Class A's
0.0.0.0 255.255.255.255 00000000.00000000.00000000.00000000 /0 IP space