How to disable and enable IPv6 on Linux

Disable IPv6

Use follow command in root access

sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1

Enable IPv6

Use follow command in root access

sysctl -w net.ipv6.conf.all.disable_ipv6=0
sysctl -w net.ipv6.conf.default.disable_ipv6=0