{"id":11631,"date":"2021-10-30T14:39:52","date_gmt":"2021-10-30T14:39:52","guid":{"rendered":"https:\/\/linuxways.net\/?p=11631"},"modified":"2021-10-30T14:39:52","modified_gmt":"2021-10-30T14:39:52","slug":"ipcalc-calculate-ip-subnet-address-in-linux","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/centos\/ipcalc-calculate-ip-subnet-address-in-linux\/","title":{"rendered":"ipcalc &#8211; Calculate IP Subnet Address in Linux"},"content":{"rendered":"<p>In advance or modern networking, you must have knowledge or deal with subnetting. Few of the system administrators or related people can do binary math in their head to calculate the exact subnet mask but some of them need help which is fulfilled by the ipcalc tool in Linux.<\/p>\n<p>In Linux, ipcalc has more abilities in the networking field. Firstly, it collects the data such as IP address and netmask then comes up with the resulting broadcast, network, Cisco wildcard mask, and host range. Also, you can create the subnets and supernets by providing the second netmask. It can be used as the teaching tool by presenting the subnetting results in an easy to understand binary values.<\/p>\n<h2>Ipcalc features<\/h2>\n<ul>\n<li>Multiple types of bitmaps as output.<\/li>\n<li>Address information is retrieved from interfaces.<\/li>\n<li>Show hostnames directed as per DNS resolutions.<\/li>\n<li>Output is presented as compressed and standard wise.<\/li>\n<li>Input address is also presented as compressed and standard wise.<\/li>\n<li>Output formats as multiple addresses and netmask.<\/li>\n<li>User defined number of extra networks as Output.<\/li>\n<li>Output of standard IPV6 network.<\/li>\n<\/ul>\n<h2>How to install ipcalc in Linux<\/h2>\n<p>Here, we are going to install ipcalc on Ubuntu 21.04. First open the terminal then run the following command to install the ipcalc tool.<\/p>\n<pre>$ sudo apt install ipcalc -y<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"723\" height=\"355\" class=\"wp-image-11632\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-644.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-644.png 723w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-644-300x147.png 300w\" sizes=\"auto, (max-width: 723px) 100vw, 723px\" \/><\/p>\n<h3>How to use ipcalc in Linux<\/h3>\n<p>Now, you can run ipcalc command with your ip address to see all information about the network addresses.<\/p>\n<pre>$ ipcalc 192.168.1.67<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"247\" class=\"wp-image-11633\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-645.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-645.png 692w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-645-300x107.png 300w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/p>\n<h3>How to calculate the subnet<\/h3>\n<p>To calculate the subnet for 192.168.1.0\/24, you can run the following command:<\/p>\n<pre>$ ipcalc 192.168.1.0\/24<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"197\" class=\"wp-image-11634\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-646.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-646.png 695w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-646-300x85.png 300w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><\/p>\n<h3>How to calculate a single subnet with 7 hosts<\/h3>\n<p>To calculate a single subnet, you can run the following command:<\/p>\n<pre>$ ipcalc 192.168.1.0 -s 7<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"685\" height=\"511\" class=\"wp-image-11635\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-647.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-647.png 685w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-647-300x224.png 300w\" sizes=\"auto, (max-width: 685px) 100vw, 685px\" \/><\/p>\n<h3>How to suppress the binary output<\/h3>\n<p>To suppress the binary output, you can run the following command by using -b option as shown below:<\/p>\n<pre>$ ipcalc -b 192.168.1.0<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"235\" class=\"wp-image-11636\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-648.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-648.png 648w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-648-300x109.png 300w\" sizes=\"auto, (max-width: 648px) 100vw, 648px\" \/><\/p>\n<h3>How to calculate a multiple subnets with single command<\/h3>\n<p>If you want to split 192.168.1.0 into three subnets and total hosts are 50. You have to specify the number of hosts and network mast in each segment.<\/p>\n<pre>$ ipcalc 192.168.1.0 -s 10 20 20<\/pre>\n<p><strong>Output:<\/strong><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"692\" height=\"763\" class=\"wp-image-11637\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-649.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-649.png 692w, https:\/\/linuxways.net\/wp-content\/uploads\/2021\/10\/word-image-649-272x300.png 272w\" sizes=\"auto, (max-width: 692px) 100vw, 692px\" \/><\/p>\n<p>To get more details on ipcalc, you can just run the following command:<\/p>\n<pre>$ ipcalc --help<\/pre>\n<p>Or,<\/p>\n<pre>$ man ipcalc<\/pre>\n<h2>Conclusion<\/h2>\n<p>In this article, you learned about the ipcalc tool and the steps to use it with certain examples. It is an important tool for network related tasks. Thank you!<\/p>","protected":false},"excerpt":{"rendered":"<p>In advance or modern networking, you must have knowledge or deal with subnetting. Few of the system administrators or related people can do binary math in their head&hellip;<\/p>","protected":false},"author":1,"featured_media":11728,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,4,5,83,165,2],"tags":[675,674,35],"class_list":["post-11631","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-debian","category-mint","category-opensuse","category-red-hat","category-ubuntu","tag-ip","tag-ipcalc","tag-linux"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11631","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=11631"}],"version-history":[{"count":1,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11631\/revisions"}],"predecessor-version":[{"id":11727,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/11631\/revisions\/11727"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/11728"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=11631"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=11631"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=11631"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}