After successfully disabling IPv6 using this script :
echo 'net.ipv6.conf.all.disable_ipv6 = 1' >> /etc/sysctl.conf echo 'net.ipv6.conf.default.disable_ipv6 = 1' >> /etc/sysctl.conf echo 'net.ipv6.conf.lo.disable_ipv6 = 1' >> /etc/sysctl.conf sysctl -p
I try to re-enable using this script :
sed -i "/net.ipv6.conf.all.disable_ipv6/d" /etc/sysctl.conf sed -i "/net.ipv6.conf.default.disable_ipv6/d" /etc/sysctl.conf sed -i "/net.ipv6.conf.lo.disable_ipv6/d" /etc/sysctl.conf sysctl -p
I have verified that the enable script removes the disable lines from the sysctl.conf file.
In each case, I check the result with this :
where '1' means disabled and '0' means not.
The re-enable piece does not work.
In each case, the sysctl -p command reloads the /etc/sysctl.conf file. However it seems that the reload simply pulls into its buffer rather than over-writing it completely so that the disabling properties are not removed.
Is this analysis correct?
If so, I don't see an option to clear the sysctl.conf cache. Is there one? Or is there a strategy for this requirement?