5

Maybe this is a silly question but sometimes I see IPv6 :: to mean the local host, and sometimes I see ::1. Occasionally, using one vs. the other seems to be the difference between something working and something not working.

What is the difference between :: and ::1? Are there any differences that might come into play if a machine has multiple network interfaces?

1 Answer 1

5

::1 is the true "local host" or "loopback" address, equivalent to 127.0.0.1 in IPv4.

:: is the "unspecified" or "null" address, equivalent to 0.0.0.0 in IPv4. Its main purpose is to refer to all possible local addresses when binding a socket to a local address – doing so is the opposite of using the loopback address.

The "unspecified" address does not mean "local host" officially – as far as I know, connecting to the unspecified address is not meant to be a valid operation, neither for [::] nor 0.0.0.0. (However, some operating systems accept it nevertheless – for example, in the Linux source code, there is a special case that handles connections to 0.0.0.0 as if they were connections to 127.0.0.1 with a comment saying "For compatibility with BSD", and it has similar handling for [::] simply to remain consistent with IPv4.)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .