Should 127.0.0.1 and ::1 both be included in /etc/hosts file?
Solution 1:
Yes, 127.0.0.1 should be left. IPv6 is enabled, but IPv4 is still used.
Solution 2:
You didn't mention which OS you are using.
On Windows systems, the name resolution of localhost
is handled by the system and those entries are not needed in the hosts
file. This is even explicitly mentioned in that very same file:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost