Live data from Hacker News

Internet Draft: Let 'localhost' be localhost

tools.ietf.org

141–150 of 179 posts

Re: Internet Draft: Let 'localhost' be localhost

#141
post #109

Earlier quoted context omitted.

Yeah you're right, it certainly does. I would be curious if it goes mainstream enough to replace IPv4 in the foreseeable future though, which was its intention.

It's been quite mainstream in certain contexts and geographies for a number of years now. As an example - most handsets on modern LTE (and newer) networks have been strong-majority v6 for quite a while. The fact that this hasn't been obvious is an argument in favor of v6's success.

Hah, I didn't know precisely because in my case I've always seen an IPv4 address on mobile...

Re: Internet Draft: Let 'localhost' be localhost

#142
post #124

At work someone once spent hours trying to resolve a network issue. Turns out he didn't have a localhost entry in his /etc/hosts and some sadistic person had created a VM named 'localhost' that registered a DNS entry via DHCP.

A similar, common issue is to not have the machine's hostname pointing to a valid IP address in /etc/hosts (99% of the time it should be loopback, some like to point it to a fixed eth0 address), which causes delays in various part of an otherwise fine OS.

Re: Internet Draft: Let 'localhost' be localhost

#143

I've had web browsers perform a web search for 'localhost', or even just redirect me to localhost.com. Annoying.

chrome does this. if i dont specify http or https before domain chrome will try to search any .dev or .loc or ... domain with googe search engine. anoying

I think a trailing slash is what makes Chrome try to resolve instead of searching.

Re: Internet Draft: Let 'localhost' be localhost

#144

I've had web browsers perform a web search for 'localhost', or even just redirect me to localhost.com. Annoying.

chrome does this. if i dont specify http or https before domain chrome will try to search any .dev or .loc or ... domain with googe search engine. anoying

Add a slash to the end, less typing work than adding https:// to the start.

Re: Internet Draft: Let 'localhost' be localhost

#145

Localhost resolving to IPv6 basically breaks with Docker they unless you give special instructions only listens on IPv4. With curl for instance you can use the -4 parameter but probably best we start saying test the site on 127.0.0.1 in tutorials.

Sorry, but none of that is correct. First, if you publish a container's port in docker, such as with the -p flag, e.g., docker run --rm -p 8080:80/tcp nginx:latest Docker will listen, on the host, on ::; it will accept IPv4 connections on that bind. (Through IPv4-mapped IPv6 addresses[1], which is a transition mechanism.) But even if we force Docker to bind to only IPv4, curl will still work: docker run --rm -p 127.0…

I'm sorry but none of what you've said is correct - I'm speaking from experience from the Docker community.

Watch this ASCII recording to see the issue

https://asciinema.org/a/xM8m0iqOepkSwCRBTIP9hYXGU

We run into the issue on RPi/Raspbian - curl hangs indefinitely. I had someone report to me that he couldn't access localhost:8080 in a web-browser using a Docker container for FaaS because it was resolving to this IPv6 - he was on Arch Linux.

Perhaps you can reverse your hasty down-voting?

Re: Internet Draft: Let 'localhost' be localhost

#146
post #98

Sounds reasonable, but would probably break a ton of stuff. Does this provide enough benefits to outweigh the downsides?

What do you think might break?

Badly written software will break.

Or software relying on badly written DNS resolvers.

Re: Internet Draft: Let 'localhost' be localhost

#147

Earlier quoted context omitted.

Sorry, but none of that is correct. First, if you publish a container's port in docker, such as with the -p flag, e.g., docker run --rm -p 8080:80/tcp nginx:latest Docker will listen, on the host, on ::; it will accept IPv4 connections on that bind. (Through IPv4-mapped IPv6 addresses[1], which is a transition mechanism.) But even if we force Docker to bind to only IPv4, curl will still work: docker run --rm -p 127.0…

I'm sorry but none of what you've said is correct - I'm speaking from experience from the Docker community. Watch this ASCII recording to see the issue https://asciinema.org/a/xM8m0iqOepkSwCRBTIP9hYXGU We run into the issue on RPi/Raspbian - curl hangs indefinitely. I had someone report to me that he couldn't access localhost:8080 in a web-browser using a Docker container for FaaS because it was resolving to this IPv…

Nobody said it broke Docker (it was the resolution that "broke". But the resolution clearly did not work and we had people running through tutorials only to find curl would hang and timeout unless switching to 127.0.0.1 or passing the -4 flag.

Re: Internet Draft: Let 'localhost' be localhost

#148

First, the lack of confidence that "localhost" actually resolves to the loopback interface encourages application developers to hard-code IP addresses like "127.0.0.1" in order to obtain certainty regarding routing. This causes problems in the transition from IPv4 to IPv6 (see problem 8 in [draft-ietf-sunset4-gapanalysis]). That does remind me of the times I was dealing with weird connection issues in some critical s…

> It turned to be related to the use of "localhost" in the configuration. It resolves to ipv6 on some systems and that breaks everything because the target app is only listening to the ipv4 address.

You just found a major bug in the application and should complain to the developer. Applications that do not support IPv6 are simply broken and should be avoided at all cost by now.

Re: Internet Draft: Let 'localhost' be localhost

#149
post #97

First, the lack of confidence that "localhost" actually resolves to the loopback interface encourages application developers to hard-code IP addresses like "127.0.0.1" in order to obtain certainty regarding routing. This causes problems in the transition from IPv4 to IPv6 (see problem 8 in [draft-ietf-sunset4-gapanalysis]). That does remind me of the times I was dealing with weird connection issues in some critical s…

Ideally, a server binding to "localhost" should create a listening socket for each of its IP addresses (e.g. 127.0.0.1 and ::1), and a client connecting to "localhost" should try each IP address in order, until one succeeds. But a lot of standard libraries (including parts of Java and Go) get this wrong, and pick exactly one IP address arbitrarily. When you combine a buggy client with a buggy server, and their prefer…

An interface on linux has only one ip address.

The "localhost" interface will either designate the ipv4 127.0.0.1 interface or the ipv6 ::1 interface. That's the realm of undefined behavior and system specifics.

This whole IETF draft looks like a mess. They should reserve the names localhost4 and localhost6.

Re: Internet Draft: Let 'localhost' be localhost

#150
post #97

Earlier quoted context omitted.

Ideally, a server binding to "localhost" should create a listening socket for each of its IP addresses (e.g. 127.0.0.1 and ::1), and a client connecting to "localhost" should try each IP address in order, until one succeeds. But a lot of standard libraries (including parts of Java and Go) get this wrong, and pick exactly one IP address arbitrarily. When you combine a buggy client with a buggy server, and their prefer…

An interface on linux has only one ip address. The "localhost" interface will either designate the ipv4 127.0.0.1 interface or the ipv6 ::1 interface. That's the realm of undefined behavior and system specifics. This whole IETF draft looks like a mess. They should reserve the names localhost4 and localhost6.

> An interface on linux has only one ip address.

absolutely not true. Neither for IPv4 nor IPv6, where it's even the default to have a multitude of addresses on an interface.

> The "localhost" interface will either designate the ipv4 127.0.0.1 interface or the ipv6 ::1 interface. That's the realm of undefined behavior and system specifics.

no it won't. My loopback (lo) interface has both 127.0.0.1 and ::1 as its addresses.

Post reply on HN