Home / Chuyên đề tự học / Linux / How to disable IPv6 in kali Linux 2.0

How to disable IPv6 in kali Linux 2.0

Internet Protocol version 6 (IPv6) is the most recent version of the Internet Protocol (IP), the communications protocol that provides an identification and location system for computers on networks and routes traffic across the Internet. IPv6 was developed by the Internet Engineering Task Force (IETF) to deal with the long-anticipated problem of IPv4 address exhaustion. IPv6 is intended to replace IPv4. IPv6 is relatively new and sometimes depending on how it’s configured, it can behave badly. This post will show how to disable IPv6 in Linux distro such as Ubuntu, Debian, Kali, Linux Mint etc. 2000px-World_IPv6_launch_badge.svg

Every device on the Internet is assigned an IP address for identification and location definition. With the rapid growth of the Internet after commercialization in the 1990s, it became evident that far more addresses than the IPv4 address space has available were necessary to connect new devices in the future. By 1998, the Internet Engineering Task Force (IETF) had formalized the successor protocol. IPv6 uses a 128-bit address, allowing 2128, or approximately 3.4×1038 addresses, or more than 7.9×1028 times as many as IPv4, which uses 32-bit addresses and provides approximately 4.3 billion addresses. The two protocols are not designed to be interoperable, complicating the transition to IPv6. However, several IPv6 transition mechanisms have been devised to permit communication between IPv4 and IPv6 hosts.

IPv6 provides other technical benefits in addition to a larger addressing space. In particular, it permits hierarchical address allocation methods that facilitate route aggregation across the Internet, and thus limit the expansion of routing tables. The use of multicast addressing is expanded and simplified, and provides additional optimization for the delivery of services. Device mobility, security, and configuration aspects have been considered in the design of the protocol.

IPv6 addresses are represented as eight groups of four hexadecimal digits with the groups being separated by colons, for example 2001:0db8:85a3:0042:1000:8a2e:0370:7334, but methods to abbreviate this full notation exist. However it is not yet widely supported and its adoption is still in progress.

Does your system support IPv6 ?

To make IPv6 work, you need an Operating System that supports IPv6. Ubuntu, Debian, Linux Mint and most modern distros does that. You can check output of ifconfig to see if IPv6 is working and whether it’s assigned to the network interfaces:

Check the line inet6 addr

Next you need a router/modem that also supports IPv6. And beyond that, your ISP must also support IPv6.

Instead of checking every part of the network infrastructure, its better to just find out if you can connect to websites over IPv6. There are lots of websites that test IPv6 support on your connection. Check out http://testmyipv6.com/ for example.

The kernel parameters that enable IPv6 are as follows

The same can be also be checked from the proc files

Note that the variables control disabling of IPv6. So setting them to 1 would disable IPv6

Disable IPv6 if its not supported

So if IPv6 is not supported on your network infrastructure, it might be useful to disable it all together. Why ? It can cause issues like delayed domain lookups, un-necessary attempts to connect to IPv6 addresses causing delay in network connection etc.

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

Errors like those have been more frequent in the recent Ubuntu versions, probably because they try to use IPv6 more than before.

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.

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.

Method 1 – Disable IPv6

Edit the file – /etc/sysctl.conf

And fill in the following lines at the end of that file

Save the file and close it

Restart sysctl with

Check the output of ifconfig again and there should be no ipv6 address

If it does not work, then try rebooting the system and check ifconfig again.

Method 2 – Disable IPv6 – GRUB method

IPv6 can also be disabled by editing the grub configuration file

Look for the line containing GRUB_CMDLINE_LINUX and edit it as follows

The same can also be added to the value of the variable named GRUB_CMDLINE_LINUX_DEFAULT and either would work. Save the file, close it and regenerate the grub configuration

Reboot. Now IPv6 should be disabled.

Method 3 – Without disabling IPv6 – setting IPv4 as preferred over IPv6

Find at getaddrinfo(3)s configuration file; i.e. /etc/gai.conf and uncomment the line to prefer IPv4 over IPv6.

Locate this line and un-comment it:

So that it looks like this:

Save and exit the file. Reboot and you’re all set as IPv4 is preferred now. This is the best way when you want to keep IPv6 enabled but prefer IPv4 for DNS lookup or such.


Disabling IPv6 can cause problems. If your Internet connection and router have already migrated to IPv6, you’ll lose the ability to use it properly. IPv6 may also be required for some home networking functions — for example, the easy-to-use Homegroup home networking feature introduced in Windows 7, Linux etc. requires IPv6 enabled on the computers on your home network to use it.

The entire world is moving towards IPv6, although it’s happening too slowly. IPv6 is necessary to replace IPv4 — we’re running out of IPv4 addresses and IPv6 is the solution. In that context, the last method of setting preferences (Without disabling IPv6 – setting IPv4 as preferred over IPv6) is better. There’s a good chance you don’t actually need IPv6 on your network — unless you rely on Windows Homegroup or similar features — so it may not be particularly harmful to remove if if you know what you’re doing. However, you won’t see a speed improvement from clinging to IPv4 unless there are serious problems with your Internet service provider’s network or your home network.

The moral is, if you notice that IPv6 needs fixing, fix it today rather than postponing until tomorrow. We live in the early days of mass deployment of IPv6, and we need to work together to untangle the implementation quirks that arise. The list of fixes above represents only a small sampling of potential issues. You can always seek help Online at any number of reputable IPv6 discussion forums. Use network misbehavior as an opportunity to learn about and improve the state of IPv6 internetworking and resist any temptations to disable the protocol.

About Dai Pham

Check Also

Tư học LPI 1, 2: Bài 11 DHCP

Tuhocmang.com – DHCP (Dynamic Host Configuration Protocol) là một dịch vụ hữu ích trong việc quản …

Tư học LPI 1, 2: Bài 10 Cấu hình mạng

Tuhocmang.com – Bài này sẽ giới thiệu 1 số thao tác cơ bản cấu hình …

Leave a Reply

Your email address will not be published. Required fields are marked *