{"id":741,"date":"2023-02-16T11:57:36","date_gmt":"2023-02-16T11:57:36","guid":{"rendered":"http:\/\/thejoyofstick.com\/blog\/?p=741"},"modified":"2023-02-16T11:57:36","modified_gmt":"2023-02-16T11:57:36","slug":"ipv6-shortening-and-compressing-address-rules","status":"publish","type":"post","link":"https:\/\/thejoyofstick.com\/blog\/2023\/02\/16\/ipv6-shortening-and-compressing-address-rules\/","title":{"rendered":"IPv6 shortening and compressing address rules"},"content":{"rendered":"<p>An IPv6 address can be very long as it is a 128 bits one. Asking someone verbally to check the connectivity to a given address can be tricky :-)<\/p>\n<p>There are however <a href=\"https:\/\/www.rfc-editor.org\/rfc\/rfc5952#page-10\" target=\"_blank\" rel=\"noreferrer noopener\">some rules<\/a> to shorten it and it&#8217;s a way to remove zeros.<\/p>\n<p><strong>Rule 1: Suppress leading zeros<\/strong><\/p>\n<p>Remove all leading zeros, the left side zeros, in every 16 bits field.<\/p>\n<p>For example:<\/p>\n<p><code>2001:0db8:0000:0000:0000:0000:000:0001<\/code><\/p>\n<p>will be simplified to<\/p>\n<p><code>2001:db8:0:0:0:0:0:1<\/code><\/p>\n<p>Of course <code>0000<\/code> becomes <code>0<\/code>.<\/p>\n<p><strong>Rules 2: The larger sequence of <code>:0:0:<\/code> can be reduced to <code>::<\/code><\/strong><\/p>\n<p>You can compact a sequence of zeros to the symbol <code>::<\/code>. <\/p>\n<p>Applying the rule to <code>2001:db8:0:0:0:0:0:1 <\/code>would get us <code>2001:db8::1<\/code>.<\/p>\n<ul>\n<li>You can&#8217;t compact just one <code>:0:<\/code> &#8211; only a sequence.<\/li>\n<li>If there is more than one sequence of <code>:0:<\/code> you can only compact the large one. If they have the same length compact the first one.<\/li>\n<\/ul>\n<p><code>2001:db8::1:1:1:1:1<\/code> is not correct. It must be <code>2001:db8:0:1:1:1:1:1<\/code>.<\/p>\n<p><code>2001:0:0:1:0:0:0:1<\/code> will become <code>2001:0:0:1::1<\/code>.<\/p>\n<p><code>2001:db8:0:0:1:0:0:1<\/code> will become <code>2001:db8::1:0:0:1<\/code>.<\/p>\n<p>That&#8217;s it.<\/p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>An IPv6 address can be very long as it is a 128 bits one. Asking someone verbally to check the connectivity to a given address can be tricky :-) There are however some rules to shorten it and it&#8217;s a&hellip; <a href=\"https:\/\/thejoyofstick.com\/blog\/2023\/02\/16\/ipv6-shortening-and-compressing-address-rules\/\" class=\"more-link\">Continue Reading <span class=\"meta-nav\">&rarr;<\/span><\/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":""},"categories":[],"tags":[71],"class_list":["post-741","post","type-post","status-publish","format-standard","hentry","tag-ipv6"],"jetpack_shortlink":"https:\/\/wp.me\/pcmwlL-bX","jetpack_sharing_enabled":true,"jetpack_likes_enabled":false,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts\/741","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/comments?post=741"}],"version-history":[{"count":0,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/posts\/741\/revisions"}],"wp:attachment":[{"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/media?parent=741"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/categories?post=741"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thejoyofstick.com\/blog\/wp-json\/wp\/v2\/tags?post=741"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}