{"id":51,"date":"2016-07-21T09:33:50","date_gmt":"2016-07-21T12:33:50","guid":{"rendered":"http:\/\/xaxowareti.com.br\/?p=51"},"modified":"2023-10-16T09:36:22","modified_gmt":"2023-10-16T12:36:22","slug":"how-to-disable-ipv6-on-ubuntu-linux-mint-debian","status":"publish","type":"post","link":"https:\/\/xaxowareti.com.br\/?p=51","title":{"rendered":"How to disable Ipv6 on Ubuntu, Linux Mint, Debian."},"content":{"rendered":"<h3>Ipv6<\/h3>\n<p>Ipv6 is the next version of the addressing scheme Ipv4 that is currently being used to assign numerical address to domain names like google.com over the internet.<\/p>\n<div class=\"adcontent\"><\/div>\n<p>Ipv6 allows for more addresses than what Ipv4 supports. However it is not yet widely supported and its adoption is still in progress.<\/p>\n<h3>Does your system support ipv6 ?<\/h3>\n<p>Check out <a href=\"http:\/\/testmyipv6.com\/\" target=\"_blank\" rel=\"noopener\">http:\/\/testmyipv6.com\/<\/a> to see if you network supports Ipv6.<\/p>\n<p>For Ipv6 to work you need &#8211;<\/p>\n<p>1. An OS that supports IPv6. Ubuntu and most modern Linuxes do that.<br \/>\n2. Your network hardware (router\/modem) must support Ipv6. Many of the good brands do.<br \/>\n3. Your ISP must also support IPv6. This is something that is not present everywhere !<\/p>\n<p>Check the output of ifconfig command to see the &#8220;inet6 addr&#8221; line.<\/p>\n<pre class=\"terminal\">$ ifconfig\r\neth0      Link encap:Ethernet  HWaddr 00:1c:c0:f8:79:ee  \r\n          inet addr:192.168.1.2  Bcast:192.168.1.255  Mask:255.255.255.0\r\n          inet6 addr: fe80::21c:c0ff:fef8:79ee\/64 Scope:Link\r\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\r\n.....<\/pre>\n<h3>Problems if ipv6 not supported<\/h3>\n<p>So if ipv6 is not supported on your network infrastructure, it might be useful to disable it all together. It can cause issues like delayed domain lookups, un-necessary attempts to connect to ipv6 addresses causing delay in network connection etc.<\/p>\n<p>I did come across some problems like that. The apt-get command occasionally tries to connect to ipv6 addresses and fails and then retries an ipv4 address. Take a look at this output<\/p>\n<pre class=\"terminal\">$ sudo apt-get update\r\nIgn http:\/\/archive.canonical.com trusty InRelease\r\nIgn http:\/\/archive.canonical.com raring InRelease                                                                                                    \r\nErr http:\/\/archive.canonical.com trusty Release.gpg                                                                                                  \r\n  Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) [IP: 2001:67c:1360:8c01::1b 80]\r\nErr http:\/\/archive.canonical.com raring Release.gpg                                                                                                  \r\n  Cannot initiate the connection to archive.canonical.com:80 (2001:67c:1360:8c01::1b). - connect (101: Network is unreachable) [IP: 2001:67c:1360:8c01::1b 80]\r\n\r\n.....<\/pre>\n<p>Errors like those have been more frequent in the recent Ubuntu versions, probably because they try to use Ipv6 more than before.<\/p>\n<pre class=\"adwrap\"><\/pre>\n<p>I noticed similar issues happen in other applications like Hexchat and also Google Chrome which would sometimes take longer than usual to lookup a domain name.<\/p>\n<p>So the best solution is to disable Ipv6 entirely to get rid of those things. It takes only a small configuration and can help you solve many network issues on your system. Users have even reported an increase in internet speed.<\/p>\n<h3>Method 1 &#8211; Disable from sysctl<\/h3>\n<p>The first method to disable Ipv6 is to edit kernel level parameters via sysctl interface.<br \/>\nThe kernel parameters that enable ipv6 are as follows<\/p>\n<pre class=\"pre_text\">$ sysctl net.ipv6.conf.all.disable_ipv6\r\nnet.ipv6.conf.all.disable_ipv6 = 0\r\n$ sysctl net.ipv6.conf.default.disable_ipv6\r\nnet.ipv6.conf.default.disable_ipv6 = 0\r\n$ sysctl net.ipv6.conf.lo.disable_ipv6\r\nnet.ipv6.conf.lo.disable_ipv6 = 0<\/pre>\n<p>Note that the variables control &#8220;disabling&#8221; of ipv6. So setting them to 1 would disable ipv6<br \/>\nEdit the file &#8211; <strong>\/etc\/sysctl.conf<\/strong><\/p>\n<pre class=\"terminal\">$ sudo gedit \/etc\/sysctl.conf<\/pre>\n<p>And fill in the following lines at the end of that file<\/p>\n<pre class=\"pre_text\"># IPv6 disabled\r\nnet.ipv6.conf.all.disable_ipv6 = 1\r\nnet.ipv6.conf.default.disable_ipv6 = 1\r\nnet.ipv6.conf.lo.disable_ipv6 = 1<\/pre>\n<p>Save the file and close it. Restart sysctl with<\/p>\n<pre class=\"terminal\">$ sudo sysctl -p<\/pre>\n<p>Check the output of ifconfig again and there should be <strong>no ipv6 address<\/strong><\/p>\n<pre class=\"terminal\">$ ifconfig\r\neth0      Link encap:Ethernet  HWaddr 08:00:27:5f:28:8b  \r\n          inet addr:192.168.1.3  Bcast:192.168.1.255  Mask:255.255.255.0\r\n          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1\r\n          RX packets:1346 errors:0 dropped:0 overruns:0 frame:0\r\n          TX packets:965 errors:0 dropped:0 overruns:0 carrier:0\r\n.....<\/pre>\n<p>If it does not work, then try rebooting the system and check ifconfig again.<\/p>\n<h3>Method 2 : Disable ipv6 from GRUB<\/h3>\n<p>Ipv6 can also be disabled by editing the grub configuration file<\/p>\n<pre class=\"terminal\">$ sudo gedit \/etc\/default\/grub<\/pre>\n<p>Look for the line containing &#8220;GRUB_CMDLINE_LINUX&#8221; and edit it as follows<\/p>\n<pre class=\"pre_text\">GRUB_CMDLINE_LINUX=\"ipv6.disable=1\"<\/pre>\n<p>The same can also be added to the value of the variable named &#8220;GRUB_CMDLINE_LINUX_DEFAULT&#8221; and either would work. Save the file, close it and regenerate the grub configuration<\/p>\n<pre class=\"terminal\">$ sudo update-grub2<\/pre>\n<p>Reboot. Now ipv6 should be disabled.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ipv6 Ipv6 is the next version of the addressing scheme Ipv4 that is currently being used to assign numerical address to domain names like google.com over the internet. Ipv6 allows for more addresses than what Ipv4 supports. However it is not yet widely supported and its adoption is still in progress. Does your system support [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,2],"tags":[],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-dicassolucoes","category-geral"],"_links":{"self":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=51"}],"version-history":[{"count":3,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":531,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=\/wp\/v2\/posts\/51\/revisions\/531"}],"wp:attachment":[{"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xaxowareti.com.br\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}