How to disable IPv6 on Ubuntu, Linux Mint, and Debian
[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.
Enable IPV6 in Ubuntu
IPV6 address for Cisco CCIE Certification knowledge points
How to capture IPV6 data packets in WireShark
Use IPV6 source for traffic-free updates on Ubuntu 12.04 Campus Network
Build an IPV6 ftp server in Linux
CentOS IPV6 settings
Set Update source in CentOS pure IPV6 environment
How to disable CentOS 6 IPV6
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.
- $ Ifconfig
- Eth0 Link encap: EthernetHWaddr00: 1c: c0: f8: 79: ee
- Inet addr: 192.168.1.2Bcast: 192.168.1.255Mask: 255.255.255.0
- Inet6 addr: fe80: 21c: c0ff: fef8: 79ee/64 Scope: Link
- Up broadcast running multicast mtu: 1500 Metric: 1
- RX packets: 110880 errors: 0 dropped: 0 overruns: 0 frame: 0
- TX packets: 111960 errors: 0 dropped: 0 overruns: 0 carrier: 0
- Collisions: 0 FIG: 1000
- RX bytes: 62289395 (62.2 MB) TX bytes: 25169458 (25.1 MB)
- Interrupt: 20 Memory: e3200000-e3220000
- Lo Link encap: LocalLoopback
- Inet addr: 127.0.0.1Mask: 255.0.0.0
- Inet6 addr: 1/128 Scope: Host
- Up loopback running mtu: 65536 Metric: 1
- RX packets: 45258 errors: 0 dropped: 0 overruns: 0 frame: 0
- TX packets: 45258 errors: 0 dropped: 0 overruns: 0 carrier: 0
- Collisions: 0 txqueuelen: 0
- 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:
- $ Sysctl net. ipv6.conf. all. disable_ipv6
- Net. ipv6.conf. all. disable_ipv6 = 0
- $ Sysctl net. ipv6.conf. default. disable_ipv6
- Net. ipv6.conf. default. disable_ipv6 = 0
- $ Sysctl net. ipv6.conf. lo. disable_ipv6
- Net. ipv6.conf. lo. disable_ipv6 = 0
You can also check in the proc file
- $ Cat/proc/sys/net/ipv6/conf/all/disable_ipv6
- 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 causes domain name query latency, and does not need to connect to IPv6 addresses during network connection.
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.
- $ Sudo apt-get update
- Ign http://archive.canonical.com trusty InRelease
- Ign http://archive.canonical.com (raring InRelease)
- Err http://archive.canonical.com trusty Release. gpg
- Cannot initiate the connection to archive.canonical.com: 80 (2001: 67c: 1360: 8c01: 1b ). -connect (101: Networkis unreachable) [IP: 2001: 67c: 1360: 8c01: 1b80]
- Err http://archive.canonical.com raring Release. gpg
- Cannot initiate the connection to archive.canonical.com: 80 (2001: 67c: 1360: 8c01: 1b ). -connect (101: Networkis unreachable) [IP: 2001: 67c: 1360: 8c01: 1b80]
- .....
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
- $ Sudo gedit/etc/sysctl. conf
Add the following lines at the end of the file.
- # IPv6 disabled
- Net. ipv6.conf. all. disable_ipv6 = 1
- Net. ipv6.conf. default. disable_ipv6 = 1
- Net. ipv6.conf. lo. disable_ipv6 = 1
Save and close
Restart sysctl
- $ Sudo sysctl-p
Check the output of ifconfig again. There should be no IPv6 address.
- $ Ifconfig
- Eth0 Link encap: EthernetHWaddr08: 00: 27: 5f: 28: 8b
- Inet addr: 192.168.1.3Bcast: 192.168.1.255Mask: 255.255.255.0
- Up broadcast running multicast mtu: 1500 Metric: 1
- RX packets: 1346 errors: 0 dropped: 0 overruns: 0 frame: 0
- TX packets: 965 errors: 0 dropped: 0 overruns: 0 carrier: 0
- Collisions: 0 FIG: 1000
- 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.
- $ Sudo gedit/etc/default/grub
Search for "GRUB"CMDLINELINUX, and edit it as follows:
- 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.
- $ Sudo update-grub2
Restart. IPv6 should be disabled now.
Via: http://www.binarytides.com/disable-ipv6-ubuntu/
Translator: geekpi, Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China