apernet / hysteria

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

各种办法尝尽,客户端仍然报错connect error: timeout: no recent network activity #955

Open yaochong-06 opened 8 months ago

yaochong-06 commented 8 months ago

服务器端:

[root@kabirgoyal yc]# ll
total 43944
-rw-r--r--. 1 root root     1480 Feb 22 18:48 cert.pem
-rw-r--r--. 1 root root      117 Feb 23 05:13 client.yaml
-rw-r--r--. 1 root root      972 Feb 22 18:47 csr.pem
-rwxr-xr-x. 1 root root 14925824 Feb 22 11:04 hysteria-linux-amd64
-rwxr-xr-x. 1 root root 14917632 Feb 22 15:44 hysteria-linux-amd64-avx
-rw-r--r--. 1 root root 15115264 Feb 22 15:44 hysteria-windows-amd64-avx.exe
-rw-r--r--. 1 root root     1732 Feb 22 18:48 key.pem
-rw-r--r--. 1 root root      454 Feb 22 18:48 openssl.cnf
-rw-r--r--. 1 root root      106 Feb 22 16:38 readme.txt
-rw-r--r--. 1 root root      220 Feb 23 05:11 server.yaml
-rw-r--r--. 1 root root      125 Feb 28 11:39 startserver.log
-rw-r--r--. 1 root root      117 Feb 28 13:04 startserver.sh
[root@kabirgoyal yc]# cat startserver.sh 

export QUIC_GO_DISABLE_ECN=true
export HYSTERIA_LOG_LEVEL=debug 
./hysteria-linux-amd64-avx server -c server.yaml 
[root@kabirgoyal yc]# cat server.yaml 
listen: :30040

tls:
  cert: "./cert.pem"
  key: "./key.pem"

bandwidth:
  up: 100 mbps
  down: 20 mbps

auth:
  type: password
  password: chika

resolver:
  type: https
  https:
    addr: 1.1.1.1:443
    timeout: 10s

[root@kabirgoyal ~]# netstat -ntplu
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
... ...
udp6 0 0 :::30040 :::* 1208/./hysteria-lin

服务器是centos7,版本如下

[root@kabirgoyal yc]# uname -a
Linux kabirgoyal.com 6.7.6-1.el7.elrepo.x86_64 https://github.com/apernet/hysteria/issues/1 SMP PREEMPT_DYNAMIC Fri Feb 23 17:06:52 EST 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@kabirgoyal yc]# uname -r
6.7.6-1.el7.elrepo.x86_64

[root@kabirgoyal yc]# cat server.yaml
listen: :30040

tls:
cert: "./cert.pem"
key: "./key.pem"

bandwidth:
up: 100 mbps
down: 20 mbps

auth:
type: password
password: chika

resolver:
type: https
https:
addr: 1.1.1.1:443
timeout: 10s
[root@kabirgoyal yc]# nohuo sh startserver.sh > startserver.log & 

到此服务器端启动起来 防火墙的状态如下

[root@kabirgoyal ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2024-02-28 11:40:52 UTC; 12min ago
Docs: man:firewalld(1)
Process: 538 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
Main PID: 538 (code=exited, status=0/SUCCESS)

Feb 28 11:38:42 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
Feb 28 11:38:43 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
Feb 28 11:38:43 localhost.localdomain firewalld[538]: WARNING: AllowZoneDrifting is enabled. This is considered an inse... now.
Feb 28 11:38:43 localhost.localdomain firewalld[538]: ERROR: Failed to read file "/proc/sys/net/netfilter/nf_conntrack_...lper'
Feb 28 11:38:43 localhost.localdomain firewalld[538]: WARNING: Failed to get and parse nf_conntrack_helper setting
Feb 28 11:40:50 kabirgoyal.com systemd[1]: Stopping firewalld - dynamic firewall daemon...
Feb 28 11:40:52 kabirgoyal.com systemd[1]: Stopped firewalld - dynamic firewall daemon.
Hint: Some lines were ellipsized, use -l to show in full.

端口也都通的 客户端发送:

echo "Test UDP message" | nc -u 209.141.55.218 30041

服务器:

[root@kabirgoyal yc]# nc -u -l 30040
Ncat: bind to :::30040: Address already in use. QUITTING.
[root@kabirgoyal yc]# nc -u -l 30041
Test UDP message

尝试更换内核,引导0、1、2、3都尝试过了也都不行

[root@kabirgoyal yc]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (6.7.6-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.108.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-1160.105.1.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-588bfa2ca2804ff28f43b93842cbe31d) 7 (Core)
5 : CentOS Linux (0-rescue-edc47dad32bb768759cc5a1aaf8a8904) 7 (Core)
[root@kabirgoyal yc]# grub2-set-default 1 
[root@kabirgoyal yc]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.7.6-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-6.7.6-1.el7.elrepo.x86_64.img
*** Error in `udevadm': free(): invalid next size (fast): 0x000056486fff5050 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x81329)[0x7fa20f281329]
/lib64/libselinux.so.1(+0x10b95)[0x7fa210e10b95]
/lib64/libselinux.so.1(selabel_close+0x7e)[0x7fa210e0f7ee]
udevadm(+0x289e5)[0x56486fc289e5]
udevadm(+0xaed2)[0x56486fc0aed2]

略
7f3d4d607000-7f3d4d807000 ---p 00007000 fd:01 265408                     /usr/lib64/libacl.so.1.1.0
7f3d4d807000-7f3d4d808000 r--p 00007000 fd:01 265408                     /usr/lib64/libacl.so.1.1.0
7f3d4d808000-7f3d4d809000 rw-p 00008000 fd:01 265408                     /usr/lib64/libacl.so.1.1.0
7f3d4da00000-7f3d4da15000 r-xp 00000000 fd:01 266045                     /usr/lib64/libkmod.so.2.2.10
7f3d4da15000-7f3d4dc14000 ---p 00015000 fd:01 266045                     /usr/lib64/libkmod.so.2.2.10
7f3d4dc14000-7f3d4dc15000 r--p 00014000 fd:01 266045                     /usr/lib64/libkmod.so.2.2.10
7f3d4dc15000-7f3d4dc16000 rw-p 00015000 fd:01 266045                     /usr/lib64/libkmod.so.2.2.10
7f3d4de00000-7f3d4de3c000 r-xp 00000000 fd:01 270079                     /usr/lib64/libblkid.so.1.1.0
7f3d4de3c000-7f3d4e03b000 ---p 0003c000 fd:01 270079                     /usr/lib64/libblkid.so.1.1.0
7f3d4e03b000-7f3d4e03e000 r--p 0003b000 fd:01 270079                     /usr/lib64/libblkid.so.1.1.0
7f3d4e03e000-7f3d4e03f000 rw-p 0003e000 fd:01 270079                     /usr/lib64/libblkid.so.1.1.0
7f3d4e03f000-7f3d4e040000 rw-p 00000000 00:00 0 
7f3d4e200000-7f3d4e207000 r-xp 00000000 fd:01 264942                     /usr/lib64/librt-2.17.so
7f3d4e207000-7f3d4e406000 ---p 00007000 fd:01 264942                     /usr/lib64/librt-2.17.so
7f3d4e406000-7f3d4e407000 r--p 00006000 fd:01 264942                     /usr/lib64/librt-2.17.so
7f3d4e407000-7f3d4e408000 rw-p 00007000 fd:01 264942                     /usr/lib64/librt-2.17.so
7f3d4e52f000-7f3d4e600000 rw-p 00000000 00:00 0 
7f3d4e600000-7f3d4e624000 r-xp 00000000 fd:01 265301                     /usr/lib64/libselinux.so.1
7f3d4e624000-7f3d4e823000 ---p 00024000 fd:01 265301                     /usr/lib64/libselinux.so.1
7f3d4e823000-7f3d4e824000 r--p 00023000 fd:01 265301                     /usr/lib64/libselinux.so.1
7f3d4e824000-7f3d4e825000 rw-p 00024000 fd:01 265301                     /usr/lib64/libselinux.so.1
7f3d4e825000-7f3d4e827000 rw-p 00000000 00:00 0 
7f3d4ea00000-7f3d4ea22000 r-xp 00000000 fd:01 264905                     /usr/lib64/ld-2.17.so
7f3d4eac7000-7f3d4ec21000 r--p 00000000 fd:01 273387                     /etc/selinux/targeted/contexts/files/file_contexts.bin
7f3d4ec21000-7f3d4ec22000 r--p 00021000 fd:01 264905                     /usr/lib64/ld-2.17.so
7f3d4ec22000-7f3d4ec23000 rw-p 00022000 fd:01 264905                     /usr/lib64/ld-2.17.so
7f3d4ec23000-7f3d4ec24000 rw-p 00000000 00:00 0 
7f3d4ec90000-7f3d4ec9c000 r--p 00000000 fd:01 278863                     /etc/selinux/targeted/contexts/files/file_contexts.homedirs.bin
7f3d4ec9c000-7f3d4eca4000 rw-p 00000000 00:00 0 
7f3d4eca7000-7f3d4ecaa000 rw-p 00000000 00:00 0 
7fff6912c000-7fff6914d000 rw-p 00000000 00:00 0                          [stack]
7fff691f2000-7fff691f6000 r--p 00000000 00:00 0                          [vvar]
7fff691f6000-7fff691f8000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0                  [vsyscall]
done
[root@kabirgoyal yc]# reboot 

Press Ctrl+C to cancel or Enter to reconnect immediately.
Reconnecting in 1 seconds...

Last login: Wed Feb 28 13:05:25 2024 from 60.191.25.170
[root@kabirgoyal ~]# uname -r 
3.10.0-1160.108.1.el7.x86_64
[root@kabirgoyal ~]# 
[root@kabirgoyal ~]# 
[root@kabirgoyal ~]# ll
total 16980
drwxr-xr-x. 2 root root     4096 Feb 28 13:04 yc
-rw-r--r--. 1 root root 17381839 Feb 28 12:03 yc.tar.gz
[root@kabirgoyal ~]# cd yc
[root@kabirgoyal yc]# sh startserver.sh 
2024-02-28T13:09:47Z    INFO    server mode
2024-02-28T13:09:47Z    INFO    server up and running   {"listen": ":30040"}
2024-02-28T13:09:47Z    DEBUG   checking for updates    {"version": "v2.2.4", "platform": "linux", "arch": "amd64-avx", "channel": "release"}
2024-02-28T13:09:48Z    DEBUG   no update available
unam^C
[root@kabirgoyal yc]# 
[root@kabirgoyal yc]# uanme -a 
-bash: uanme: command not found
[root@kabirgoyal yc]# uname -a 
Linux kabirgoyal.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
[root@kabirgoyal yc]# awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
0 : CentOS Linux (6.7.6-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-1160.108.1.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-1160.105.1.el7.x86_64) 7 (Core)
3 : CentOS Linux (3.10.0-1160.el7.x86_64) 7 (Core)
4 : CentOS Linux (0-rescue-588bfa2ca2804ff28f43b93842cbe31d) 7 (Core)
5 : CentOS Linux (0-rescue-edc47dad32bb768759cc5a1aaf8a8904) 7 (Core)
[root@kabirgoyal yc]# grub2-set-default 3
[root@kabirgoyal yc]# 
[root@kabirgoyal yc]# 
[root@kabirgoyal yc]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...

Found linux image: /boot/vmlinuz-6.7.6-1.el7.elrepo.x86_64
Found initrd image: /boot/initramfs-6.7.6-1.el7.elrepo.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.108.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.108.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.105.1.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.105.1.el7.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-1160.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-1160.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-588bfa2ca2804ff28f43b93842cbe31d
Found initrd image: /boot/initramfs-0-rescue-588bfa2ca2804ff28f43b93842cbe31d.img
Found linux image: /boot/vmlinuz-0-rescue-edc47dad32bb768759cc5a1aaf8a8904
Found initrd image: /boot/initramfs-0-rescue-edc47dad32bb768759cc5a1aaf8a8904.img
done
[root@kabirgoyal yc]# 
[root@kabirgoyal yc]# reboot

Press Ctrl+C to cancel or Enter to reconnect immediately.
Reconnecting in 1 seconds...

Last login: Wed Feb 28 13:09:34 2024 from 60.191.25.170
[root@kabirgoyal ~]# uname -a
Linux kabirgoyal.com 3.10.0-1160.el7.x86_64 #1 SMP Mon Oct 19 16:18:59 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[root@kabirgoyal ~]# cd yc
[root@kabirgoyal yc]# sh startserver.sh 
2024-02-28T13:12:43Z    INFO    server mode
2024-02-28T13:12:43Z    INFO    server up and running   {"listen": ":30040"}
2024-02-28T13:12:43Z    DEBUG   checking for updates    {"version": "v2.2.4", "platform": "linux", "arch": "amd64-avx", "channel": "release"}
2024-02-28T13:12:43Z    DEBUG   no update available
^C
[root@kabirgoyal yc]# 
[root@kabirgoyal yc]# sh startserver.sh 
2024-02-28T13:18:24Z    INFO    server mode
2024-02-28T13:18:24Z    INFO    server up and running   {"listen": ":30040"}
2024-02-28T13:18:24Z    DEBUG   checking for updates    {"version": "v2.2.4", "platform": "linux", "arch": "amd64-avx", "channel": "release"}
2024-02-28T13:18:25Z    DEBUG   no update available
^C
[root@kabirgoyal yc]# 
[root@kabirgoyal yc]# more startserver.sh 

export QUIC_GO_DISABLE_ECN=true
export HYSTERIA_LOG_LEVEL=debug 
./hysteria-linux-amd64-avx server -c server.yaml 
[root@kabirgoyal yc]# echo $QUIC_GO_DISABLE_ECN 
true

接下来我要做什么?

haruue commented 8 months ago

辛苦了……

接下来。。 要不试试 Debian 12 ? CentOS 7 再过 4 个月就寿终正寝了。

你的服务端配置看起来没有问题, 能不能发一下你的客户端配置?

关于内核版本问题, 3.10.0 那几个内核应该是不行, 请使用 0 : CentOS Linux (6.7.6-1.el7.elrepo.x86_64) 7 (Core) 这个内核。

yaochong-06 commented 8 months ago
(base) yc@kk-MacBook-Pro yc % ./hysteria-darwin-arm64
2024-02-28T21:33:20+08:00       INFO    client mode
2024-02-28T21:33:25+08:00       FATAL   failed to initialize client     {"error": "connect error: timeout: no recent network activity"}
(base) yc@kk-MacBook-Pro yc % uname -a 
Darwin kk-MacBook-Pro.local 21.1.0 Darwin Kernel Version 21.1.0: Wed Oct 13 17:33:24 PDT 2021; root:xnu-8019.41.5~1/RELEASE_ARM64_T8101 x86_64
(base) yc@kk-MacBook-Pro yc % cat ../../config.yaml 
server: "X.X.X.X:30040"

auth: chika

tls:

bandwidth:
  up: 20 mbps
  down: 100 mbps

socks5:
  listen: 127.0.0.1:50000

0111

另外我用另外一台 centos7做客户端,好像是成功了?

[root@machine yc]# uname -a 
Linux machine 3.10.0-1160.102.1.el7.x86_64 #1 SMP Tue Oct 17 15:42:21 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
[root@machine yc]# cat client.yaml
server: "X.X.X.X:30040"

auth: chika

tls:
ca: ./cert.pem

bandwidth:
up: 20 mbps
down: 100 mbps

socks5:
listen: 0.0.0.0:50000
[root@machine yc]# ./hysteria-linux-amd64 -c client.yaml
2024-02-29T09:50:31+08:00 INFO client mode
2024-02-29T09:50:31+08:00 INFO connected to server {"udpEnabled": true, "tx": 2500000, "count": 1}
2024-02-29T09:50:31+08:00 INFO use this URI to share your server {"uri": "hysteria2://chika@X.X.X.X:30040/"}
2024-02-29T09:50:31+08:00 INFO SOCKS5 server listening {"addr": "0.0.0.0:50000"}
haruue commented 8 months ago

刚才执行部分测试时防火墙没关。 重新测试了下。

服务端和客户端配置 服务端配置 ```yaml listen: :30040 tls: cert: "./cert.pem" key: "./key.pem" bandwidth: up: 100 mbps down: 20 mbps auth: type: password password: chika resolver: type: https https: addr: 1.1.1.1:443 timeout: 10s ``` 客户端配置 ```yaml server: "10.11.9.215:30040" auth: chika tls: insecure: true bandwidth: up: 20 mbps down: 100 mbps socks5: listen: 127.0.0.1:50000 ```

内核是 3.10.0-1160.el7.x86_64

  1. 在 CentOS 7 上启动服务端 listen: :40030 的情况下, ss 输出显示监听的是 [::]:40030, 但是实际上其它任意机器上的客户端用 IPv4 也能连上。
  2. 在 CentOS 7 启动服务端时需要 QUIC_GO_DISABLE_ECN=true, 否则其它机器上的客户端会连不上报 connect error: timeout: no recent network activity 。 在 CentOS 7 启动客户端时需要 QUIC_GO_DISABLE_ECN=true, 否则会直接启动失败。

内核是 6.7.6-1.el7.elrepo.x86_64

  1. 在 CentOS 7 上启动服务端 listen: :40030 的情况下, ss 输出显示监听的是 [::]:40030 (应该只是这个版本的 ss 不支持), 但是实际上其它任意机器上的客户端用 IPv4 也能连上。
  2. 服务端或者客户端都不需要 QUIC_GO_DISABLE_ECN=true 也能正常运行。
shadowwider commented 7 months ago

同样这几天突然报错connect error: timeout: no recent network activity . 我的客户端在windows上,udp端口跳跃的还可以用,但是443的就95%概率链接不上。状态和服务器端关闭了是一样的,服务器好像什么信息都接受不到。但是还有5%的概率可以通非常奇怪。 最怕的就是被GFW识别阻断了

winds365 commented 6 months ago

被识别(猜测)并qos了,加混淆

Desdemo commented 3 months ago

今天也是同样的情况