Skip to main content

Subnet masking




Subnetting an IP Network is done primarily for better utilization of available IP address space, and routing purpose. Other reasons include better organization, use of different physical media (such as Ethernet, WAN, etc.),  and securing network resources.
A subnet mask enables you to identify the network and node parts of the address. The network bits are represented by the 1s in the mask, and the node bits are represented by the 0s. A logical AND operation between the IP address and the subnet mask provides the Network Address.
For example, using our test IP address and the default Class C subnet mask, we get:
192.189.210.078: 1100 0000.1011 1101.1101 0010.0100 1110 Class C IP Address
255.255.255.000: 1111 1111.1111 1111.1111 1111.0000 0000 Default Class C subnet mask
 192.189.210.0         1100 0000 1011 1101 1101 0010 0000 0000
As can be seen above, by using and AND operator, we can compute the network portion of an IP address.  The network portion for the IP address given in the above example is 192.189.210.0, and the host portion of the IP address is 078.
Given below is a table that provides binary equivalent of decimal values.  For binary conversion, take first octet of a given IP address (in dotted decimal form), and lookup the binary value. Then take the second octet and lookup the binary value, and so on.
Binary Conversion Table
Decimal Binary Decimal Binary Decimal Binary Decimal Binary
0 0000 0000 64 0100 0000 128 1000 0000 192 1100 0000
1 0000 0001 65 0100 0001 129 1000 0001 193 1100 0001
2 0000 0010 66 0100 0010 130 1000 0010 194 1100 0010
3 0000 0011 67 0100 0011 131 1000 0011 195 1100 0011
4 0000 0100 68 0100 0100 132 1000 0100 196 1100 0100
5 0000 0101 69 0100 0101 133 1000 0101 197 1100 0101
6 0000 0110 70 0100 0110 134 1000 0110 198 1100 0110
7 0000 0111 71 0100 0111 135 1000 0111 199 1100 0111
8 0000 1000 72 0100 1000 136 1000 1000 200 1100 1000
9 0000 1001 73 0100 1001 137 1000 1001 201 1100 1001
10 0000 1010 74 0100 1010 138 1000 1010 202 1100 1010
11 0000 1011 75 0100 1011 139 1000 1011 203 1100 1011
12 0000 1100 76 0100 1100 140 1000 1100 204 1100 1100
13 0000 1101 77 0100 1101 141 1000 1101 205 1100 1101
14 0000 1110 78 0100 1110 142 1000 1110 206 1100 1110
15 0000 1111 79 0100 1111 143 1000 1111 207 1100 1111








16 0001 0000 80 0101 0000 144 1001 0000 208 1101 0000
17 0001 0001 81 0101 0001 145 1001 0001 209 1101 0001
18 0001 0010 82 0101 0010 146 1001 0010 210 1101 0010
19 0001 0011 83 0101 0011 147 1001 0011 211 1101 0011
20 0001 0100 84 0101 0100 148 1001 0100 212 1101 0100
21 0001 0101 85 0101 0101 149 1001 0101 213 1101 0101
22 0001 0110 86 0101 0110 150 1001 0110 214 1101 0110
23 0001 0111 87 0101 0111 151 1001 0111 215 1101 0111
24 0001 1000 88 0101 1000 152 1001 1000 216 1101 1000
25 0001 1001 89 0101 1001 153 1001 1001 217 1101 1001
26 0001 1010 90 0101 1010 154 1001 1010 218 1101 1010
27 0001 1011 91 0101 1011 155 1001 1011 219 1101 1011
28 0001 1100 92 0101 1100 156 1001 1100 220 1101 1100
29 0001 1101 93 0101 1101 157 1001 1101 221 1101 1101
30 0001 1110 94 0101 1110 158 1001 1110 222 1101 1110
31 0001 1111 95 0101 1111 159 1001 1111 223 1101 1111








32 0010 0000 96 0110 0000 160 1010 0000 224 1110 0000
33 0010 0001 97 0110 0001 161 1010 0001 225 1110 0001
34 0010 0010 98 0110 0010 162 1010 0010 226 1110 0010
35 0010 0011 99 0110 0011 163 1010 0011 227 1110 0011
36 0010 0100 100 0110 0100 164 1010 0100 228 1110 0100
37 0010 0101 101 0110 0101 165 1010 0101 229 1110 0101
38 0010 0110 102 0110 0110 166 1010 0110 230 1110 0110
39 0010 0111 103 0110 0111 167 1010 0111 231 1110 0111
40 0010 1000 104 0110 1000 168 1010 1000 232 1110 1000
41 0010 1001 105 0110 1001 169 1010 1001 233 1110 1001
42 0010 1010 106 0110 1010 170 1010 1010 234 1110 1010
43 0010 1011 107 0110 1011 171 1010 1011 235 1110 1011
44 0010 1100 108 0110 1100 172 1010 1100 236 1110 1100
45 0010 1101 109 0010 1101 173 1010 1101 237 1010 1101
46 0010 1110 110 0110 1110 174 1010 1110 238 1110 1110
47 0010 1111 111 0110 1111 175 1010 1111 239 1110 1111








48 0011 0000 112 0111 0000 176 1011 0000 240 1111 0000
49 0011 0001 113 0111 0001 177 1011 0001 241 1111 0001
50 0011 0010 114 0111 0010 178 1011 0010 242 1111 0010
51 0011 0011 115 0111 0011 179 1011 0011 243 1111 0011
52 0011 0100 116 0111 0100 180 1011 0100 244 1111 0100
53 0011 0101 117 0111 0101 181 1011 0101 245 1111 0101
54 0011 0110 118 0111 0110 182 1011 0110 246 1111 0110
55 0011 0111 119 0111 0111 183 1011 0111 247 1111 0111
56 0011 1000 120 0111 1000 184 1011 1000 248 1111 1000
57 0011 1001 121 0111 1001 185 1011 1001 249 1111 1001
58 0011 1010 122 0111 1010 186 1011 1010 250 1111 1010
59 0011 1011 123 0111 1011 187 1011 1011 251 1111 1011
60 0011 1100 124 0111 1100 188 1011 1100 252 1111 1100
61 0011 1101 125 0111 1101 189 1011 1101 253 1111 1101
62 0011 1110 126 0111 1110 190 1011 1110 254 1111 1110
63 0011 1111 127 0111 1111 191 1011 1111 255 1111 1111
Example Question: Which of the following is a Class C IP address?
      A. 10.10.14.118
      B. 135.23.112.57
      C. 191.200.199.199
      D. 204.67.118.54

                         
Correct Answer: D.
Explanation:
IP addresses are written using decimal numbers separated by decimal points. This is called dotted decimal notation of expressing IP addresses. The different classes of IP addresses is as below:
Class
Format 
Leading Bit  pattern
Network address Range   
Maximum  networks
Maximum hosts     
A
N.H.H.H
 0
 0-126
 127
 16,777,214
B
N.N.H.H   
 10
 128-191
 16,384
 65,534
C
N.N.N.H
 110
 192-223
 2,097,152
 254
Network address of all zeros means "This network or segment".
Network address of all 1s means " all networks", same as hexadecimal of all Fs.
Network number 127 is reserved for loopback tests.
Host (Node) address of all zeros mean "This Host (Node)".
Host (Node) address of all 1s mean "all Hosts (Nodes) " on the specified network.

Comments

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex