Skip to content

LISTEN=0.0.0.0:<PORT> 时, 同时监听 IPv6 #3

Description

@HanaKDev

在 LXC 容器中运行 media-proxy-rs,并且容器已分配全局 IPv6 地址的情况下,服务配置如下:

LISTEN=0.0.0.0:61010

在容器内查看监听情况:

ss -lntp
LISTEN 0 4096 0.0.0.0:61010  0.0.0.0:*  users:(("media-proxy-rs",pid=xxxx,fd=9))

该容器同时拥有 IPv4 和 IPv6 地址:

inet   192.168.x.x/24
inet6  2001:db8:xxxx:xxxx::8/96

IPv4 访问正常:

curl http://127.0.0.1:61010
OK

但 IPv6 无法访问:

curl http://[::1]:61010
curl: (7) Failed to connect to ::1 port 61010: Connection refused

在宿主机上通过容器的全局 IPv6 地址访问同样失败:

curl http://[2001:db8:xxxx:xxxx::8]:61010
Connection refused

因为宿主机只拥有IPv6公网, IPv4出口使用IDC提供的NAT, 我更希望直接通过IPv6回源到我的服务(同时保留IPv4访问)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions