Step 1: Edit sysctl.conf
Open /etc/sysctl.conf in a text editor:
nano /etc/sysctl.conf
Scroll to the bottom of the file and add:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
Step 2: Apply the changes
Reload sysctl values:
sysctl -p
Step 3: Verify IPv6 is disabled
ip a | grep inet6
If nothing shows up, IPv6 has been disabled successfully ✅