I run a service on IPv4, but sometimes, apparently randomly, it happens that the service uses TCPv6 sockets (I monitor it with ss -s
).
I want to avoid it, disabling any IPv6 connection.
I tried to disable it putting in /etc/sysctl.conf :
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
and then restarting sysctl sudo sysctl -p
.
However, it still happens that the service uses IPv6, though it is disabled:
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
1
The only way I have found to work it out is to put down and up the interface
sudo ifconfig eth1 down
sudo ifconfig eth1 up
Note: no IPv6 address is assigned to any interface. Moreover, I cannot reboot the machine.
Any solution?