{"id":7,"date":"2024-03-17T04:59:26","date_gmt":"2024-03-17T04:59:26","guid":{"rendered":"https:\/\/psahni.com\/?p=7"},"modified":"2024-03-23T06:43:54","modified_gmt":"2024-03-23T06:43:54","slug":"expose-ipv6-no-ipv4-from-aws-ec2-machine","status":"publish","type":"post","link":"https:\/\/psahni.com\/?p=7","title":{"rendered":"Expose IPv6 (no IPv4) from AWS &#8211; EC2 machine"},"content":{"rendered":"\n<p>This article will cover step-by-step instructions to launch a WordPress blog on an EC2 machine. This machine will only have IPv6 exposed and there will be no IPv4. But before we get into the steps, let us understand why we need IPv6 in the first place. Below are some of the reasons.<\/p>\n\n\n\n<ul>\n<li>IPv6 is better than IPv4.\n<ul>\n<li>IPv6 supports 1,028 times more IP addresses than IPv4. <\/li>\n\n\n\n<li>It is comparatively faster than IPv4<\/li>\n\n\n\n<li>IPv6 has larger packet headers (about twice as large as IPv4).<\/li>\n\n\n\n<li>IPv6 includes built-in Quality of Service (QoS).<\/li>\n\n\n\n<li>IPv6 has a built-in network security layer (IPsec).<\/li>\n\n\n\n<li>IPv6 eliminates Network Address Translation (NAT) and allows end-to-end connectivity at the IP layer.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>IPv4 is not free anymore from February 2024 under AWS Free Tier. Read more about it on <a href=\"https:\/\/aws.amazon.com\/blogs\/aws\/new-aws-public-ipv4-address-charge-public-ip-insights\/\" target=\"_blank\" rel=\"noopener\" title=\"AWS News Blog\">AWS News Blog<\/a>. Why pay for IPv4 if you have a better and faster alternative?<\/li>\n<\/ul>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-color\">IPv6 is not supported in t2.micro instance. You need to have a minimum of t3.micro for IPv6 support. AWS has a policy for all the regions that support t2.micro, you cannot use t3.micro under the free tier. Since I am using an <a href=\"https:\/\/aws.amazon.com\/free\/?all-free-tier.sort-by=item.additionalFields.SortRank&amp;all-free-tier.sort-order=asc&amp;awsf.Free%20Tier%20Types=*all&amp;awsf.Free%20Tier%20Categories=*all#Learn_more_about_AWS_Free_Tier_Products\" target=\"_blank\" rel=\"noopener\" title=\"\">AWS free tier<\/a>, I will use <em>Europe (Stockholm) eu-north-1<\/em> region for this blog because this region doesn&#8217;t support t2.micro so t3.micro is the only option AWS have under the <\/mark>free tier, exactly what I need. However, feel free to use any EC2 instance that supports IPv6 if you&#8217;ve not using the <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-color\">AWS free tier.<\/mark><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"624\" height=\"1024\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/1-624x1024.png\" alt=\"\" class=\"wp-image-17\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/1-624x1024.png 624w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/1-183x300.png 183w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/1-768x1260.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/1-936x1536.png 936w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/1.png 952w\" sizes=\"(max-width: 624px) 100vw, 624px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p>This post will contain steps from creating VPC, subnets, Route Tables, EC2 machine, etc. <a href=\"https:\/\/psahni.com\/?p=7&amp;page=2\" title=\"\">Let&#8217;s get started with VPC<\/a>.<\/p>\n\n\n\n<!--nextpage-->\n\n\n\n<p> Assuming you have read the introduction on the <a href=\"https:\/\/psahni.com\/?p=7\">first page<\/a> since it is important to understand the rationale behind moving from IPv4 to IPv6. Let us create a VPC first since AWS architecture starts from here. <\/p>\n\n\n\n<h3 class=\"wp-block-heading\">IPv6 changes at VPC<\/h3>\n\n\n\n<p>Once you create a VPC, it is mandatory to mention IPv6 CIDR. Classless Inter-Domain Routing (CIDR) is an IP address allocation method that improves data routing efficiency on the internet. Every machine, server, and end-user device that connects to the internet has a unique number, called an IP address, associated with it. You can read about it from <a href=\"https:\/\/aws.amazon.com\/what-is\/cidr\/\" title=\"\">AWS docs on CIDR<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"457\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/2-1024x457.png\" alt=\"\" class=\"wp-image-24\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/2-1024x457.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/2-300x134.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/2-768x343.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/2-1536x686.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/2-2048x915.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">IPv6 changes for Subnets<\/h3>\n\n\n\n<p>By default, our subnets will come with IPv4 as shown in the image below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"255\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/3-1024x255.png\" alt=\"\" class=\"wp-image-25\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/3-1024x255.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/3-300x75.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/3-768x191.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/3-1536x382.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/3-2048x509.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>We have to remove IPv4 and add IPv6 from the CIDR range given for the VPC. I have two subnets, Let us edit them one by one. Please see in the screenshot that we have selected <mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-accent-color\"><strong>No IPv4 CIDR<\/strong><\/mark> and manually selected <strong>IPv6 CIDR block<\/strong>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"976\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/4-1024x976.png\" alt=\"\" class=\"wp-image-26\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/4-1024x976.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/4-300x286.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/4-768x732.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/4-1536x1464.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/4.png 1618w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Once we remove IPv4 from the subnets, add IPv6 and save, you can see that the IPv4 is coming as blank on the subnets list screen.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"212\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/6-1024x212.png\" alt=\"\" class=\"wp-image-29\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/6-1024x212.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/6-300x62.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/6-768x159.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/6-1536x318.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/6-2048x425.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\">Update RouteTable to IPv6<\/h2>\n\n\n\n<p>Update RouteTable to support ::\/0 (destination) and target default internet gateway like below. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/7-1024x460.png\" alt=\"\" class=\"wp-image-34\" style=\"width:840px;height:auto\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/7-1024x460.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/7-300x135.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/7-768x345.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/7-1536x690.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/7-2048x920.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>After saving that changes your route-table should like below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"511\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/8-1024x511.png\" alt=\"\" class=\"wp-image-35\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/8-1024x511.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/8-300x150.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/8-768x383.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/8-1536x766.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/8-2048x1022.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Update security group to support IPv6<\/h2>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/9-1024x640.png\" alt=\"\" class=\"wp-image-36\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/9-1024x640.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/9-300x188.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/9-768x480.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/9-1536x960.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/9-2048x1280.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\">Create an EC2 machine in the Stockholm (eu-north-1) region<\/h2>\n\n\n\n<p><strong>Choose the right EC2 instance.<\/strong><\/p>\n\n\n\n<p>Select the Instance type as t3.micro and above because t2.micro doesn&#8217;t support IPv6. if you&#8217;re using the Free tier, ensure that your t3.micro is &#8220;Free tier eligible&#8221; <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"460\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/10-1024x460.png\" alt=\"\" class=\"wp-image-37\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/10-1024x460.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/10-300x135.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/10-768x345.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/10-1536x690.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/10-2048x920.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Select the security group<\/strong><\/p>\n\n\n\n<p>Choose the security group that we had created on the last page<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"431\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/11-1024x431.png\" alt=\"\" class=\"wp-image-39\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/11-1024x431.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/11-300x126.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/11-768x324.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/11-1536x647.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/11-2048x863.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><strong>Create an instance.<\/strong><\/p>\n\n\n\n<p>Create an instance and copy the private-key that will help you to do ssh and scp to the ec2 machine. There are other ways as well to get shell access of your machine without exposing IPv4 like <strong>Systems Manager but that is out of the <\/strong>scope of this blog.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"423\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/12-1024x423.png\" alt=\"\" class=\"wp-image-43\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/12-1024x423.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/12-300x124.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/12-768x317.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/12-1536x635.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/12-2048x846.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\">Expose public IPv6<\/h2>\n\n\n\n<p>Go to the <strong>Manage IP Addresses <\/strong>tab of your AWS Dashboard as shown in the figure below<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"395\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/14-1024x395.png\" alt=\"\" class=\"wp-image-42\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/14-1024x395.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/14-300x116.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/14-768x296.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/14-1536x592.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/14-2048x790.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Choose IPv6. Ensure that there is no IPv4 exposed.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"522\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/15-assign-ipv6-1024x522.png\" alt=\"\" class=\"wp-image-44\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/15-assign-ipv6-1024x522.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/15-assign-ipv6-300x153.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/15-assign-ipv6-768x391.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/15-assign-ipv6-1536x783.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/15-assign-ipv6-2048x1044.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<!--nextpage-->\n\n\n\n<h2 class=\"wp-block-heading\">Validate your website running on IPv6<\/h2>\n\n\n\n<p>Copy your IPv6 from the last page and validate if it is accessible from the internet<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"170\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/18-wp-admin-1024x170.png\" alt=\"\" class=\"wp-image-47\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/18-wp-admin-1024x170.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/18-wp-admin-300x50.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/18-wp-admin-768x127.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/18-wp-admin-1536x254.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/18-wp-admin-2048x339.png 2048w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>You can choose to add a Target Group and Load Balancer for your website but it out of scope of this blog post.<\/p>\n\n\n\n<p>I have observed that a few ISP block IPv6 in India. If this is the case with your ISP, you won&#8217;t be able to access website or do ssh on your IPv6. You should see a error like below while doing ssh.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"235\" src=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/shell1-1024x235.png\" alt=\"\" class=\"wp-image-48\" srcset=\"https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/shell1-1024x235.png 1024w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/shell1-300x69.png 300w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/shell1-768x176.png 768w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/shell1-1536x352.png 1536w, https:\/\/psahni.com\/wp-content\/uploads\/2024\/03\/shell1.png 1998w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>This problem is not with your configuration, AWS setup, Network settings or laptop. You have to work with your ISP to get it fixed.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This article will cover step-by-step instructions to launch a WordPress blog on an EC2 machine. This machine will only have IPv6 exposed and there will be no IPv4. But before we get into the steps, let us understand why we need IPv6 in the first place. Below are some of the reasons. IPv6 is not [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[1],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/psahni.com\/index.php?rest_route=\/wp\/v2\/posts\/7"}],"collection":[{"href":"https:\/\/psahni.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/psahni.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/psahni.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/psahni.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7"}],"version-history":[{"count":17,"href":"https:\/\/psahni.com\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions"}],"predecessor-version":[{"id":52,"href":"https:\/\/psahni.com\/index.php?rest_route=\/wp\/v2\/posts\/7\/revisions\/52"}],"wp:attachment":[{"href":"https:\/\/psahni.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/psahni.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/psahni.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}