{"id":137,"date":"2009-07-14T13:22:49","date_gmt":"2009-07-14T20:22:49","guid":{"rendered":"http:\/\/www.actusa.net\/~stu\/blog\/?p=137"},"modified":"2009-07-16T08:26:17","modified_gmt":"2009-07-16T15:26:17","slug":"what-is-a-subnet-mask","status":"publish","type":"post","link":"https:\/\/www.stuartsheldon.org\/blog\/2009\/07\/what-is-a-subnet-mask\/","title":{"rendered":"What Is A Subnet Mask?"},"content":{"rendered":"<h2><em><strong>So, what is a subnet mask and why do I need one?<\/strong><\/em><\/h2>\n<p>This question is always coming up, so I thought it might be a good idea to try and at least give a quick overview.<\/p>\n<p>IP addresses are used to identify your computer on the net. Subnet Masks are used to tell your computer what it should consider as local network traffic, and what it should send off to the gateway for delivery. Here are the basics of network addressing:<\/p>\n<p style=\"text-align: right;\"><!--more--><\/p>\n<p><code><br \/>\n&nbsp;&nbsp;Address: 192.168.0.10<br \/>\n&nbsp;&nbsp;Netmask: 255.255.255.0<br \/>\n&nbsp;&nbsp;Network: 192.168.0.0<br \/>\nBroadcast: 192.168.0.255<br \/>\n<\/code><\/p>\n<p>All these things are required, however, both the network and the broadcast addresses can be derived from the address and subnet mask. Here is how:<\/p>\n<p>We need to show the address and netmask in binary for this to make sense:<br \/>\n<code><br \/>\n11000000 10101000 00000000 00001010 is the ip address<br \/>\n11111111 11111111 11111111 00000000 is the network mask<br \/>\n11000000 10101000 00000000 00000000 is the network address<br \/>\n11000000 10101000 00000000 11111111 is the broadcast address<br \/>\n<\/code><br \/>\nBy doing a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Binary_and\" target=\"_blank\">binary and<\/a> we can get the actual network address:<br \/>\n<code><br \/>\n11000000 10101000 00000000 00001010 is the ip address<br \/>\n11111111 11111111 11111111 00000000 is the network mask<br \/>\n11000000 10101000 00000000 00000000 is the network address<br \/>\n<\/code><br \/>\nNow, by adding the inverse of the if the subnet mask to the network, we get the broadcast:<br \/>\n<code><br \/>\n11000000 10101000 00000000 00000000 network address<br \/>\n00000000 00000000 00000000 11111111 + the inverse of the network mask<br \/>\n11000000 10101000 00000000 11111111 = the broadcast address<br \/>\n<\/code><br \/>\nWe can also divide the address into it&#8217;s network and host address parts by splitting the address at the most significant bit boundary of the subnet mask:<\/p>\n<p><code><span style=\"color: #ff0000;\">11000000 10101000 00000000<\/span> <span style=\"color: #339966;\"> &nbsp;&nbsp;00001010<\/span> is the ip address<br \/>\n<span style=\"color: #ff0000;\">11111111 11111111 11111111<\/span> <span style=\"color: #339966;\"> &nbsp;&nbsp;00000000<\/span> is the network mask<\/code><\/p>\n<p>The <span style=\"color: #ff0000;\">red<\/span> portion is the network portion and the <span style=\"color: #339966;\">green<\/span> portion is the host portion. In order for a host to be on the same network, it must have the identical network portion of another host.<\/p>\n<p>In order for a host to talk to another host on a different network, it must use the gateway to get there. But that&#8217;s another post!<\/p>\n<p>&#8212; Stu<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, what is a subnet mask and why do I need one? This question is always coming up, so I thought it might be a good idea to try and at least give a quick overview. IP addresses are used to identify your computer on the net. Subnet Masks are used to tell your computer [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30],"tags":[33,34,31,32],"class_list":["post-137","post","type-post","status-publish","format-standard","hentry","category-networking","tag-binary","tag-calulation","tag-netmask","tag-subnet"],"_links":{"self":[{"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/posts\/137","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/comments?post=137"}],"version-history":[{"count":41,"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/posts\/137\/revisions"}],"predecessor-version":[{"id":172,"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/posts\/137\/revisions\/172"}],"wp:attachment":[{"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/media?parent=137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/categories?post=137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.stuartsheldon.org\/blog\/wp-json\/wp\/v2\/tags?post=137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}