{"id":303,"date":"2020-08-18T19:23:47","date_gmt":"2020-08-18T20:23:47","guid":{"rendered":"http:\/\/www.linux-tutorial.info\/?page_id=77"},"modified":"2020-08-22T19:26:38","modified_gmt":"2020-08-22T20:26:38","slug":"this-is-the-page-title-toplevel-138","status":"publish","type":"page","link":"http:\/\/www.linux-tutorial.info\/?page_id=303","title":{"rendered":"Subnet Masks"},"content":{"rendered":"\n<title>Subnet Masks<\/title>\n<question id=\"286\" text=\"How is a subnet mask created?\" \/>\n<p>\nSubnet masks are the same size as IP addresses (32-bit values) that allow the recipient of <glossary>IP<\/glossary> packets to distinguish the <glossary>network<\/glossary>\nID portion of the <glossary>IP<\/glossary>\n<glossary>address<\/glossary>\nfrom the <glossary>host<\/glossary>\nID. Like an <glossary>IP address<\/glossary>,\n the value of a <glossary>subnet<\/glossary>\n<glossary>mask<\/glossary>\nis\nfrequently represented in dotted decimal notation. Subnet masks are determined by assigning 1&#8217;s to\nbits that belong to the <glossary>network<\/glossary>\nID and 0&#8217;s to the bits that belong to the <glossary>host<\/glossary>\nID. Once the bits are\nin place, the 32-bit value is converted to dotted decimal notation, as shown in the table\nbelow.\n<\/p>\n<table BORDER cellspacing=1 bordercolor=\"#000000\" cellpadding=7 WIDTH=510>\n<tr><td>Address class<td>Bits for <glossary>subnet<\/glossary> mask<td>Subnet mask\n<tr><td>Class A<td>11111111 00000000 00000000 00000000<td>255.0.0.0\n<tr><td>Class B<td>11111111 11111111 00000000 00000000<td>255.255.0.0\n<tr><td>Class C<td>11111111 11111111 11111111 00000000<td>255.255.255.0\n<\/table>\n<p>\nTable &#8211;  Default Subnet Masks for Standard <glossary>IP<\/glossary>\nAddress Classes\n<\/p>\n<question id=\"287\" text=\"A subnet mask can also be represented in dotted decimal notation.\" \/>\n<p>\nThe result allows TCP\/IP to determine the <glossary>host<\/glossary>\nand\nnetwork IDs of the local computer. For example, when the <glossary>IP<\/glossary>\n<glossary>address<\/glossary>\nis 102.54.94.97 and the subnet\nmask is 255.255.0.0, the <glossary>network<\/glossary>\nID is 102.54 and the <glossary>host<\/glossary>\nID is 94.97.\n<\/p>\n<p>\nKeep in mind that all\nof this with the <glossary>subnet<\/glossary>\nmasks is the principle and not necessarily the practice. If you (meaning\nyour company) has been assigned a Class B <glossary>address<\/glossary>,\n then the the first two octets are assigned to\nyou. You could then breakdown the <glossary>class<\/glossary>\nB net into Class C nets. If we take a look at Table 0\\1, we\nsee that there are 65,534 possible nodes in that <glossary>network<\/glossary>.\n That is really too many to manage on a single network.\n<\/p>\n<p>\nHowever, if we considered each of the third octets to represent a sub-net of our <glossary>class<\/glossary>\nB\nnetwork, they would all have 254 possible nodes per sub-net. This is basically what a <glossary>class<\/glossary>\nC net is anyway. We can then assign each sub-net to a department or building and then assign one person to\nmanage each of the <glossary>class<\/glossary>\nC sub-nets, which is a little easier to do.\n<\/p>\n<p>\nTo keep the different\nclass C <glossary>subnet<\/glossary>\nfrom interfering with each other, we give each sub-net a <em>Class C<\/em>\nsubnet-mask, although the first octet is in the range for a Class B <glossary>network<\/glossary>.\n That way machines on\nthis <glossary>subnet<\/glossary>\nare only concerned with packets for the subnet. We can also break down the sub-nets\nphysically so that there is a <glossary>gateway<\/glossary>\nor <glossary>router<\/glossary>\nbetween the subnets. That way the physical network\nis not overburdened with traffic from 65,534 machines.\n<\/p>\n<question id=\"288\" text=\"With the right subnet mask, a class B network could be broken into multiple class C networks.\" \/>\n<p>\nLet&#8217;s look at an example. Assume your\ncompany uses the private Class B network\n10.2.0.0. The different departments within the company are\nassigned a <glossary>class<\/glossary>\nC <glossary>address<\/glossary>\nthat might look like this: 10.2.38.0. Although the first octet (10)\nsays that this is a <glossary>class<\/glossary>\nB <glossary>address<\/glossary>,\n it is really the subnet-mask that makes that determination. In\nthis case, our <glossary>subnet<\/glossary>\n<glossary>mask<\/glossary>\nwould be: 255.255.255.0. Therefore, any <glossary>packet<\/glossary>\nthat is destined for an\naddress other than one starting 10.2.38.0 is not on this <glossary>network<\/glossary>.\n<\/p>\n<p>\nFor example, to send a packet to the IP address 10.2.38.11, we compare the binary presentation of the network ID for the network interface and the IP address of the outgoing packet, which looks like this:\n<\/p>\n<p>\n<strong>00001010 00000010 00011100<\/strong> 00000000 &#8211; Network ID 10.2.38.0 <br \/>\n<strong>00001010 00000010 00011100<\/strong> 00000001 &#8211; Interface IP 10.2.38.1<br \/>\n<strong>00001010 00000010 00011100<\/strong> 00001011 &#8211; Destination Host IP 10.2.38.11\n<\/p>\n<p>\nAs you can see the network portion (the first three octets) is the same. Thus the machine knows that this IP packet is bound for a machine on the network reached by the interface with the IP address 10.2.38.1.\n<\/p>\n<p>\nYou may have noticed that according to previous table the network address 10.2.38.0 should be a Class B network, but we have used a Class C netmask (i.e. 255.255.255.0). This is actually done quite often to allow one extra octet for the network address, so if your Class B address was 10.2 as in this example, you could also have the networks 10.2.1.0, 10.2.2.0, 10.2.3.0, and so forth.\n<\/p>\n<p>\nIt is the responsibility\nof <glossary>IP<\/glossary>\nto ensure that each <glossary>packet<\/glossary>\nends up going to the right machine. This is accomplished, in part,\nby assigned a unique  <glossary>address<\/glossary>\nto each machine. This address is referred to as the Internet address\nor <glossary>IP<\/glossary>\n<glossary>address<\/glossary>.\n Each <glossary>network<\/glossary>\ngets a set of these IP addresses that are within a specific range. In\ngeneral, packets that are destined for an <glossary>IP<\/glossary>\n<glossary>address<\/glossary>\nwithin that range will stay within the local\nnetwork. Only when a <glossary>packet<\/glossary>\nis destined for somewhere outside of the local <glossary>network<\/glossary>\nis it &#8220;allowed&#8221;\nto pass.\n<\/p><p>\nIn other words, <glossary>IP<\/glossary>\nis responsible for the delivery of the <glossary>packet<\/glossary>.\nIt functions similar to the post office, whereby you have both a sending\nand receiving <glossary>address<\/glossary>. Often times you\nhave many more letters than a single mail bag can handle. The mail <glossary>carrier<\/glossary>\n(or someone else at the\npost office) will break down the number of letters into sets small enough to fit in a bag. This is what <glossary>IP<\/glossary> does.\n<\/p>\n<question id=\"289\" text=\"What are IP packets more properly called?\" \/>\n<concept id=\"174\" description=\"IP packets more properly called a 'datagram'.\" \/>\n<p>\nSince there are many people using the line all at once, IP will break down the TCP\npackets into units of a specific size. Although often referred to also a <em>packets<\/em>, the more\ncorrect terminology is to refer to <glossary>IP<\/glossary> packets as\n<em>datagrams<\/em>. Just like bags of mail need\nto go from one post office to the next to reach their final destination, <glossary>IP<\/glossary>\ndatagrams must often go\nthrough different machines to reach their final destination.\n<\/p>\n<p>\nSaying that <glossary>IP<\/glossary> routing can be\naccomplished completely in software isn&#8217;t entirely accurate. Although, no physical <glossary>router<\/glossary>\nis needed,\nIP can&#8217;t send a <glossary>packet<\/glossary>\nto someplace where there is no physical connection. This is normally\naccomplished by an additional <glossary>network<\/glossary>\ncard. With two (or more) network cards a single machine can be\nconnected to multiple networks. The <glossary>IP<\/glossary>\nlayer on that one machine can then be used to <glossary>route<\/glossary>\nIP\npackets between the two networks.\n<\/p><p>\nOnce configured (how that&#8217;s done, we&#8217;ll talk about later),\nIP maintains a table of routing information, called (logically) a routing table. Every time the IP\nlayer receives a <glossary>packet<\/glossary>,\n it checks the destination address\n<\/p>\n<p>\nYou will frequently see IP addresses referred to as 10.2.38.11\/24, where the IP address is followed by a slash and a number representing how many bits should be used for the network portion of the address. In this example, there are 24 bits or three octets, which is a traditional Class C network. If we specified the address like this 10.2.38.11\/28, it would mean that 28 bits would represent the network portion (which is obviously more bits than a traditional Class C network). This means that fewer bits are available for the host portion of the address.\nThe point of all this, is that you can create networks of different sizes than the traditional three network classes. When you do, you have created a network that lies outside these three standard network classes, and your network is called classesless. This is referred to as Classless Inter-Domain Routing (<glossary>CIDR<\/glossary>).\n<\/p>\n<p>\nTypically, the netmask is only needed when you are configuring new components. For example, when adding a new network card.\n<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Subnet Masks Subnet masks are the same size as IP addresses (32-bit values) that allow the recipient of IP packets to distinguish the network ID portion of the IP address from the host ID. Like an IP address, the value &hellip; <a href=\"http:\/\/www.linux-tutorial.info\/?page_id=303\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-303","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=303"}],"version-history":[{"count":1,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/303\/revisions"}],"predecessor-version":[{"id":712,"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=\/wp\/v2\/pages\/303\/revisions\/712"}],"wp:attachment":[{"href":"http:\/\/www.linux-tutorial.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}