{"id":5484,"date":"2019-02-24T20:59:16","date_gmt":"2019-02-24T20:59:16","guid":{"rendered":"https:\/\/really.zonky.org\/?p=5484"},"modified":"2019-02-24T20:59:16","modified_gmt":"2019-02-24T20:59:16","slug":"manually-setting-ip-addresses-use-cidr-format","status":"publish","type":"post","link":"https:\/\/really.zonky.org\/?p=5484","title":{"rendered":"Manually Setting IP Addresses &#8211; Use CIDR Format!"},"content":{"rendered":"\n<p>Normally when you set an IP address manually on an interface you do not get a whole lot of choice of how it is done &#8211; very often you have to specify the IP address itself and a <em>network&nbsp;mask<\/em>. The addresses and masks are almost always specified as &#8220;dotted quads&#8221; (10.0.0.1) rather than the real address in binary or decimal (167772161).<\/p>\n\n\n\n<p>The network mask specifies what parts of the IP address are the network address and which are the host address &#8211; to determine whether a destination needs to go via a gateway or is on the local network. This is expressed as a bitmask like <em>255.255.255.0<\/em>. Having said that, rarely some devices (Cisco routers in the dustier parts of their code) require the reverse &#8211; <em>0.0.0.255<\/em>. <\/p>\n\n\n\n<p>An alternative approach is to use the CIDR format to specify both the IP address of the device and the size of the network &#8211; <em>10.2.9.21\/24<\/em>. This is used (at least) on Palo Alto Networks firewalls and is probably the simplest way of configuring a network address I have come across.<\/p>\n\n\n\n<p>Having configured <em>hundreds<\/em> of devices with static addresses &#8230; and helped solve oodles of network configuration issues, I feel that the CIDR format method is likely to be far less error prone. <\/p>\n\n\n\n<p>If you do need to set a netmask, use ipcalc to check what it is (and use it to cut&amp;paste rather than risk typos) :-<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u2713 mike@pica\u00bb ipcalc 10.2.9.21\/24 \nAddress:   10.2.9.21            00001010.00000010.00001001. 00010101\nNetmask:   255.255.255.0 = 24   11111111.11111111.11111111. 00000000\nWildcard:  0.0.0.255            00000000.00000000.00000000. 11111111\n=>\nNetwork:   10.2.9.0\/24          00001010.00000010.00001001. 00000000\nHostMin:   10.2.9.1             00001010.00000010.00001001. 00000001\nHostMax:   10.2.9.254           00001010.00000010.00001001. 11111110\nBroadcast: 10.2.9.255           00001010.00000010.00001001. 11111111\nHosts\/Net: 254                   Class A, Private Internet<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"695\" height=\"462\" src=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2011-01-09-Through-The-Gateway.jpg?resize=695%2C462&#038;ssl=1\" alt=\"\" class=\"wp-image-4931\" srcset=\"https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2011-01-09-Through-The-Gateway.jpg?resize=1024%2C681&amp;ssl=1 1024w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2011-01-09-Through-The-Gateway.jpg?resize=300%2C199&amp;ssl=1 300w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2011-01-09-Through-The-Gateway.jpg?resize=768%2C511&amp;ssl=1 768w, https:\/\/i0.wp.com\/really.zonky.org\/wp-content\/uploads\/2011-01-09-Through-The-Gateway.jpg?w=1280&amp;ssl=1 1280w\" sizes=\"auto, (max-width: 695px) 100vw, 695px\" \/><figcaption>Through The Gateway<\/figcaption><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>Normally when you set an IP address manually on an interface you do not get a whole lot of choice of how it is done &#8211; very often you have to specify the IP address itself and a network&nbsp;mask. The addresses and masks are almost always specified as &#8220;dotted quads&#8221; (10.0.0.1) rather than the real <a href='https:\/\/really.zonky.org\/?p=5484' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false,"_share_on_mastodon":"0"},"categories":[4,226],"tags":[1840,1841,1287],"class_list":["post-5484","post","type-post","status-publish","format-standard","hentry","category-it","category-working-notes","tag-cidr","tag-netmask","tag-risk","category-4-id","category-226-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"share_on_mastodon":{"url":"","error":""},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1f2KI-1qs","_links":{"self":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5484"}],"version-history":[{"count":1,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5484\/revisions"}],"predecessor-version":[{"id":5485,"href":"https:\/\/really.zonky.org\/index.php?rest_route=\/wp\/v2\/posts\/5484\/revisions\/5485"}],"wp:attachment":[{"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/really.zonky.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}