Someone may argue that there is no reason to disable ipv6 on Linux. For me, the reason is that in some ipv6-enabled website, I frequently be classified as a bot who need to solve captcha which is really annoying :-( . Consider the ipv6 address is never change (assigned by service provider), disable ipv6 is the simplest solution.
Let's come to the solution. Just use your favorite editor to add one
loor the device name shown by
ifconfig. Then you can use
sysctl -pto take effect immediately or reboot to test if ipv6 has been persistently disabled.
The above solution is tested on Ubuntu 20.04 LTS.
net.ipv6.conf.all.disable_ipv6 = 1is unnecessary.
net.ipv6.conf.default.disable_ipv6 = 1doesn't work on my server (maybe
defaultis not well defined?).
- Personally I don't like the update-grub solution as we cannot re-enable ipv6 without reboot.