shadowsocks-libev icon indicating copy to clipboard operation
shadowsocks-libev copied to clipboard

failed to resolve server name ::0

Open RayXu14 opened this issue 7 years ago • 5 comments

What version of shadowsocks-libev are you using?

current github version. that is 3.1.3.

What operating system are you using?

Ubuntu server 18.04

What did you do?

I manually setup my docker image and run it. the dockerfile is below:

#
# Dockerfile for shadowsocks-libev
#

FROM alpine

ENV SERVER_ADDR 0.0.0.0
ENV SERVER_PORT 30001
ENV PASSWORD    ***
ENV METHOD      rc4-md5
ENV TIMEOUT     300
ENV DNS_ADDRS   8.8.8.8,8.8.4.4
ENV ARGS=

COPY . /tmp/repo
RUN set -ex \
 # Build environment setup
 && apk add --no-cache --virtual .build-deps \
      autoconf \
      automake \
      build-base \
      c-ares-dev \
      libev-dev \
      libtool \
      libsodium-dev \
      linux-headers \
      mbedtls-dev \
      pcre-dev \
 # Build & install
 && cd /tmp/repo \
 && ./autogen.sh \
 && ./configure --prefix=/usr --disable-documentation \
 && make install \
 && apk del .build-deps \
 # Runtime dependencies setup
 && apk add --no-cache \
      rng-tools \
      $(scanelf --needed --nobanner /usr/bin/ss-* \
      | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \
      | sort -u) \
 && rm -rf /tmp/repo

USER nobody

CMD exec ss-server \
      -s $SERVER_ADDR \
      -p $SERVER_PORT \
      -k ${PASSWORD:-$(hostname)} \
      -m $METHOD \
      -t $TIMEOUT \
      -d $DNS_ADDRS \
      -u \
      $ARGS

I run

~/shadowsocks-libev$ docker build -t sslibev . -f docker/alpine/Dockerfile
docker run --rm -it -p 30001:30001 -e SERVER_ADDR=::0 sslibev 

[::0] or :: or "::0" do not work.

What did you expect to see?

I want my ss-server to support ipv6 web visiting.

What did you see instead?

 2019-05-26 16:20:50 INFO: UDP relay enabled
 2019-05-26 16:20:50 INFO: initializing ciphers... rc4-md5
 2019-05-26 16:20:50 INFO: using nameserver: 8.8.8.8,8.8.4.4
 2019-05-26 16:20:50 INFO: tcp server listening at [::]:30001
 2019-05-26 16:20:50 ERROR: failed to resolve server name ::
 2019-05-26 16:20:50 ERROR: failed to listen on any address

then my docker container exit.

What is your config in detail (with all sensitive info masked)?

I have write my dockerfile and commands above, thanks a lot! I have to memtion that my machine can ping ipv6.google.com.

RayXu14 avatar May 26 '19 16:05 RayXu14

It means the docker container doesn't have valid IPv6 address and routing.

madeye avatar May 28 '19 09:05 madeye

It means the docker container doesn't have valid IPv6 address and routing.

I think my docker container need not have indepent ipv6 address, just need to open some port to the outside right? And, how could I manager to use docker container to use sslibev? Any proper keywords? I have search this for many hours but failed T T Many thanks!

RayXu14 avatar May 28 '19 11:05 RayXu14

@RayXu14 In fact, this is a docker problem, docker does not enable ipv6 support by default, you only need to open it to use.

  1. Open IPv6 Support
sudo tee /etc/docker/daemon.json <<'EOF'
{
    "ipv6": true,
    "fixed-cidr-v6": "2001:db8:1::/64"
}
EOF
  1. Restart Docker Service
sudo systemctl restart docker.service
  1. Run Shadowsocks with IPv6
docker run -e SERVER_ADDR='::0' -e PASSWORD=PASSWORD -p8388:8388 -p8388:8388/udp -d shadowsocks/shadowsocks-libev
  1. Check logs
 2019-05-31 04:17:12 INFO: UDP relay enabled
 2019-05-31 04:17:12 INFO: initializing ciphers... aes-256-gcm
 2019-05-31 04:17:12 INFO: using nameserver: 8.8.8.8,8.8.4.4
 2019-05-31 04:17:12 INFO: tcp server listening at [::0]:8388
 2019-05-31 04:17:12 INFO: udp server listening at [::0]:8388

miy4mori avatar May 31 '19 04:05 miy4mori

sudo systemctl restart docker.service

It did behave as you say,

 2019-05-31 14:24:33 INFO: UDP relay enabled
 2019-05-31 14:24:33 INFO: initializing ciphers... rc4-md5
 2019-05-31 14:24:33 INFO: using nameserver: 8.8.8.8,8.8.4.4
 2019-05-31 14:24:33 INFO: tcp server listening at 0.0.0.0:30001
 2019-05-31 14:24:33 INFO: tcp server listening at [::0]:30001
 2019-05-31 14:24:33 INFO: udp server listening at 0.0.0.0:30001
 2019-05-31 14:24:33 INFO: udp server listening at [::0]:30001

but at http://test-ipv6.com/ and https://ipv6-test.com/, I can not connected to IPv6 address through shadowsocks-libev, the reason is do not have an IPv6 address, which, is strange. Because I do have ipv6 address.

what I want is letting my shadowsocks can help me visit ipv6 address, I need not connected to ss with ipv6 address.

RayXu14 avatar May 31 '19 14:05 RayXu14

Why closed?... This issue has not been solved yet

RayXu14 avatar Jun 23 '19 12:06 RayXu14