Sometimes on servers
apt-get update
when the command is executed, it can give an update error because it cannot access IPv6 addresses. The permanent solution is;
sysctl -w net.ipv6.conf.all.disable_ipv6=1
sysctl -w net.ipv6.conf.default.disable_ipv6=1
to execute these 2 commands separately. It does not require a reboot, etc. afterwards. When the update command is run again, it will work.