apernet / hysteria

Hysteria is a powerful, lightning fast and censorship resistant proxy.
https://v2.hysteria.network/
MIT License
14.48k stars 1.62k forks source link

IPv6 reqAddr not connecting #962

Closed ShahryarShabani closed 4 months ago

ShahryarShabani commented 6 months ago

Describe the bug whenever request addresses are IPv6s get rejected or can not be resolved

Client Apps Streisand Nekobox

Logs

Mar 01 11:43:08 vps hysteria[157351]: 2024-03-01T11:43:08+03:30        ERROR        TCP error        {"addr": "****:36710", "id": "shahryar", "reqAddr": "[2a03:2880:f216:c6:face:b00c:0:7260]:80", "error": "dial tcp6 [2a03:2880:f216:c6:face:b00c:0:7260]:80: connect: network is unreachable"}

Mar 01 11:43:09 vps hysteria[157351]: 2024-03-01T11:43:09+03:30        ERROR        TCP error        {"addr": "****:36710", "id": "shahryar", "reqAddr": "[2a03:2880:f201:c6:face:b00c:0:7260]:443", "error": "dial tcp6 [2a03:2880:f201:c6:face:b00c:0:7260]:443: connect: network is unreachable"}

Device and Operating System Ubuntu 20.04

Server Config

listen: :443
tls:
  cert: /etc/hysteria/ca.crt
  key: /etc/hysteria/ca.key
quic:
  initStreamReceiveWindow: 26843545
  maxStreamReceiveWindow: 26843545
  initConnReceiveWindow: 67108864
  maxConnReceiveWindow: 67108864
  maxIdleTimeout: 4s
  keepAlivePeriod: 4s
  maxIncomingStreams: 1024
  disablePathMTUDiscovery: false
auth:
  type: userpass
  userpass:
    shahryar: enn1hErZ4bB83w1
masquerade:
  type: proxy
  proxy:
    url: https://abadis.ir/
    rewriteHost: true
resolver:
  type: tcp
  tcp:
    addr: 8.8.8.8:53
    timeout: 4s
  udp:
    addr: 8.8.4.4:53
    timeout: 4s
  tls:
    addr: 1.1.1.1:853
    timeout: 10s
    sni: cloudflare-dns.com
    insecure: true
  https:
    addr: 1.1.1.1:443
    timeout: 10s
    sni: cloudflare-dns.com
    insecure: true
disableUDP: false
ignoreClientBandwidth: true
udpIdleTimeout: 120s
acl:
  inline:
    - reject(all, udp/443)
    - reject(geosite:ir)
    - reject(geoip:ir)
    - reject(geosite:category-ads-all)
    - reject(geoip:private)
    - direct(geoip:facebook)
    - warp(geoip:google)
    - warp(geosite:netflix)
    - warp(35.184.0.0/13)
    - warp(geosite:spotify)
    - warp(geosite:google)
    - warp(geosite:openai)
    - warp(geoip:openai)
    - direct(all)
  geoip: /etc/hysteria/geoip.dat
  geosite: /etc/hysteria/geosite.dat
outbounds:
  - name: warp
    type: socks5
    socks5:
      addr: 127.0.0.1:40000
trafficStats:
  listen: :9000
obfs:
  type: salamander
  salamander:
    password: VbDcrcJzytZ4
tobyxdd commented 6 months ago

This is not a bug. Your server probably just doesn't support IPv6

ShahryarShabani commented 6 months ago

When I check IP addresses on my server :

2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000
    link/ether 52:54:00:8d:4d:1f brd ff:ff:ff:ff:ff:ff
    inet **** brd **** scope global ens3
       valid_lft forever preferred_lft forever
    inet6 ****/64 scope link
       valid_lft forever preferred_lft forever

also when I use trojan+grpc+nginx it works without any errors

would you please help me to fix this issue?

ShahryarShabani commented 6 months ago

is there any way to route all reqaddr with IPv6 to warp ?

askfname commented 4 months ago

Please check whether prefer_ipv6 is turned on in the client's routing settings.

haruue commented 4 months ago

When I check IP addresses on my server :

2: ens3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq state UP group default qlen 1000
    link/ether 52:54:00:8d:4d:1f brd ff:ff:ff:ff:ff:ff
    inet **** brd **** scope global ens3
       valid_lft forever preferred_lft forever
    inet6 ****/64 scope link
       valid_lft forever preferred_lft forever

also when I use trojan+grpc+nginx it works without any errors

would you please help me to fix this issue?

As you can see, there is a scope link in the line of your IPv6 address.

The address you saw here is a link-local address, which is in fe80::/10. It is automatically generated from the hardware address of the interface using the EUI-64 rule, and is only used in the link layer.

If you don't understand IPv6 or link-local addresses, let's assume you are connecting a PC to a switch that is not connected to a router. Windows will assign the Ethernet interface an IPv4 address in 169.254.0.0/16. This is an IPv4 link-local address, and connecting to the IPv4 Internet is impossible in this case.