IPv6 is the latest adaptation of Internet Protocol intended to solve the problem of IPv4 which is to increase the number of IP addresses to the internet devices (Check out this article for detailed overview Link). In this section, we are only going to talk about disabling the IPv6 leak on the Linux systems. I am using a Kali Linux machine for this demonstration. The idea would be the same for all other Linux machines. Following are the steps :
1. Open Terminal in your Linux machine using this shortcut (Ctrl + Alt + T), or just click on the terminal icon. Enter this command “ nano /etc/sysctl.conf ”. We are going to edit this configuration file.
nano – It is a text editor for Unix systems.
sysctl.conf – This file is used to modify the System Kernel Parameters.
2. When I first open up this file, everything is just commented out. You can see below in the screenshot.
3. Now, just paste the following three lines in that file at any location without modifying anything, if you have no idea what you are doing, do not comment on the other settings.
net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1
With the help of these commands, we are telling the Kernel that set all those three setting to 1 i.e. TRUE, which implies that the Kernel will disable the IPv6.
Note: Use Ctrl + O to write into the file, press Enter for the default name or you change it, and finally, just Exit nano using Ctrl + X.
4. Reboot the machine or update it using “ apt-get update ”.
5. Run this following command “ cat /proc/sys/net/ipv6/conf/all/disable_ipv6”, if it returns 1 (TRUE) then you have disabled IPv6 but if it returns 0 (FALSE); do the following step.
6. Run this command “ sysctl -p ” or “ sysctl -p /etc/sysctl.conf ”. It will return the above mentioned three lines if you have properly pasted and saved the file. See the screenshot.
7. That’s all, if every step goes fine then you have disabled IPv6 on your machine. To make the settings default again, just remove those three lines from the file or you can set them to 0 (FALSE). Reboot your system or update it. After this, Run “sysctl -p”, it will return nothing.
If you have any thoughts or suggestions, just comment down below. Stay Tuned for more.