How to disable IPv6 on Ubuntu, LinuxMint, and Debian

Source: Internet
Author: User
Tags gpg
[Editor's note] the IPv4 address is exhausted and IPv6 is to be promoted, but it has been delayed. In this case, do not let it disturb our system before it is ready. IPv6IPv6 is the next version of IPv4 in the addressing scheme. It is used to assign a digital address to the domain name. IPv6 supports more addresses than IPv4. However, it has not been widely supported and is still being accepted. Ubuntu enables IPV6http: // www.linuxidc.com/Linux/2013-0

[Editor's note] the IPv4 address is exhausted and IPv6 is to be promoted, but it has been delayed. In this case, do not let it disturb our system before it is ready.

IPv6

IPv6 is the next version of IPv4 in the addressing scheme. It is used to assign a digital address to the domain name.

IPv6 supports more addresses than IPv4. However, it has not been widely supported and is still being accepted.

Ubuntu enables IPV6 http://www.linuxidc.com/Linux/2013-03/80479.htm

IPV6 address http://www.linuxidc.com/Linux/2013-01/78078.htm for Cisco CCIE Certification knowledge points

WireShark capture IPV6 packet use tutorial http://www.linuxidc.com/Linux/2013-01/77518.htm

Use IPV6 source without traffic update http://www.linuxidc.com/Linux/2012-07/66240.htm on Ubuntu 12.04 Campus Network

Build IPV6 ftp server http://www.linuxidc.com/Linux/2012-07/65150.htm in Linux

CentOS IPV6 settings http://www.linuxidc.com/Linux/2012-06/63644.htm

Configure update source http://www.linuxidc.com/Linux/2012-06/63643.htm in CentOS pure IPV6 environment

CentOS 6 IPV6 disabling method http://www.linuxidc.com/Linux/2012-06/63642.htm

Does your system support IPv6?

To support IPv6. First, you need to support IPv6. Ubuntu, Linux Mint, and most modern releases support it. If you look at the ifconfig command output, you will see that your network interface is assigned an IPv6 address.

  1. $ Ifconfig
  2. Eth0 Link encap: EthernetHWaddr00: 1c: c0: f8: 79: ee
  3. Inet addr: 192.168.1.2Bcast: 192.168.1.255Mask: 255.255.255.0
  4. Inet6 addr: fe80: 21c: c0ff: fef8: 79ee/64 Scope: Link
  5. Up broadcast running multicast mtu: 1500 Metric: 1
  6. RX packets: 110880 errors: 0 dropped: 0 overruns: 0 frame: 0
  7. TX packets: 111960 errors: 0 dropped: 0 overruns: 0 carrier: 0
  8. Collisions: 0 FIG: 1000
  9. RX bytes: 62289395 (62.2 MB) TX bytes: 25169458 (25.1 MB)
  10. Interrupt: 20 Memory: e3200000-e3220000
  11. Lo Link encap: LocalLoopback
  12. Inet addr: 127.0.0.1Mask: 255.0.0.0
  13. Inet6 addr: 1/128 Scope: Host
  14. Up loopback running mtu: 65536 Metric: 1
  15. RX packets: 45258 errors: 0 dropped: 0 overruns: 0 frame: 0
  16. TX packets: 45258 errors: 0 dropped: 0 overruns: 0 carrier: 0
  17. Collisions: 0 txqueuelen: 0
  18. RX bytes: 4900560 (4.9 MB) TX bytes: 4900560 (4.9 MB)

Let's take a look at "inet6 addr ".

Next, you need a router/MODEM that supports IPv6. In addition, your ISP must support IPv6.

In addition to checking each part of the network device, it is best to check whether you can access the website through IPv6.

There are a lot of websites that can detect whether your network connection supports IPv6. here is an example: http://testmyipv6.com/

The following are the parameters for enabling IPv6 in the kernel:

  1. $ Sysctl net. ipv6.conf. all. disable_ipv6
  2. Net. ipv6.conf. all. disable_ipv6 = 0
  3. $ Sysctl net. ipv6.conf. default. disable_ipv6
  4. Net. ipv6.conf. default. disable_ipv6 = 0
  5. $ Sysctl net. ipv6.conf. lo. disable_ipv6
  6. Net. ipv6.conf. lo. disable_ipv6 = 0

You can also check in the proc file

  1. $ Cat/proc/sys/net/ipv6/conf/all/disable_ipv6
  2. 0

Note that the variable here controls the "Disable" of IPv6 ". Therefore, IPv6 is disabled when 1 is set.

Disable IPv6 if it does not support

If your network device does not support IPv6, it is best to disable them all. Why? This may cause domain name query latency and delay caused by unnecessary attempts to connect to IPv6 addresses during network connections.

I have also encountered problems like this. The apt-get command occasionally tries to connect to the IPv6 address and fails to retrieve the IPv4 address. Let's look at the output under "outputs.

  1. $ Sudo apt-get update
  2. Ign http://archive.canonical.com trusty InRelease
  3. Ign http://archive.canonical.com (raring InRelease)
  4. Err http://archive.canonical.com trusty Release. gpg
  5. Cannot initiate the connection to archive.canonical.com: 80 (2001: 67c: 1360: 8c01: 1b ). -connect (101: Networkis unreachable) [IP: 2001: 67c: 1360: 8c01: 1b80]
  6. Err http://archive.canonical.com raring Release. gpg
  7. Cannot initiate the connection to archive.canonical.com: 80 (2001: 67c: 1360: 8c01: 1b ). -connect (101: Networkis unreachable) [IP: 2001: 67c: 1360: 8c01: 1b80]
  8. .....

Errors like this are more frequent in the recent Ubuntu, and it may be more frequent than before to try to use IPv6 addresses.

I also noticed similar problems in other applications, such as Hexchat. Similarly, Google Chrome sometimes takes a longer time to query domain names.

So the best solution is to completely disable IPv6 to get rid of these issues. This only requires a little configuration, but it can help you solve many problems on your system. The user even responds to this to accelerate the network.

Disable IPv6-solution 1

Edit the file-/etc/sysctl. conf

  1. $ Sudo gedit/etc/sysctl. conf

Add the following lines at the end of the file.

  1. # IPv6 disabled
  2. Net. ipv6.conf. all. disable_ipv6 = 1
  3. Net. ipv6.conf. default. disable_ipv6 = 1
  4. Net. ipv6.conf. lo. disable_ipv6 = 1

Save and close

Restart sysctl

  1. $ Sudo sysctl-p

Check the output of ifconfig again. There should be no IPv6 address.

  1. $ Ifconfig
  2. Eth0 Link encap: EthernetHWaddr08: 00: 27: 5f: 28: 8b
  3. Inet addr: 192.168.1.3Bcast: 192.168.1.255Mask: 255.255.255.0
  4. Up broadcast running multicast mtu: 1500 Metric: 1
  5. RX packets: 1346 errors: 0 dropped: 0 overruns: 0 frame: 0
  6. TX packets: 965 errors: 0 dropped: 0 overruns: 0 carrier: 0
  7. Collisions: 0 FIG: 1000
  8. RX bytes: 1501691 (1.5 MB) TX bytes: 104883 (104.8 KB)

If not, restart the system and check ifconfig again.

Disable the IPv6-GRUB Solution

You can also disable IPv6 by editing the grub configuration file.

  1. $ Sudo gedit/etc/default/grub

Search for "GRUB"CMDLINELINUX, and edit it as follows:

  1. GRUB_CMDLINE_LINUX = "cmd6.disable = 1"

You can also add "GRUB"CMDLINELINUX_DEFAULT "variable, which is also useful. Save and close the file and regenerate the grub configuration.

  1. $ Sudo update-grub2

Restart. IPv6 should be disabled now.

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2014-07/104192.htm

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.