ehang-io / nps

一款轻量级、高性能、功能强大的内网穿透代理服务器。支持tcp、udp、socks5、http等几乎所有流量转发,可用来访问内网网站、本地支付接口调试、ssh访问、远程桌面,内网dns解析、内网socks5代理等等……,并带有功能强大的web管理端。a lightweight, high-performance, powerful intranet penetration proxy server, with a powerful web management terminal.
https://ehang.io/nps/documents
GNU General Public License v3.0
29.71k stars 5.36k forks source link

网络错误无法重新连接:connect: network is unreachabl #1283

Open PoonKinWang opened 2 months ago

PoonKinWang commented 2 months ago

很感谢NPS团队为开源社区带来优秀易用的网络穿透组建。 我已经使用nps一年了,在我使用的过程中,经常遇到网络波动而中断连接的情况: 2024/04/24 12:16:43.228 [E] [control.go:111] dial tcp 35.215.137.212:9990: connect: network is unreachable 这种情况出现后服务并不会再次尝试连接,我尝试过一些解决办法,比如通过systemd去守护nps服务,但由于nps连接错误的时候并不会自动退出,因此没办法通过守护进程自动重启。 根据 Issue #763 中提到的建议,我尝试过修改disconnect_time参数为默认和不同值,但是遇到网络波动时仍然发生永久性中断。

我的配置文件如下:

[common]
server_addr=nps_ip:nps_port
conn_type=tcp
vkey=nps_vkey
compress=true
crypt=true
rate_limit=10000
flow_limit=100
remark=ssh
max_conn=10