Disable IPv6 in CentOS8
Introduction
A memo when I took the time to investigate the subject
First of all, the royal road
First, as a common pattern, execute the following to reboot
/etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6 = 1
net.ipv6.conf.enp0s3.disable_ipv6 = 1
If you check with ip a after restarting, it remains persistently.
$sudo sysctl --all | grep disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.enp0s3.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 1
solution
It doesn’t seem to work because it is managed by Network manager.
Then execute the following magic and reboot (enp0s3 should be read depending on the environment)
$sudo nmcli connection modify enp0s3 ipv6.method ignore
Now when you look at ip a, it’s disabled.
By the way
Even if you look at netstat in this state, apache etc. is displayed as LISTEN in IPv6.
More on this below.
https://qiita.com/fetaro/items/d5164ba8271114d8a0c8
reference
https://linuxhint.com/disable_ipv6_centos8/