For the current session
First, we need to run ip a and check if we have a IPV6 running:
If so, we can disable it by running:
sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=1
Now we can ip a over again and see if inet6 has been gone away.
When you restart your PC it'll be back.
Permanently
To do that permanently, we have to open our /etc/sysctl.conf and set the same values we've ran in the previous section:
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
Then we run sudo sysctl -p to take effect.
Forcing update sysctl on reboot
If rebooting it does not work, create a /etc/rc.local file and paste the following snippet:
/etc/rc.local
#!/bin/bash
/etc/sysctl.d
/etc/init.d/procps restart
exit 0
Now, make it executable with:
sudo chmod 755 /etc/rc.local
This will manually (during the boot) refresh our sysctl config.
Re-enabling IPV6
To undo all of that, we need to remove the /etc/rc.local file we've created and also remove the instructions we've added at /etc/sysctl.config.