1

When I use openssl s_client and ask it to connect to ip6-localhost it actually connects to 127.0.0.1 instead of ::1.

This is what I see on both Ubuntu and Debian:

$ strace -e connect openssl s_client -connect ip6-localhost:443
connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_FILE, path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory)
connect(3, {sa_family=AF_INET, sin_port=htons(443), sin_addr=inet_addr("127.0.0.1")}, 16) = 0

I don't see anything in /etc/hosts which could explain the behavior:

127.0.0.1       localhost
127.0.1.1       dell

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

How does s_client reach the conclusion that the IP address of ip6-localhost is 127.0.0.1?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.