Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xray v1.7.5 not listen for ipv4 #1950

Closed
fissssssh opened this issue Apr 16, 2023 · 6 comments
Closed

xray v1.7.5 not listen for ipv4 #1950

fissssssh opened this issue Apr 16, 2023 · 6 comments

Comments

@fissssssh
Copy link

xray version: v1.7.5
config:

{
    "log": {
        "loglevel": "info"
    },
    "inbounds": [
        {
            "port": 443,
            "protocol": "vless",
            "settings": {
                "clients": [
                    {
                        "id": "***",
                        "flow": "xtls-rprx-vision"
                    }
                ],
                "decryption": "none",
                "fallbacks": [
                    {
                        "alpn": "h2",
                        "dest": "/dev/shm/nginx/h2.sock"
                    },
                    {
                        "dest": "/dev/shm/nginx/default.sock"
                    }
                ]
            },
            "streamSettings": {
                "network": "tcp",
                "security": "tls",
                "tlsSettings": {
                    "alpn": [
                        "h2",
                        "http/1.1"
                    ],
                    "minVersion": "1.2",
                    "certificates": [
                        {
                            "certificateFile": "/usr/local/nginx/certs/**.cer",
                            "keyFile": "/usr/local/nginx/certs/**.key",
                            "ocspStapling": 3600
                        }
                    ]
                }
            }
        }
    ],
    "outbounds": [
        {
            "protocol": "freedom"
        }
    ]
}

log

# journalctl -u xray | tail
Apr 16 04:56:16 xray systemd[1]: Starting Xray Service...
Apr 16 04:56:16 xray systemd[1]: Started Xray Service.
Apr 16 04:56:16 xray xray[36284]: Xray 1.7.5 (Xray, Penetrates Everything.) Custom (go1.20 linux/amd64)
Apr 16 04:56:16 xray xray[36284]: A unified platform for anti-censorship.
Apr 16 04:56:16 xray xray[36284]: 2023/04/16 04:56:16 [Info] infra/conf/serial: Reading config: /usr/local/etc/xray/config.json
Apr 16 04:56:16 xray xray[36284]: 2023/04/16 04:56:16 [Info] transport/internet/tcp: listening TCP on 0.0.0.0:443
Apr 16 04:56:16 xray xray[36284]: 2023/04/16 04:56:16 [Warning] core: Xray 1.7.5 started

netstat

# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      36171/nginx: master
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      36171/nginx: master
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1891/sshd: /usr/sbi
tcp6       0      0 :::80                   :::*                    LISTEN      36171/nginx: master
tcp6       0      0 :::80                   :::*                    LISTEN      36171/nginx: master
tcp6       0      0 :::22                   :::*                    LISTEN      1891/sshd: /usr/sbi
tcp6       0      0 :::443                  :::*                    LISTEN      36284/xray

why only listen tcp6?

@FranzKafkaYu
Copy link
Contributor

FranzKafkaYu commented Apr 16, 2023

@fissssssh The v6 address is compatible with the v4 address. Even if it is listening to v6, you still can connect it via v4. If the kernel option BindIPv6Only is enabled, it cannot be connect via v4.

@SakuraSakuraSakuraChan
Copy link

@fissssssh lsof plz

@fissssssh
Copy link
Author

@fissssssh lsof plz

# lsof -i:443
COMMAND   PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
xray    36284 root    3u  IPv6  54861      0t0  TCP *:https (LISTEN)

@nursery01
Copy link

"inbounds": [
        {
            "listen": "0.0.0.0", 
            "port": 443,

@SakuraSakuraSakuraChan
Copy link

golang/go#9334
golang/go#17615
mholt/caddy-l4#47

It's golang's intended behavior

@fissssssh
Copy link
Author

@fissssssh The v6 address is compatible with the v4 address. Even if it is listening to v6, you still can connect it via v4. If the kernel option BindIPv6Only is enabled, it cannot be connect via v4.

yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants