{"id":12248,"date":"2017-01-10T00:23:26","date_gmt":"2017-01-09T18:53:26","guid":{"rendered":"http:\/\/pratikkataria.com\/blog\/?p=12248"},"modified":"2017-01-10T00:23:26","modified_gmt":"2017-01-09T18:53:26","slug":"ping-machines-multiple-subnets","status":"publish","type":"post","link":"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/","title":{"rendered":"Ping Machines On Multiple Subnets"},"content":{"rendered":"<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 nonhundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"background-color: #ffffff;background-position: center center;background-repeat: no-repeat;padding-top:20px;padding-right:10px;padding-bottom:20px;padding-left:10px;margin-bottom: 0px;margin-top: 0px;border-width: 0px 0px 0px 0px;border-color:#eae9e9;border-style:solid;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last\" style=\"margin-top:0px;margin-bottom:20px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\" style=\"background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding: 0px 0px 0px 0px;\"><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-full-width-sep\" style=\"margin-left: auto;margin-right: auto;width:100%;\"><div class=\"fusion-separator-border sep-single sep-solid\" style=\"border-color:#e0dede;border-top-width:1px;\"><\/div><\/div><div class=\"fusion-sep-clear\"><\/div><style type=\"text\/css\"><\/style><div class=\"fusion-title title fusion-title-1 fusion-sep-none fusion-title-text fusion-title-size-three\" style=\"margin-top:0px;margin-right:0px;margin-bottom:30px;margin-left:0px;\"><h3 class=\"title-heading-left fusion-responsive-typography-calculated\" style=\"margin:0;--fontSize:27;--minFontSize:27px;line-height:1.41;\">Concept<\/h3><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-full-width-sep\" style=\"margin-left: auto;margin-right: auto;width:100%;\"><div class=\"fusion-separator-border sep-single sep-solid\" style=\"border-color:#e0dede;border-top-width:1px;\"><\/div><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-text fusion-text-1\"><p>All the hosts in a network must have the same network number. This property of IP addressing can cause problems as networks grow. For example, consider a university that started out with one class B network used by the Computer Science Dept. for the computers on its Ethernet. A year later, the Electrical Engineering Dept. wanted to get on the Internet, so they bought a repeater to extend the CS Ethernet to their building.<\/p>\n<p>As time went on, many other departments acquired computers and the limit of four repeaters per Ethernet was quickly reached. A different organization was required. Getting a second network address would be hard to do since network addresses are scarce and the university already had enough addresses for over 60,000 hosts. The problem is the rule that a single class A, B, or C address refers to one network, not to a collection of LANs. As more and more organizations ran into this situation, a small change was made to the addressing system to deal with it. The solution is to allow a network to be split into several parts for internal use but still act like a single network to the outside world.<\/p>\n<p>In the Internet literature, the parts of the network are called subnets. When a packet comes into the main router, how does it know which subnet (Ethernet) to give it to? One way would be to have a table with 65,536 entries in the main router telling which router to use for each host on campus. This idea would work, but it would require a very large table in the main router and a lot of manual maintenance as hosts were added, moved, or taken out of service.<\/p>\n<p>Instead, a different scheme was invented. Basically, instead of having a single class B address with 14 bits for the network number and 16 bits for the host number, some bits are taken away from the host number to create a subnet number. For example, if the university has 35 departments, it could use a 6- bit subnet number and a 10-bit host number, allowing for up to 64 Ethernets, each with a maximum of 1022 hosts (0 and -1 are not available, as mentioned earlier). This split could be changed later if it turns out to be the wrong one. To implement subnetting, the main router needs a subnet mask that indicates the split between network + subnet number and host<\/p>\n<\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-separator fusion-full-width-sep\" style=\"margin-left: auto;margin-right: auto;width:100%;\"><div class=\"fusion-separator-border sep-single sep-solid\" style=\"border-color:#e0dede;border-top-width:1px;\"><\/div><\/div><div class=\"fusion-sep-clear\"><\/div><div class=\"fusion-text fusion-text-2\"><pre class=\"brush: python; title: Code Block; notranslate\" title=\"Code Block\">\r\n\r\n'''\r\n----------------------------\r\n\r\nAssignment 2 PL-4 (192-223 Class C IP)\r\n\r\n----------------------------\r\nTheory:\r\nIP Address Classes:\r\nClass A: 0-126\r\nClass B: 127-191\r\nClass C: 192-223\r\nClass D: 224-255\r\n\r\nIf Subnet mask is 255.0.0.0 it means Class A. That is, first 8 bits are 1. This also means that 2 raised to 8 is IP and 2 raised to 24 - 2(2 reserved always) is number of Hosts (machines that can be added).\r\n\r\nConsider Netmask as 255.255.255.0. Then we can AND 255.255.255.0 with the IP address to check if it is in the same subnet (i.e. both IP should match).\r\nSo,\r\n192.168.5.1 is different subnet than 192.168.4.1\r\n\r\nYou can use free Cisco Tracer tool to setup networks and clear doubts. Designing for this assignment will include 2 or more machines connected to a switch and the switch is connected to a router.\r\nThe switch needs to be enabled by running command 'enable'. The machines need to be setup with static IP addresses. The machines on other side of router will be of different subnet.\r\n\r\n----------------------------\r\n\r\nFirst manually go to Edit Connections...\r\nEdit\r\nIPv4 settings\r\nChoose Manual\r\nInput IP address as needed (e.g. 192.168.4.1) and Netmask as: 255.255.255.0\r\nClick on Ethernet Connection Name to reset (Disconnect &amp;amp; Connect)\r\n\r\n----------------------------\r\n'''\r\n\r\nimport os\r\n\r\nos.system(&quot;ping 192.168.4.1 -c 2&quot;)\r\nos.system(&quot;route&quot;)\r\nos.system(&quot;sudo route add -net 192.168.5.0 netmask 255.255.255.0 eth6&quot;)\r\nos.system(&quot;route&quot;)\r\nos.system(&quot;ping 192.168.5.3 -c 2&quot;)\r\n\r\n\r\n<\/pre>\n<\/div><div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":12251,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[38],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v15.6.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Ping Machines On Multiple Subnets - TechAmass<\/title>\n<meta name=\"description\" content=\"All the hosts in a network must have the same network number. This property of IP addressing can cause problems as networks grow. For example, consider a university that started out with one class B network used by the Computer Science Dept. for the computers on its Ethernet. A year later, the Electrical Engineering Dept. wanted to get on the Internet, so they bought a repeater to extend the CS Ethernet to their building.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ping Machines On Multiple Subnets - TechAmass\" \/>\n<meta property=\"og:description\" content=\"All the hosts in a network must have the same network number. This property of IP addressing can cause problems as networks grow. For example, consider a university that started out with one class B network used by the Computer Science Dept. for the computers on its Ethernet. A year later, the Electrical Engineering Dept. wanted to get on the Internet, so they bought a repeater to extend the CS Ethernet to their building.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/\" \/>\n<meta property=\"og:site_name\" content=\"TechAmass\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-09T18:53:26+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/pratikkataria.com\/blog\/wp-content\/uploads\/2017\/01\/computer-networks-thumb.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"479\" \/>\n<meta name=\"twitter:card\" content=\"summary\" \/>\n<meta name=\"twitter:creator\" content=\"@PratikPKataria\" \/>\n<meta name=\"twitter:site\" content=\"@PratikPKataria\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"4 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/pratikkataria.com\/blog\/#website\",\"url\":\"https:\/\/pratikkataria.com\/blog\/\",\"name\":\"TechAmass\",\"description\":\"Pratik&#039;s blog\",\"publisher\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/#\/schema\/person\/ef09a6ee5cb751524bc4c92454c59412\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/pratikkataria.com\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#primaryimage\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/pratikkataria.com\/blog\/wp-content\/uploads\/2017\/01\/computer-networks-thumb.jpeg\",\"width\":640,\"height\":479,\"caption\":\"computer-networks-thumb\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#webpage\",\"url\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/\",\"name\":\"Ping Machines On Multiple Subnets - TechAmass\",\"isPartOf\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#primaryimage\"},\"datePublished\":\"2017-01-09T18:53:26+00:00\",\"dateModified\":\"2017-01-09T18:53:26+00:00\",\"description\":\"All the hosts in a network must have the same network number. This property of IP addressing can cause problems as networks grow. For example, consider a university that started out with one class B network used by the Computer Science Dept. for the computers on its Ethernet. A year later, the Electrical Engineering Dept. wanted to get on the Internet, so they bought a repeater to extend the CS Ethernet to their building.\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/\"]}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#webpage\"},\"author\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/#\/schema\/person\/ef09a6ee5cb751524bc4c92454c59412\"},\"headline\":\"Ping Machines On Multiple Subnets\",\"datePublished\":\"2017-01-09T18:53:26+00:00\",\"dateModified\":\"2017-01-09T18:53:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/#\/schema\/person\/ef09a6ee5cb751524bc4c92454c59412\"},\"image\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#primaryimage\"},\"articleSection\":\"Tech\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/pratikkataria.com\/blog\/ping-machines-multiple-subnets\/#respond\"]}]},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/pratikkataria.com\/blog\/#\/schema\/person\/ef09a6ee5cb751524bc4c92454c59412\",\"name\":\"Pratik Kataria\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/pratikkataria.com\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/pratikkataria.com\/blog\/wp-content\/uploads\/2020\/02\/kpratik_sq.jpg\",\"width\":512,\"height\":512,\"caption\":\"Pratik Kataria\"},\"logo\":{\"@id\":\"https:\/\/pratikkataria.com\/blog\/#personlogo\"},\"description\":\"Pratik Kataria is currently learning Springboot and Hibernate. Technologies known and worked on: C\/C++, Java, Python, JavaScript, HTML, CSS, Wordpress, Angular, Ionic, MongoDB, SQL and Android. Softwares known and worked on: Adobe Photoshop, Adobe Illustrator and Adobe After Effects.\",\"sameAs\":[\"https:\/\/pratikkataria.com\/\"]}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","amp_enabled":true,"acf":[],"_links":{"self":[{"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/posts\/12248"}],"collection":[{"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/comments?post=12248"}],"version-history":[{"count":4,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/posts\/12248\/revisions"}],"predecessor-version":[{"id":12271,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/posts\/12248\/revisions\/12271"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/media\/12251"}],"wp:attachment":[{"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/media?parent=12248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/categories?post=12248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pratikkataria.com\/blog\/wp-json\/wp\/v2\/tags?post=12248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}