Score:0

What is the origin and meaning of the shorthand "[::]:25" when refering to an ip address and port number

my flag

Sometimes when working with certain libraries or applications that listen on a given port I will receive a log entry that looks like the following:

[2023-07-17 19:04:36] INFO  SMTP Server listening on [::]:25

The above log is produced by the SMTP-Server package for NodeJS.

I recognize that [::] is probably referring to localhost and :25 refers to the port to which the application is listening. But, where did this shorthand come from? Is there a specific meaning behind it or is it just something that was created and stuck around?

Score:3
fr flag
anx

:: is the recommended representation of the all-zero IPv6 address 0:0:0:0:0:0:0:0. One consecutive run of zeroes can be shortened to just the colons, and if its all zero, then that is all that remains. The brackets serve to disambiguate the (also colon-separated) port number.

Just like the v4 address 0 (or 0.0.0.0), binding to the all-zero address is a common convention to specify that the service should list on all available addresses. This is not the same thing as localhost, which would generally imply a service only available to connections local to that machine.

In v4, the all-zero address is also called "this host" (being originally reserved on that term), in v6 it is introduced as "the unspecified address". Do note that modern operating systems facilitate accepting connections of both protocol version via common socket interfaces, so the assumption that the latter would exclusively listen for IPv6 connections is not generally correct.

joeldesante avatar
my flag
Thank you! This is very interesting! I always just accepted the convention without questioning its meaning so its nice to know it's origin!
jp flag
Square brackets around the IP literal are required with port numbers, RFC 5952 section 6.
Score:2
us flag

That's the IPv6 representation of IPv4's 0.0.0.0.

Your SMTP server is simply stating that it's listening for IPv6 connections on port 25.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.