{"id":3315,"date":"2010-07-08T22:13:37","date_gmt":"2010-07-09T02:13:37","guid":{"rendered":"http:\/\/g33kinfo.com\/info\/?p=3315"},"modified":"2010-07-08T22:13:37","modified_gmt":"2010-07-09T02:13:37","slug":"linux-subnet-cidr-calculator","status":"publish","type":"post","link":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/","title":{"rendered":"Linux: Subnet (CIDR) Calculator"},"content":{"rendered":"<p>From <a href=\"http:\/\/www.cyberciti.biz\/faq\/linux-subnet-calculator-cidr\/\" target=\"_blank\" rel=\"noopener noreferrer\">cyberciti.biz<\/a><\/p>\n<p>I&#8217;m new to networking and need help with network settings. I&#8217;m looking for a tool for calculating available host address ranges with CIDR using Linux command prompt. How do I use subnet calculator under Linux or UNIX?<\/p>\n<p>Linux comes with various IP subnet calculator that will help you with network settings. Once such program is Sipcalc which is an ip subnet calculator. You can install it as follows under Debian or Ubuntu Linux:<br \/>\n<code>$ sudo apt-get update<br \/>\n$ sudo apt-get install sipcalc<br \/>\n<\/code><br \/>\nSample outputs:<br \/>\n<code><br \/>\nReading package lists... Done<br \/>\nBuilding dependency tree<br \/>\nReading state information... Done<br \/>\nThe following NEW packages will be installed:<br \/>\n  sipcalc<br \/>\n0 upgraded, 1 newly installed, 0 to remove and 51 not upgraded.<br \/>\nNeed to get 30.6kB of archives.<br \/>\nAfter this operation, 123kB of additional disk space will be used.<br \/>\nGet:1 http:\/\/archive.ubuntu.com\/ubuntu\/ lucid\/universe sipcalc 1.1.4-2 [30.6kB]<br \/>\nFetched 30.6kB in 2s (15.1kB\/s)<br \/>\nSelecting previously deselected package sipcalc.<br \/>\n(Reading database ... 203411 files and directories currently installed.)<br \/>\nUnpacking sipcalc (from ...\/sipcalc_1.1.4-2_i386.deb) ...<br \/>\nProcessing triggers for man-db ...<br \/>\nProcessing triggers for doc-base ...<br \/>\nProcessing 1 added doc-base file(s)...<br \/>\nRegistering documents with scrollkeeper...<br \/>\nSetting up sipcalc (1.1.4-2) ...<\/code><\/p>\n<p><strong>How Do I Calculate Subnets?<\/strong><br \/>\n<code><br \/>\n$ sipcalc 192.168.1.0\/24<br \/>\n<\/code><br \/>\nSample outputs:<br \/>\n<code><br \/>\n-[ipv4 : 192.168.1.0\/24] - 0<\/p>\n<p>[CIDR]<br \/>\nHost address\t\t- 192.168.1.0<br \/>\nHost address (decimal)\t- 3232235776<br \/>\nHost address (hex)\t- C0A80100<br \/>\nNetwork address\t\t- 192.168.1.0<br \/>\nNetwork mask\t\t- 255.255.255.0<br \/>\nNetwork mask (bits)\t- 24<br \/>\nNetwork mask (hex)\t- FFFFFF00<br \/>\nBroadcast address\t- 192.168.1.255<br \/>\nCisco wildcard\t\t- 0.0.0.255<br \/>\nAddresses in network\t- 256<br \/>\nNetwork range\t\t- 192.168.1.0 - 192.168.1.255<br \/>\nUsable range\t\t- 192.168.1.1 - 192.168.1.254<\/code><\/p>\n<p>The above will provide network start &#038; stop range, wildcard, mask and other information. You can calculate 192.168.1.0\/24 subnet as follows<br \/>\n<code>$ sipcalc 192.168.1.5\/24<\/code><\/p>\n<p><strong>Interface Specific Calculation<\/strong><\/p>\n<p>Instead of taking address information from the shell command line arg sipcalc can obtain relevant information by looking at a specified interface on the system. In this example, get information for eth0 interface:<br \/>\n<code>$ sipcalc eth0<\/code><\/p>\n<p>Sample outputs:<br \/>\n<code><br \/>\n-[int-ipv4 : eth0] - 0<\/p>\n<p>[CIDR]<br \/>\nHost address\t\t- 192.168.3.254<br \/>\nHost address (decimal)\t- 3232236542<br \/>\nHost address (hex)\t- C0A803FE<br \/>\nNetwork address\t\t- 192.168.3.0<br \/>\nNetwork mask\t\t- 255.255.255.0<br \/>\nNetwork mask (bits)\t- 24<br \/>\nNetwork mask (hex)\t- FFFFFF00<br \/>\nBroadcast address\t- 192.168.3.255<br \/>\nCisco wildcard\t\t- 0.0.0.255<br \/>\nAddresses in network\t- 256<br \/>\nNetwork range\t\t- 192.168.3.0 - 192.168.3.255<br \/>\nUsable range\t\t- 192.168.3.1 - 192.168.3.254<br \/>\nwhatmask Program<br \/>\n<\/code><\/p>\n<p>Whatmask is a small C program that will help you with network settings. Download and compile it as follows:<br \/>\n<code>$ cd \/tmp<br \/>\n$ wget http:\/\/downloads.laffeycomputer.com\/current_builds\/whatmask\/whatmask-1.2.tar.gz<br \/>\n$ tar -zxvf whatmask-1.2.tar.gz<br \/>\n$ cd whatmask-1.2\/<br \/>\n$ .\/configure<br \/>\n$ make<br \/>\n$ sudo make install<br \/>\n<\/code><br \/>\nYou can use it as follows to find out usable ip address with \/29:<br \/>\n<code>$ whatmask \/29<\/p>\n<p>Sample outputs:<\/p>\n<p>---------------------------------------------<br \/>\n       TCP\/IP SUBNET MASK EQUIVALENTS<br \/>\n---------------------------------------------<br \/>\nCIDR = .....................: \/29<br \/>\nNetmask = ..................: 255.255.255.248<br \/>\nNetmask (hex) = ............: 0xfffffff8<br \/>\nWildcard Bits = ............: 0.0.0.7<br \/>\nUsable IP Addresses = ......: 6<\/code><br \/>\nOR<br \/>\n<code>$ whatmask 202.54.1.2\/27<\/p>\n<p>Sample outputs:<\/p>\n<p>------------------------------------------------<br \/>\n           TCP\/IP NETWORK INFORMATION<br \/>\n------------------------------------------------<br \/>\nIP Entered = ..................: 202.54.1.2<br \/>\nCIDR = ........................: \/27<br \/>\nNetmask = .....................: 255.255.255.224<br \/>\nNetmask (hex) = ...............: 0xffffffe0<br \/>\nWildcard Bits = ...............: 0.0.0.31<br \/>\n------------------------------------------------<br \/>\nNetwork Address = .............: 202.54.1.0<br \/>\nBroadcast Address = ...........: 202.54.1.31<br \/>\nUsable IP Addresses = .........: 30<br \/>\nFirst Usable IP Address = .....: 202.54.1.1<br \/>\nLast Usable IP Address = ......: 202.54.1.30<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>From cyberciti.biz I&#8217;m new to networking and need help with network settings. I&#8217;m looking for a tool for calculating available host address ranges with CIDR using Linux command prompt. How do I use subnet calculator under Linux or UNIX? Linux comes with various IP subnet calculator that will help you with network settings. Once such&#8230; <\/p>\n<div class=\"read-more navbutton\"><a href=\"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/\">Read More<i class=\"fa fa-angle-double-right\"><\/i><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-3315","post","type-post","status-publish","format-standard","hentry","category-info"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Linux: Subnet (CIDR) Calculator - Linux Shtuff<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux: Subnet (CIDR) Calculator - Linux Shtuff\" \/>\n<meta property=\"og:description\" content=\"From cyberciti.biz I&#8217;m new to networking and need help with network settings. I&#8217;m looking for a tool for calculating available host address ranges with CIDR using Linux command prompt. How do I use subnet calculator under Linux or UNIX? Linux comes with various IP subnet calculator that will help you with network settings. Once such... Read More\" \/>\n<meta property=\"og:url\" content=\"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/\" \/>\n<meta property=\"og:site_name\" content=\"Linux Shtuff\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:author\" content=\"https:\/\/fb.me\/g33kinf0\" \/>\n<meta property=\"article:published_time\" content=\"2010-07-09T02:13:37+00:00\" \/>\n<meta name=\"author\" content=\"g33kadmin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/drsinger1111\" \/>\n<meta name=\"twitter:site\" content=\"@drsinger1111\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/\"},\"author\":{\"name\":\"g33kadmin\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"headline\":\"Linux: Subnet (CIDR) Calculator\",\"datePublished\":\"2010-07-09T02:13:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/\"},\"wordCount\":181,\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"articleSection\":[\"General Info\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/\",\"name\":\"Linux: Subnet (CIDR) Calculator - Linux Shtuff\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\"},\"datePublished\":\"2010-07-09T02:13:37+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/linux-subnet-cidr-calculator\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux: Subnet (CIDR) Calculator\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#website\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/\",\"name\":\"Linux Shtuff\",\"description\":\"Because I have CRS Syndrome...\",\"publisher\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/#\\\/schema\\\/person\\\/c022e4c40b13ea1b678e6f020756f547\",\"name\":\"g33kadmin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"url\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"contentUrl\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\",\"width\":512,\"height\":512,\"caption\":\"g33kadmin\"},\"logo\":{\"@id\":\"https:\\\/\\\/g33kinfo.com\\\/info\\\/wp-content\\\/uploads\\\/2022\\\/07\\\/minion-researchA.gif\"},\"description\":\"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\\\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....\",\"sameAs\":[\"https:\\\/\\\/thelinuxreport.com\",\"https:\\\/\\\/fb.me\\\/g33kinf0\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/drsinger1111\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Linux: Subnet (CIDR) Calculator - Linux Shtuff","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/","og_locale":"en_US","og_type":"article","og_title":"Linux: Subnet (CIDR) Calculator - Linux Shtuff","og_description":"From cyberciti.biz I&#8217;m new to networking and need help with network settings. I&#8217;m looking for a tool for calculating available host address ranges with CIDR using Linux command prompt. How do I use subnet calculator under Linux or UNIX? Linux comes with various IP subnet calculator that will help you with network settings. Once such... Read More","og_url":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/","og_site_name":"Linux Shtuff","article_publisher":"https:\/\/fb.me\/g33kinf0","article_author":"https:\/\/fb.me\/g33kinf0","article_published_time":"2010-07-09T02:13:37+00:00","author":"g33kadmin","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/drsinger1111","twitter_site":"@drsinger1111","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/#article","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/"},"author":{"name":"g33kadmin","@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"headline":"Linux: Subnet (CIDR) Calculator","datePublished":"2010-07-09T02:13:37+00:00","mainEntityOfPage":{"@id":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/"},"wordCount":181,"publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"articleSection":["General Info"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/","url":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/","name":"Linux: Subnet (CIDR) Calculator - Linux Shtuff","isPartOf":{"@id":"https:\/\/g33kinfo.com\/info\/#website"},"datePublished":"2010-07-09T02:13:37+00:00","breadcrumb":{"@id":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/g33kinfo.com\/info\/linux-subnet-cidr-calculator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/g33kinfo.com\/info\/"},{"@type":"ListItem","position":2,"name":"Linux: Subnet (CIDR) Calculator"}]},{"@type":"WebSite","@id":"https:\/\/g33kinfo.com\/info\/#website","url":"https:\/\/g33kinfo.com\/info\/","name":"Linux Shtuff","description":"Because I have CRS Syndrome...","publisher":{"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/g33kinfo.com\/info\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/g33kinfo.com\/info\/#\/schema\/person\/c022e4c40b13ea1b678e6f020756f547","name":"g33kadmin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","url":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","contentUrl":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif","width":512,"height":512,"caption":"g33kadmin"},"logo":{"@id":"https:\/\/g33kinfo.com\/info\/wp-content\/uploads\/2022\/07\/minion-researchA.gif"},"description":"I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com\/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....","sameAs":["https:\/\/thelinuxreport.com","https:\/\/fb.me\/g33kinf0","https:\/\/x.com\/https:\/\/twitter.com\/drsinger1111"]}]}},"_links":{"self":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/comments?post=3315"}],"version-history":[{"count":0,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/posts\/3315\/revisions"}],"wp:attachment":[{"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/media?parent=3315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/categories?post=3315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/g33kinfo.com\/info\/wp-json\/wp\/v2\/tags?post=3315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}