ShadowsocksR-Live / shadowsocksr-native

翻墙 从容穿越党国敏感日 ShadowsocksR (SSRoT) native implementation for all platforms, GFW terminator
https://github.com/ShadowsocksR-Live/shadowsocksr-native/wiki
GNU General Public License v3.0
2.74k stars 762 forks source link

编译成功后,无法连接到购买的服务上去 #241

Closed wangsanshi123 closed 1 year ago

wangsanshi123 commented 1 year ago

Please answer these questions before submitting your issue. Thanks!

What version of shadowsocks-native are you using?

最新版

What operating system are you using?

centos7

What did you do?

有个ssr协议的账号,手机上能够翻墙,想在centos也能翻墙。想把这个软件充当一个linux上的客户端 执行的命令:./ssr-client -c /root/download/ssr-n/config.json 然后在浏览器中配置指向代理 image

What did you expect to see?

加上这个代理后能够访问网络

What did you see instead?

不能够正常访问网络。墙内网都不行

What is your config in detail (with all sensitive info masked)?

image

ssrlive commented 1 year ago

我這裏沒問題啊。

root@ggg:~/ssr-n/build# src/ssr-client -c v.json &
root@ggg:~/ssr-n/build# cat v.json
{
    "password": "password",
    "method": "chacha20-ietf",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",

    "server_settings": {
        "listen_address": "0.0.0.0",
        "listen_port": 8380
    },

    "client_settings": {
        "server": "my server ip",
        "server_port": 8380,
        "listen_address": "0.0.0.0",
        "listen_port": 2080
    }
}

root@ggg:~/ssr-n/build# curl --proxy socks5h://127.0.0.1:2080 https://google.com
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
root@ggg:~/ssr-n/build# 

要不你架一個 python 版的服務器試試這個配置?

wangsanshi123 commented 1 year ago

~ ~ 服务端:./ssr-server -c /root/download/ssr-n/config_local.json 客户端:./ssr-client -c /root/download/ssr-n/config_local.json 配置文件: `{

"password": "password",
"method": "chacha20-ietf",
"protocol": "auth_aes128_md5",
"protocol_param": "",
"obfs": "tls1.2_ticket_auth",
"obfs_param": "",

"server_settings": {
    "listen_address": "0.0.0.0",
    "listen_port": 8380
},

"client_settings": {
    "server": "localhost",
    "server_port": 8380,
    "listen_address": "0.0.0.0",
    "listen_port": 2080
}

}` ~ 然后运行如下命令,还是不行。
(opendoor) [root@VM-16-3-centos ssr-n]# curl --proxy socks5h://127.0.0.1:2080 http://106.13.147.31:8000/ curl: (52) Empty reply from server (opendoor) [root@VM-16-3-centos ssr-n]# ~

ssrlive commented 1 year ago

客戶端 和 服務端 都報什麼信息?

wangsanshi123 commented 1 year ago

客户端:ssr-client 2022/12/09 17:46 info ==== tunnel created count 1 ==== ssr-client 2022/12/09 17:46 info tunnel_stage_handshake -- Client App S5 handshake coming. ssr-client 2022/12/09 17:46 info socks5 handshake normal style called ssr-client 2022/12/09 17:46 info tunnel_stage_handshake_replied -- Start waiting for request data. ssr-client 2022/12/09 17:46 info tunnel_stage_s5_request_from_client_app -- SOCKS5 Request data from client app. ssr-client 2022/12/09 17:46 info tunnel_stage_s5_response_done ssr-client 2022/12/09 17:46 info tunnel_stage_client_first_pkg ssr-client 2022/12/09 17:46 info ++++ connecting "106.13.147.31:8000" ... ++++ ssr-client 2022/12/09 17:46 info tunnel_stage_resolve_ssr_server_host_done -- Upstream hostname DNS lookup has completed. ssr-client 2022/12/09 17:46 error connect failed about server "106.13.147.31:8000": connection refused - tunnel_stage_resolve_ssr_server_host_done -- Upstream hostname DNS lookup has completed. ssr-client 2022/12/09 17:46 info ---- disconnected "106.13.147.31:8000" ---- ssr-client 2022/12/09 17:46 info ==== tunnel destroyed count 0 ==== ^Cssr-client 2022/12/09 17:48 info

服务端:(base) [root@VM-16-3-centos src]# ./ssr-server -c /root/download/ssr-n/config_local.json ssr-server 2022/12/09 17:46 info ShadowsocksR native server

ssr-server 2022/12/09 17:46 info listen address 0.0.0.0:8380 ssr-server 2022/12/09 17:46 info
ssr-server 2022/12/09 17:46 info method chacha20-ietf ssr-server 2022/12/09 17:46 info password password ssr-server 2022/12/09 17:46 info protocol auth_aes128_md5 ssr-server 2022/12/09 17:46 info obfs tls1.2_ticket_auth ssr-server 2022/12/09 17:46 info udp relay yes

ssrlive commented 1 year ago

測試命令改成下面試試?

curl --proxy socks5h://127.0.0.1:2080 http://baidu.com

看來你 客戶端 沒有連上 服務端。你再查查是防火牆配置。估計哪裏配錯了。

wangsanshi123 commented 1 year ago

链接百度的也试了,也不行。客户端和服务端都在同一台服务器,应该不存在防火墙的问题吧

ssrlive commented 1 year ago

那現在可以確認,你的 CentOS 有問題。這是我在我的 ubuntu 上的所有操作,連回退 libuv 舊版本的操作都做了,沒問題。 如果你懂 C 語言,可以用 lldb 跟蹤一下,看看到底哪裏出了問題。

root@gggg:~/ssr-n/build# cat src/v.json
{
    "password": "password",
    "method": "chacha20-ietf",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",

    "server_settings": {
        "listen_address": "0.0.0.0",
        "listen_port": 8380
    },

    "client_settings": {
        "server": "127.0.0.1",
        "server_port": 8380,
        "listen_address": "0.0.0.0",
        "listen_port": 2080
    }
}

root@gggg:~/ssr-n/build# history 10
  756  cd ../depends/libuv
  757  git checkout 71932a9fc9e234b3ebac90de0dd061fb00ba191b
  758  cd ../../build
  743  /root/ssr-n/build/src/ssr-server -c /root/ssr-n/build/src/v.json &
  745  src/ssr-client -c src/v.json &
  746  curl --proxy socks5h://127.0.0.1:2080 https://google.com
  749  cat src/v.json

root@gggg:~/ssr-n/build# curl --proxy socks5h://127.0.0.1:2080 https://google.com
ssr-client 2022/12/10 00:50  info  ==== tunnel created     count   1 ====
ssr-client 2022/12/10 00:50  info  tunnel_stage_handshake -- Client App S5 handshake coming.
ssr-client 2022/12/10 00:50  info  socks5 handshake normal style called
ssr-client 2022/12/10 00:50  info  tunnel_stage_handshake_replied -- Start waiting for request data.
ssr-client 2022/12/10 00:50  info  tunnel_stage_s5_request_from_client_app -- SOCKS5 Request data from client app.
ssr-client 2022/12/10 00:50  info  tunnel_stage_s5_response_done
ssr-client 2022/12/10 00:50  info  tunnel_stage_client_first_pkg
ssr-client 2022/12/10 00:50  info  ++++ connecting  "google.com:443" ... ++++
ssr-client 2022/12/10 00:50  info  tunnel_stage_connect_ssr_server_done -- Connect to server complete.
ssr-server 2022/12/10 00:50  info  ==== tunnel created     count   1 ====
ssr-client 2022/12/10 00:50  info  tunnel_stage_ssr_auth_sent
ssr-server 2022/12/10 00:50  info  tunnel_stage_initial
ssr-server 2022/12/10 00:50  info  tunnel_stage_obfs_receipt_done
ssr-client 2022/12/10 00:50  info  tunnel_stage_ssr_server_feedback_arrived
ssr-server 2022/12/10 00:50  info  tunnel_stage_client_feedback_coming
ssr-client 2022/12/10 00:50  info  tunnel_stage_ssr_receipt_to_server_sent
ssr-client 2022/12/10 00:50  info  tunnel_stage_auth_completion_done -- Auth succeeded. Can start piping data.
ssr-server 2022/12/10 00:50  info  tunnel_stage_protocol_confirm_done
ssr-client 2022/12/10 00:50  info  tunnel_stage_streaming -- Pipe data back and forth. ...
ssr-server 2022/12/10 00:50  info  connecting "google.com:443" ...
ssr-server 2022/12/10 00:50  info  tunnel_stage_connect_host
ssr-server 2022/12/10 00:50  info  tunnel_stage_streaming ...
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="https://www.google.com/">here</A>.
</BODY></HTML>
ssr-server 2022/12/10 00:50  info  ==== tunnel destroyed   count   0 ====
ssr-client 2022/12/10 00:50  info  ---- disconnected  "google.com:443" ----
ssr-client 2022/12/10 00:50  info  ==== tunnel destroyed   count   0 ====
wangsanshi123 commented 1 year ago

image 原来是配置文件中不能用localhost,换成127.0.0.1就可以了

wangsanshi123 commented 1 year ago

在本地运行客户端和和服务端,然后代理访问百度是能成功的。 (base) [root@VM-16-3-centos ~]# curl --proxy socks5h://localhost:2080 https://baidu.com

<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html>

但是通过客户端访问购买的远程服务不行。 配置文件如下:

{
    "password": "xxx",
    "method": "chacha20-ietf",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",

    "client_settings": {
        "server": "remote ip",
        "server_port": 7002,
        "listen_address": "0.0.0.0",
        "listen_port": 1081
    }

}

运行命令 (base) [root@VM-16-3-centos ~]# curl --proxy socks5h://localhost:1081 https://baidu.com curl: (35) Encountered end of file (base) [root@VM-16-3-centos ~]# curl --proxy socks5h://localhost:1081 https://google.com curl: (35) Encountered end of file (base) [root@VM-16-3-centos ~]#

客户端日志:

(base) [root@VM-16-3-centos src]# ./ssr-client -c ./ssr-client -c /root/download/ssr-n/config.json
ssr-client 2022/12/12 11:22  info  ShadowsocksR native client

ssr-client 2022/12/12 11:22  info  remote server    orac*******************:7002
ssr-client 2022/12/12 11:22  info  method           chacha20-ietf
ssr-client 2022/12/12 11:22  info  password         di****
ssr-client 2022/12/12 11:22  info  protocol         auth_aes128_md5
ssr-client 2022/12/12 11:22  info  obfs             tls1.2_ticket_auth
ssr-client 2022/12/12 11:22  info  udp relay        yes

ssr-client 2022/12/12 11:22  info  listening on     0.0.0.0:1081

ssr-client 2022/12/12 11:22  info  ==== tunnel created     count   1 ====
ssr-client 2022/12/12 11:22  info  tunnel_stage_handshake -- Client App S5 handshake coming.
ssr-client 2022/12/12 11:22  info  socks5 handshake normal style called
ssr-client 2022/12/12 11:22  info  tunnel_stage_handshake_replied -- Start waiting for request data.
ssr-client 2022/12/12 11:22  info  tunnel_stage_s5_request_from_client_app -- SOCKS5 Request data from client app.
ssr-client 2022/12/12 11:22  info  tunnel_stage_s5_response_done
ssr-client 2022/12/12 11:22  info  tunnel_stage_client_first_pkg
ssr-client 2022/12/12 11:22  info  ++++ connecting  "baidu.com:443" ... ++++
ssr-client 2022/12/12 11:22  info  tunnel_stage_resolve_ssr_server_host_done -- Upstream hostname DNS lookup has completed.
ssr-client 2022/12/12 11:22  info  tunnel_stage_connect_ssr_server_done -- Connect to server complete.
ssr-client 2022/12/12 11:22  info  tunnel_stage_ssr_auth_sent
ssr-client 2022/12/12 11:22  info  tunnel_stage_ssr_server_feedback_arrived
ssr-client 2022/12/12 11:22  info  tunnel_stage_ssr_receipt_to_server_sent
ssr-client 2022/12/12 11:22  info  tunnel_stage_auth_completion_done -- Auth succeeded. Can start piping data.
ssr-client 2022/12/12 11:22  info  tunnel_stage_streaming -- Pipe data back and forth. ...
ssr-client 2022/12/12 11:22  info  ---- disconnected  "baidu.com:443" ----
ssr-client 2022/12/12 11:22  info  ==== tunnel destroyed   count   0 ====
ssr-client 2022/12/12 11:22  info  ==== tunnel created     count   1 ====
ssr-client 2022/12/12 11:22  info  tunnel_stage_handshake -- Client App S5 handshake coming.
ssr-client 2022/12/12 11:22  info  socks5 handshake normal style called
ssr-client 2022/12/12 11:22  info  tunnel_stage_handshake_replied -- Start waiting for request data.
ssr-client 2022/12/12 11:22  info  tunnel_stage_s5_request_from_client_app -- SOCKS5 Request data from client app.
ssr-client 2022/12/12 11:22  info  tunnel_stage_s5_response_done
ssr-client 2022/12/12 11:22  info  tunnel_stage_client_first_pkg
ssr-client 2022/12/12 11:22  info  ++++ connecting  "google.com:443" ... ++++
ssr-client 2022/12/12 11:22  info  tunnel_stage_resolve_ssr_server_host_done -- Upstream hostname DNS lookup has completed.
ssr-client 2022/12/12 11:22  info  tunnel_stage_connect_ssr_server_done -- Connect to server complete.
ssr-client 2022/12/12 11:22  info  tunnel_stage_ssr_auth_sent
ssr-client 2022/12/12 11:22  info  tunnel_stage_ssr_server_feedback_arrived
ssr-client 2022/12/12 11:22  info  tunnel_stage_ssr_receipt_to_server_sent
ssr-client 2022/12/12 11:22  info  tunnel_stage_auth_completion_done -- Auth succeeded. Can start piping data.
ssr-client 2022/12/12 11:22  info  tunnel_stage_streaming -- Pipe data back and forth. ...
ssr-client 2022/12/12 11:22  info  ---- disconnected  "google.com:443" ----
ssr-client 2022/12/12 11:22  info  ==== tunnel destroyed   count   0 ====
ssrlive commented 1 year ago

你的服務端應該是修改過的。你可以安裝個python 服務端測試一把。

wangsanshi123 commented 1 year ago

直接通过在网上下载安卓版的shadowsocksR的客户端是能使用的。安装python服务器怎样测试,应该先要安装客户端端吧?

ssrlive commented 1 year ago

再次確認,我的實現沒問題。以下這堆輸出你肯定能看懂啥意思。

root@gggg:~# cat /root/ssr-n/build/src/v.json
{
    "password": "password",
    "method": "chacha20-ietf",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",

    "client_settings": {
        "server": "127.0.0.1",
        "server_port": 8380,
        "listen_address": "0.0.0.0",
        "listen_port": 2080
    }
}
root@gggg:~# /root/ssr-n/build/src/ssr-client -c /root/ssr-n/build/src/v.json
root@gggg:~#
root@gggg:~# apt install libsodium-dev
root@gggg:~# git clone https://github.com/ssrlive/shadowsocksr.git pyssr
root@gggg:~# cd ~/pyssr/shadowsocks
root@gggg:~/pyssr/shadowsocks# cp ../config.json ../user-config.json
root@gggg:~/pyssr/shadowsocks# cat ../user-config.json
{
    "local_address": "127.0.0.1",
    "local_port": 2080,

    "server": "0.0.0.0",
    "server_ipv6": "::",
    "server_port": 8380,

    "password": "password",
    "method": "chacha20-ietf",
    "protocol": "auth_aes128_md5",
    "protocol_param": "",
    "obfs": "tls1.2_ticket_auth",
    "obfs_param": "",

    "speed_limit_per_con": 0,
    "speed_limit_per_user": 0,

    "additional_ports" : {},
    "additional_ports_only" : false,
    "timeout": 120,
    "udp_timeout": 60,
    "dns_ipv6": false,
    "connect_verbose_info": 0,
    "redirect": "",
    "fast_open": false
}
root@gggg:~/pyssr/shadowsocks# /root/pyssr/shadowsocks/server.py -c /root/pyssr/user-config.json &
[1] 270000
root@gggg:~/pyssr/shadowsocks# IPv6 support
2022-12-12 17:38:53 INFO     util.py:88 loading libsodium from libsodium.so.23
/usr/lib/python3/dist-packages/pkg_resources/__init__.py:116: PkgResourcesDeprecationWarning: 1.1build1 is an invalid version and will not be supported in a future release
  warnings.warn(
2022-12-12 17:38:53 INFO     shell.py:72 ShadowsocksR 3.4.0 2017-07-27
2022-12-12 17:38:53 INFO     server.py:46 current process RLIMIT_NOFILE resource: soft 1024 hard 1048576
2022-12-12 17:38:53 INFO     asyncdns.py:324 dns server: [('127.0.0.53', 53)]
2022-12-12 17:38:53 INFO     server.py:105 server start with protocol[auth_aes128_md5] password [b'password'] method [chacha20-ietf] obfs [tls1.2_ticket_auth] obfs_param []
2022-12-12 17:38:53 INFO     server.py:121 starting server at [b'::']:8380
2022-12-12 17:38:53 INFO     server.py:141 starting server at 0.0.0.0:8380

root@gggg:~/pyssr/shadowsocks# curl --proxy socks5h://127.0.0.1:2080 https://baidu.com
2022-12-12 17:39:46 INFO     util.py:88 loading libcrypto from libcrypto.so.3
<html>
<head><title>302 Found</title></head>
<body bgcolor="white">
<center><h1>302 Found</h1></center>
<hr><center>bfe/1.0.8.18</center>
</body>
</html>
root@gggg:~/pyssr/shadowsocks# 
ssrlive commented 1 year ago

最後再奉勸一句,這種很快就被封的節點,不用也罷。浪費的時間、精力不算錢的嗎?

當然如果你的節點是網上隨意找的臨時節點,那你不僅在浪費你的時間生命,也是在浪費我的時間生命。你認爲你的時間生命就值幾個免費節點的錢嗎?