查看“FAQ:SS客户端”的源代码
←
FAQ:SS客户端
跳到导航
跳到搜索
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[category:Software]] == 关于 == 目前 Shadowsocks 有多个实现支持,以自由软件形式发布的主要有:原始 Shadowsocks(以Python语言编写)、Shadowsocks-libev(分支项目openwrt-Shadowsocks)、Shadowsocks-rust、Shadowsocks-go/go-Shadowsocks2、libQtShadowsocks、Shadowsocks-qt5(仅作为客户端)、Shadowsocks-android(仅作为客户端)、Shadowsocks-windows(仅作为客户端)、ShadowsocksX-NG(仅作为客户端)、Shadowsocks-R、Outline、V2Ray、Brook、Trojan 等等,还有为数甚多的免费软件及商业软件。 : [[File:Shadowsocks 原理.png|600px|Shadowsocks 原理]] === 版本 === Server 版本: * [https://github.com/shadowsocks shadowsocks-python]: python版本 * [https://github.com/shadowsocks/shadowsocks-go shadowsocks-go]:go版本 * [https://github.com/shadowsocks/go-shadowsocks2 go-shadowsocks2]:重构的 Go 版本,核心功能增强。 * [https://github.com/shadowsocks/shadowsocks-libev.git shadowsocks-libev]:C with libev,用的最广的一个版本,有Docker版本。同时包含 server 和 client。 * [https://github.com/shadowsocks/libQtShadowsocks.git libQtShadowsocks]:C++ with Qt。 * [https://github.com/zhou0/shadowsocks-perl shadowsocks-perl]:Perl版本。 Client 版本: * [https://github.com/shadowsocks/shadowsocks-windows/releases shadowsocks-windows]:windows 客户端 * [https://github.com/shadowsocks/ShadowsocksX-NG/releases shadowsocksX-NG]:macos 客户端 * [https://github.com/shadowsocks/shadowsocks-qt5/releases Shadowsocks-Qt5]:linux 客户端,基于Qt * [https://play.google.com/store/apps/details?id=com.github.shadowsocks shadowsocks-android]:android 客户端 Google Play * [https://github.com/Jigsaw-Code/outline-client/ outline-app]:outline 项目客户端,支持iOS * [https://github.com/shadowsocks/openwrt-shadowsocks Shadowsocks-libev for OpenWrt]:可以用于路由器 OpenWRT 的客户端 Outline 项目:(Outline 是一个开源的 VPN 项目) * [https://github.com/Jigsaw-Code/outline-ss-server outline-ss-server]:由 go-shadowsocks2 驱动 Shadowsocks 服务端程序。 * outline-server:VPN 服务端 GUI 管理工具,用于创建和管理 Outline servers。基于 Electron,支持 Windows, macOS and Linux。 * [https://github.com/Jigsaw-Code/outline-client/ outline-client]:兼容 Shadowsocks 的 VPN 客户端,基于 Cordova 和 Electron,支持 Windows、Android / ChromeOS、Linux、iOS、macOS。 Shadowsocks-R 相关项目:(shadowsocks-R 相关版本支持 SSR 混淆功能) * [https://github.com/qinyuhang/ShadowsocksX-NG-R/releases ShadowsocksX-NG-R]:ssr macos客户端 * [https://github.com/shadowsocksrr/shadowsocksr-android/releases/ shadowsocksr-android]:ssr android客户端 * [https://github.com/shadowsocksrr/shadowsocksr-csharp/releases/ shadowsocksr-csharp]:ssr windows客户端 其他 iOS 客户端:(均需要需要美国地区的 apple id) * Potatso Lite:Shadowsocks 及 Shadowsocksr 混淆 * [https://itunes.apple.com/app/outline-app/id1356177741 outline]:App Store == 服务端 == 一般安装在 Linux 中,也有各个不同的实现版本,还有不同的混淆方式,插件等。 推荐使用: Shadowsocks-libev 是用纯C编写的,依赖于libev。它被设计为shadowsocks协议的轻量级实现,以尽可能降低资源使用率。 参考: 1、[https://github.com/shadowsocks/shadowsocks-libev shadowsocks-libev GitHub页面]【有关于各个版本、各个安装方式的说明】 === 安装 === ---- 服务端的安装也有不同方式:一件安装脚本、编译安装、snap 等等。 ==== 一键安装脚本 ==== 【以下使用“[https://teddysun.com/ 秋水逸冰]”的脚本([https://github.com/teddysun/shadowsocks_install/tree/master 多个可选的脚本])】 参见: 1、 [https://huhao.ai/ke-xue-shang-wang-shadowsocks-quan-xi-lie-pei-zhi-zong-jie/ 科学上网1:shadowsocks 全系列配置总结] 2、 [https://www.xiaohuai.com/3948/ CentOS下shadowsocks-libev一键安装脚本] 3、 [https://www.xlovett.com/1288.html shadowsocks-libev个人自用版v3.3.5] # 安装: #: <syntaxhighlight lang="bash" highlight=""> # 获取脚本:(四合一脚本) wget --no-check-certificate -O shadowsocks-all.sh https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-all.sh # 脚本可执行权限: chmod +x shadowsocks-all.sh # Shadowsocks-libev 脚本: ./shadowsocks-all.sh 2>&1 | tee shadowsocks-all.log </syntaxhighlight> #* wget 默认下载到当前目录。 #* 安装日志位于:“/var/log/shadowsocks-all.log” #* 本脚本安装完成后,会将 shadowsocks-libev 加入开机自启动。 # 配置: #: <syntaxhighlight lang="bash" highlight=""> vi /etc/shadowsocks-libev/config.json ... </syntaxhighlight> # 操作: #: <syntaxhighlight lang="bash" highlight=""> # 启动|停止|重启|状态 /etc/init.d/shadowsocks start|stop|restart|status </syntaxhighlight> # 更新: #: 先:卸载旧版本;再:重新执行如上安装步骤; # 卸载: #: <syntaxhighlight lang="bash" highlight=""> # 四合一脚本 ./shadowsocks-all.sh uninstall </syntaxhighlight> :* 如果使用其他脚本,也类似: :*: <syntaxhighlight lang="bash" highlight=""> # Shadowsocks-python 脚本: # 安装 wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks.sh chmod +x shadowsocks.sh ./shadowsocks.sh 2>&1 | tee shadowsocks.log # 卸载 ./shadowsocks.sh uninstall # Shadowsocks-libev 脚本: # 安装 wget --no-check-certificate https://raw.githubusercontent.com/teddysun/shadowsocks_install/master/shadowsocks-libev.sh chmod +x shadowsocks-libev.sh ./shadowsocks-libev.sh 2>&1 | tee shadowsocks-libev.log # 卸载 ./shadowsocks-libev.sh uninstall </syntaxhighlight> ==== 仓库安装 ==== 由于在 COPR (Cool Other Package Repo) 中已经有打包好的 shadowsocks-libev,因此我们只需几条命令便能完成安装。 参考: 1、[https://zzz.buzz/zh/gfw/2017/08/14/install-shadowsocks-server-on-centos-7/ CentOS/RHEL 7 下安装 Shadowsocks 服务端] # 安装: #: <syntaxhighlight lang="bash" highlight=""> cd /etc/yum.repos.d/ curl -O https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo yum install -y shadowsocks-libev </syntaxhighlight> #* 安装完成后,会有 ss-local, ss-manager, ss-nat, ss-redir, ss-server, ss-tunnel 命令可用。 #*: 其中,作为服务器,我们需要的是 '''ss-server''',不过后文中我们将通过服务文件启动 Shadowsocks,而不会直接与 ss-server 命令打交道。 #* 如果安装报类似如下错误: #*: <syntaxhighlight lang="bash" highlight=""> Error: Package: shadowsocks-libev-3.1.3-1.el7.centos.x86_64 (librehat-shadowsocks) Requires: libsodium >= 1.0.4 Error: Package: shadowsocks-libev-3.1.3-1.el7.centos.x86_64 (librehat-shadowsocks) Requires: mbedtls </syntaxhighlight> #*: 说明系统没有启用 '''EPEL''' (Extra Packages for Entreprise Linux)。那么我们需要首先启用 EPEL,再安装 shadowsocks-libev: #*: <syntaxhighlight lang="bash" highlight=""> yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum install -y shadowsocks-libev </syntaxhighlight> # 验证安装: #: 在继续后文的配置之前,我们先在命令行中执行一次 ss-server 命令,以确认 shadowsocks 及其依赖已正确安装。 #: <syntaxhighlight lang="bash" highlight=""> ss-server </syntaxhighlight> #* 如果执行 ss-server 报错:“ss-server: error while loading shared libraries: libmbedcrypto.so.0: cannot open shared object file: No such file or directory”, #*: 使用 root 身份执行以下命令即可: #*: <syntaxhighlight lang="bash" highlight=""> cd /usr/lib64 ln -s libmbedcrypto.so.1 libmbedcrypto.so.0 </syntaxhighlight> # 配置: #: <syntaxhighlight lang="bash" highlight=""> vi /etc/shadowsocks-libev/config.json ... </syntaxhighlight> # 操作: #: <syntaxhighlight lang="bash" highlight=""> # 启动|停止|重启|状态 systemctl start|stop|restart|status shadowsocks-libev # 开机启动 systemctl enable shadowsocks-libev # 查看 Shadowsocks 服务的全部日志: journalctl -u shadowsocks-libev </syntaxhighlight> # 更新: #: <syntaxhighlight lang="bash" highlight=""> yum update shadowsocks-libev </syntaxhighlight> # 卸载: #: <syntaxhighlight lang="bash" highlight=""> yum erase shadowsocks-libev </syntaxhighlight> ==== snap ==== 通过 Snap 应用商店安装 Shadowsocks-libev 是'''官方推荐'''的方式。【Snap 是安装最新二进制文件的推荐方法。】 Snap 是 Canonical 推出的一种新的软件打包格式,彻底解决linux依赖性的问题,Snap 软件包拥有更加稳定和安全的特性。snap也就是安装snap软件包的命令。 Note:Snap 适用于 CentOS 7.6+、Red Hat Enterprise Linux 7.6+,可从企业 Linux 额外软件包(EPEL)存储库获得。 参考: 1、Snap 参考:[https://snapcraft.io/core Snap 官网] 2、[https://gfw.report/blog/ss_tutorial/zh/ 如何部署一台抗封锁的Shadowsocks-libev服务器] 3、[https://zh.codepre.com/how-to-24542.html 如何在CentOS上设置Shadowsocks-libev代理服务器] 安装: # 安装 snap: ## Enable snapd: ##: <syntaxhighlight lang="bash" highlight=""> # 将 EPEL 存储库添加到系统中 sudo yum install epel-release # 安装 snap sudo yum install snapd # 安装后,需要启用管理主 snap 通信套接字的 systemd 单元: sudo systemctl enable --now snapd.socket # 要启用 Classic snap 支持,需要在 /var/lib/snapd/snap 和 /snap 之间创建符号链接: sudo ln -s /var/lib/snapd/snap /snap # 请注销并重新登录,或重新启动系统,以确保 snap 的路径得到正确更新。 systemctl reboot </syntaxhighlight> ## Install core: ##: <syntaxhighlight lang="bash" highlight=""> sudo snap install core </syntaxhighlight> # 从 snap 安装 Shadowsocks: #: <syntaxhighlight lang="bash" highlight=""> # Stable channel sudo snap install shadowsocks-libev # Edge channel: sudo snap install shadowsocks-libev --edge </syntaxhighlight> #* snap 软件包一般安装在 /snap 目录下; #* 安装完成,显示有关 shadowsocks-libev: #*: <syntaxhighlight lang="bash" highlight=""> snap info shadowsocks-libev </syntaxhighlight> # 配置: #: <syntaxhighlight lang="bash" highlight=""> sudo vim /var/snap/shadowsocks-libev/common/server-config.json # sudo vim /var/snap/shadowsocks-libev/common/etc/shadowsocks-libev/config.json ... </syntaxhighlight> #* 配置文件位置变了,不同于直接安装时的 /etc/shadowsocks/config.json; # 操作: #: <syntaxhighlight lang="bash" highlight=""> # 启动|停止|重启|状态 sudo systemctl start|stop|restart|status snap.shadowsocks-libev.ss-server-daemon.service # 开机启动 sudo systemctl enable snap.shadowsocks-libev.ss-server-daemon.service </syntaxhighlight> # 更新: #* Snap 会每天自动更新通过其安装的软件,因此通常情况下你不需要手动更新。 #* 如若需要手动更新: #*: <syntaxhighlight lang="bash" highlight=""> sudo snap refresh </syntaxhighlight> # 卸载: #: <syntaxhighlight lang="bash" highlight=""> sudo snap remove shadowsocks-libev </syntaxhighlight> #* 可能还需要手工清理相关配置文件?? :* '''将 Shadowsocks-libev 服务器作为系统服务运行''': :*: 我们可以手动运行Shadowsocks-libev服务器,但是为它创建一个 systemd 服务单元更为方便,因此可以在启动时自动启动它: :*: <syntaxhighlight lang="bash" highlight=""> sudo vim /etc/systemd/system/shadowsocks-libev.service # 在此文件中添加以下行 [Unit] Description=Shadowsocks-Libev Server After=network-online.target [Service] Type=simple ExecStart=/usr/bin/snap run shadowsocks-libev.ss-server -c /var/snap/shadowsocks-libev/common/server-config.json Restart=always RestartSec=2 [Install] WantedBy=multi-user.target </syntaxhighlight> :*: 则可更方便地进行服务单元管理: <syntaxhighlight lang="bash" highlight=""> # 启动|停止|重启|状态 sudo systemctl start|stop|restart|status shadowsocks-libev.service # 开机启动 sudo systemctl enable shadowsocks-libev.service </syntaxhighlight> ==== 编译安装 ==== 如果您使用的是 CentOS 7,则需要安装预要求才能从源代码生成。 In general, you need the following build dependencies: autotools (autoconf, automake, libtool) gettext pkg-config libmbedtls libsodium libpcre3 (old pcre library) libev libc-ares asciidoc (for documentation only) xmlto (for documentation only) 参考: 1、[https://www.jianshu.com/p/dea2d322b4a9 CentOS7下手动编译安装Shadowsocks-libev最新版] 2、[http://fhaoer.com/20190617-shadowsocks-libev/ 安装并配置shadowsocks-libev(yum源方式)] # 安装要求: #: <syntaxhighlight lang="bash" highlight=""> # 安装 epel 源 yum install epel-release -y # 安装编译工具 yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto c-ares-devel libev-devel libsodium-devel mbedtls-devel -y # 还需要使用到 git yum install git </syntaxhighlight> # 下载源码: #: <syntaxhighlight lang="bash" highlight=""> git clone https://github.com/shadowsocks/shadowsocks-libev.git cd shadowsocks-libev git submodule update --init --recursive </syntaxhighlight> # 编译源码并安装: #: <syntaxhighlight lang="bash" highlight=""> # 确保是在 ss 目录中执行 cd shadowsocks-libev # 编译 ./autogen.sh && ./configure && make # 安装(root 权限下) sudo make install </syntaxhighlight> #* 程序默认安装到 /usr/local 下面(./autogen.sh 脚本指定了安装路径),如果需要覆盖安装目录,请使用“./configure --prefix=<路径>”。 # 创建配置文件: #: <syntaxhighlight lang="bash" highlight=""> mkdir -p /etc/shadowsocks-libev vim /etc/shadowsocks-libev/config.json ... </syntaxhighlight> # 操作: #: <syntaxhighlight lang="bash" highlight=""> # 启动|停止|重启|状态 systemctl start|stop|restart|status shadowsocks-libev # 开机启动 systemctl enable shadowsocks-libev </syntaxhighlight> #* 安装过程中,如果对配置有任何更改,只要重启下服务就行了。 # 更新: #* 获取新的源码重新编译。 # 卸载:(两种情况) ## 如果 Makefile 文件有 uninstall 命令:安装目录中执行“make uninstall”: ##: <syntaxhighlight lang="bash" highlight=""> # 确保是在 ss 目录中执行 cd shadowsocks-libev # 安装(root 权限下) sudo make uninstall </syntaxhighlight> ## 如果 Makefile 文件没有 uninstall 命令:需要删除软件相关的目录、文件: ### 如果在“./configure”的时候加了“--prefix=<路径>”参数:将改路径文件(安装目录)删除即可; ### 否则,只能根据 make install 中的步骤(或查看 makefile 文件),看它把什么文件拷到哪,一一删除。 #* '''所以,即使安装完成,其源码文件最好也不要轻易删除'''。 === 配置 === ---- (以 Shadowsocks-libev 为例:) <syntaxhighlight lang="bash" highlight=""> vi /etc/shadowsocks-libev/config.json { "server":"0.0.0.0", "server_port":*****, "password":"***************", "timeout":300, "user":"nobody", "method":"********-****-********", "fast_open":true, "nameserver":"8.8.8.8", "mode":"tcp_and_udp" } </syntaxhighlight> === 加速 === ---- 安装锐速需要降级系统内核,而安装 Google BBR 则需要升级系统内核,故两者不能同时安装。 ==== 锐速 ==== BBR、BBR PLUS、魔改BBR、锐速的脚本安装要求: 1、适用架构:KVM / Xen,不支持OpenVZ(OVZ)。 2、适用系统:CentOS 7、Debian 8、Debian 9、Ubuntu 16.04、Ubuntu 18.04。 [https://www.91yun.co/serverspeeder91yun 锐速安装一键包] 安装:(现在不知道哪一个可以用) : <syntaxhighlight lang="bash" highlight=""> # 使用一键安装脚本 wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/serverspeeder/master/serverspeeder-all.sh && bash serverspeeder-all.sh # 或: wget -N --no-check-certificate https://github.com/91yun/serverspeeder/raw/master/serverspeeder.sh && bash serverspeeder.sh </syntaxhighlight> * 不需要任何配置。<s><code>“vi /serverspeeder/etc/config”</code></s> 卸载: : <syntaxhighlight lang="bash" highlight=""> chattr -i /serverspeeder/etc/apx* && /serverspeeder/bin/serverSpeeder.sh uninstall -f </syntaxhighlight> 操作: : <syntaxhighlight lang="bash" highlight=""> service serverSpeeder start|stop|restart|status # 或 /serverspeeder/bin/serverSpeeder.sh start|stop|restart|status </syntaxhighlight> ==== BBR ==== TCP BBR 是一种 TCP 拥塞控制算法,可以大大提高连接速度。 Google 开源了其 TCP BBR 拥塞控制算法,并提交到了 Linux 内核,从 4.9 开始,Linux 内核已经用上了该算法。根据以往的传统,Google 总是先在自家的生产环境上线运用后,才会将代码开源,此次也不例外。 安装/开启:【两种情况】 # (如果 Linux 内核在 4.9 以下)需要安装并开启 BBR:(可使用一键安装脚本) #: <syntaxhighlight lang="bash" highlight=""> # 安装并开启 BBR(同样是使用脚本) wget --no-check-certificate https://github.com/teddysun/across/raw/master/bbr.sh && chmod +x bbr.sh && ./bbr.sh </syntaxhighlight> # (如果 Linux 内核在 4.9 及以上)只需开启 BBR 即可: ## 修改配置文件: ##: <syntaxhighlight lang="bash" highlight=""> vim /etc/sysctl.conf # 添加如下内容 net.core.default_qdisc = fq net.ipv4.tcp_congestion_control = bbr </syntaxhighlight> ## 加载系统参数: ##: <syntaxhighlight lang="bash" highlight=""> sysctl -p </syntaxhighlight> 验证 BBR 是否已经开启: # <syntaxhighlight lang="bash" highlight=""> # 检查使用中的拥塞控制算法 sysctl net.ipv4.tcp_available_congestion_control </syntaxhighlight> #: 若返回如下信息则说明已开启: #: <syntaxhighlight lang="bash" highlight=""> net.ipv4.tcp_available_congestion_control = bbr </syntaxhighlight> # <syntaxhighlight lang="bash" highlight=""> lsmod | grep bbr </syntaxhighlight> #: 若返回如下信息则说明已开启: #: <syntaxhighlight lang="bash" highlight=""> tcp_bbr 16384 1 tcp_bbr 20480 0 </syntaxhighlight> ==== TFO ==== 您可以通过启用 TCP 快速打开('''fast_open''')来加快 Shadowsocks 的速度。 TCP 是面向连接的协议,这意味着只能在建立连接后才能交换数据,这是通过三向握手完成的。换句话说,传统上,数据只能在三向握手完成后才能交换。 TCP 快速打开('''TFO''')是一种机制,它允许在三向握手完成之前交换数据,最多可节省 1 个往返时间(RTT)。 从 3.7 版开始,TCP 快速打开支持已合并到 Linux 内核,从 3.13 版开始默认启用。 检查服务器的 TFO 配置:(从 3.13 版内核开始默认启用) : <syntaxhighlight lang="bash" highlight=""> cat /proc/sys/net/ipv4/tcp_fastopen </syntaxhighlight> :* '''0''':表示禁用。 :* '''1''':表示已启用传出连接(作为客户端)。 :* '''2''':表示已启用传入连接(作为服务器)。 :* '''3''':表示已启用传出和传入连接。 启用 TCP 的“fast_open”: # 修改配置文件: #: <syntaxhighlight lang="bash" highlight=""> sudo vi /etc/sysctl.conf net.ipv4.tcp_fastopen=3 # 插入内容 </syntaxhighlight> # 重新加载 sysctl 设置以使更改生效: #: <syntaxhighlight lang="bash" highlight=""> sudo sysctl -p </syntaxhighlight> # 在 Shadowsocks 服务器配置文件中启用 TFO: #: <syntaxhighlight lang="bash" highlight=""> vi /etc/shadowsocks-libev/config.json "fast_open": true # 插入内容 </syntaxhighlight> === 混淆插件 === ---- 参考: 1、[https://bingliang.me/posts/2019-03-20-shadowsocks-libev-with-v2ray-plugin/ 配置 shadowsocks-libev 加 v2ray-plugin] 2、[https://cokebar.info/archives/1988 添加混淆: simple-obfs + shadowsocks for Windows] ?????????????????? === 其他步骤 === ---- # 开放端口: #: <syntaxhighlight lang="bash" highlight=""> # 添加防火墙规则 firewall-cmd --permanent --zone=public --add-port=39451/tcp firewall-cmd --permanent --zone=public --add-port=39451/udp # 更新防火墙规则 firewall-cmd --reload # 启动|关闭|重新启动 防火墙 (有上一步则不需要) systemctl [start|stop|restart] firewalld.service </syntaxhighlight> == 客户端 == === Windows 客户端 === ---- ==== 安装 ==== Shadowsocks的项目链接在[https://github.com/shadowsocks/shadowsocks-windows shadowsocks-windows]。<br/> # 下载'''Shadowsocks-4.1.10.0.zip''',并解压到本地Shadowsocks文件夹内(<code>D:\Program Files (x86)\Shadowsocks</code>) # 启动'''Shadowsocks.exe'''会自动加载其他内容 # 覆盖备份的配置文件'''gui-config.json''',然后重启Shadowsocks ==== 备份 ==== 需要备份的内容:code # '''<code>gui-config.json</code>''':(<code>D:\Program Files (x86)\Shadowsocks</code>)Shadowsocks使用的服务器配置文件 # '''<code>mgwz.dll</code>''':(<code>D:\Program Files (x86)\Shadowsocks\ss_win_temp</code>)Privoxy所需的动态库(不会自动生成或下载?) 其余内容会在Shadowsocks启动时自动生成,'''<code>gfwlist.txt</code>'''和'''<code>pac.txt</code>'''会在从GFWList更新本地PAC时生成。 ==== 目录结构 ==== * <s>'''libcrypto-1_1.dll''' : 加密库</s>(没这个) * '''libsscrypto.dll''' : 加密库 * '''mgwz.dll''' : Privoxy所需的动态库 * '''privoxy_<随机数>.conf''' : Privoxy配置文件 * '''shadowsocks.log''' : SS本身的日志 * '''ss_privoxy.exe''' : Privoxy主程序 * '''ss_privoxy.log''' : Privoxy的日志 * '''sysproxy.exe''' : 用于系统代理的代理设置程序 === Linux 客户端 === ---- 参考: 1、[https://zzz.buzz/zh/gfw/2018/03/21/install-shadowsocks-client-on-centos-7/ CentOS/RHEL 7 下安装 Shadowsocks 客户端] 2、[https://segmentfault.com/a/1190000040351044 CentOS7 安装 ShadowSocks 客户端] == FAQ == 问题参考: 1、[https://github.com/shadowsocks/shadowsocks-windows/issues/3215 求助,无法使用,提示一直超时 #3215] 2、[https://github.com/shadowsocks/shadowsocks-windows/issues/2228 为什么昨天刚换的Ip,今天就被封 #2228] === Shadowsocks错误:端口被占用 === [[File:ShadowsocksException端口已被占用.png|right|400px]] * Shadowsocks自启动时出现该问题,先排除其他服务或应用占用端口,确认由Shadowsocks导致 解决,重装Shadowsocks(?或删除并重新设置启动项?): # 删除Windows启动项中的Shadowsocks; # 备份Shadowsocks内容,并重新安装; # 右键Shadowsocks勾选“开机启动” 如未解决,参考GitHub中项目的问题页: # [https://github.com/shadowsocks/shadowsocks-windows/issues/314 Shadowsocks 错误: 端口已被占用] # [https://github.com/shadowsocks/shadowsocks-windows/issues/2171 win10 x64最近一次更新后提示端口已被占用] === Shadowsocks错误:系统保留端口 === [[File:ShadowsocksException系统保留端口.png|right|400px]] 如未解决,参考GitHub中项目的问题页: # [https://github.com/shadowsocks/shadowsocks-windows/issues/2948 Shadowsocks 错误:端口1080是系统保留端口] # [https://github.com/shadowsocks/shadowsocks-windows/issues/2630 对端口被系统保留的测试] === 修改Shadowsocks本地端口 === 出现以上两个错误:“端口被占用”、“系统保留端口”,最快捷的方式就是修改ss使用的本地端口。<br/> 修改之后还需确认软件的代理方式: # Windows系统代理:“设置”->“网络和Internet”->“代理”中,选用“手动设置代理服务器”,并设置 #: <syntaxhighlight lang="XML">地址:http://localhost,端口:10800(修改的端口)</syntaxhighlight> # Chrome的ProxySwitchyOmega插件:在“情景模式”->“Shadowsocks”中,设置 #: <syntaxhighlight lang="XML">代理协议:SOCKS5,地址:http://localhost,端口:10800(修改的端口)</syntaxhighlight> # 应用软件的代理设置: #: 使用“System Proxy Setting”,即“Windows系统代理”的设置 #: 使用“Custom Proxy”,设置:<syntaxhighlight lang="XML" inline>代理协议:SOCKS5,地址:http://localhost,端口:10800(修改的端口)</syntaxhighlight> === 客户端端口问题排查总结 === 记:又又又一次遇到端口不能使用(被占用、系统保留端口)【2020/11/18 17:28:59】<br/> 之前使用1080端口,在某次软件更新还是系统更新之后,提示改端口为系统保留端口,查找占用进程无果的情况下,改为使用10800;昨天更新IDM并重启系统之后,提示10800被占用,改为1080提示系统保留端口,所以又又又在网上找了一圈解决方案…… 排查占用(端口1080)的进程: # 使用“<syntaxhighlight lang="bash" inline>netstat -aon|findstr "1080"</syntaxhighlight>”查找被占用端口对应的 PID; #: [[File:1查询占用端口的进程号.jpg|400px]] # 查看PID对应的进程(或服务); #: [[File:2根据PID查看进程.jpg|400px]] #(查看哪一个chrome进程占用了端口,“shift + esc”) #: [[File:3查看chrome中使用端口的任务.jpg|400px]] 关闭了chrome进程数,以为能好使,但是……仍然提示“端口是系统保留端口”,并且找不到占用的进程: <pre> 系统保留端口在netstat是看不到有其他程序占用的,但你就是用不了。。。 </pre> 关于此问题,shadowsocks-windows项目的[https://github.com/shadowsocks/shadowsocks-windows/issues/1835 端口禁止访问 #1835]有描述: <pre> 这个问题并不是端口被占用,通过 netstat 里找不到占用这个端口的程序。 实际上,这个错误对应的 last-error 是 10013 (WSAEACCESS),权限不足。 根据2018年2月13日发布的 KB4074588 里的 known issue,这个补丁会调整操作系统的 reserve port ranges,可以通过运行 netsh interface ipv4 show excludedportrange protocol=tcp 查看。 在我自己的环境里,1025 ~ 1124 都被系统强制保留了,所以其他应用程序无法监听在这个端口。 workaround 要选取的端口也只能避开这些保留端口。 最后建议:ss 可以做一下 10013(WSAEACCES) 和 10048(WSAEADDRINUSE)的分类处理。毕竟看起来之后这个地方会出现坑不会少。 注1:我的系统是最新的1809,一直没有这个问题,直到上周安装了 SONY 的 Digital Paper App 附带的驱动之后触发了这个问题。另一台 surface pro 4 也装了 Digital Paper App,但是没有出现这个问题,不确定是不是因为 sp4 使用的是 Windows 10 Home 的关系。 注2:尝试使用 netsh interface ipv4 delete excludedportrange ... 会提示 access is denied,目前找不到可以认为调整的方法。 </pre> <pre> 分享一下曾经找到的解决办法 由于hyper-v保留了这些端口,所以需要先关闭hyper-v,保留想要保留的端口,再开启hyper-v功能 Disable hyper-v (which will required a couple of restarts) dism.exe /Online /Disable-Feature:Microsoft-Hyper-V When you finish all the required restarts, reserve the port you want so hyper-v doesn't reserve it back netsh int ipv4 add excludedportrange protocol=tcp startport=1080 numberofports=2 netsh int ipv4 add excludedportrange protocol=tcp startport=1099 numberofports=1 netsh int ipv4 add excludedportrange protocol=tcp startport=3306 numberofports=1 3.Re-Enable hyper-V (which will require a couple of restart) dism.exe /Online /Enable-Feature:Microsoft-Hyper-V /All </pre> 所以: # 不要选用系统保留的端口; # 对于非保留端口被占用,排查并结束对于进程即可; * 使用“<syntaxhighlight lang="bash" inline>netsh interface ipv4 show excludedportrange protocol=tcp</syntaxhighlight>”查看tcp的端口排除范围: *: [[File:tcp端口排除范围.jpg|400px]] 【重启之前,手动退出Shadowsocks】 【2021/04/04 19:24:34】我发现:重启之前,手动退出Shadowsocks,则重启之后不会出现端口被保留的问题。【自己和自己冲突?mmp……可能哪个服务进程变量什么jb玩意儿,在重启(或关机再开机)的过程中不能被重置】 === 客户端“time out”问题 === 首先排除: # 服务端所使用的端口是否在防火墙开启; # 客户端是否配置了正确的端口; # 服务器 ip、端口是否被锁; 解决: # 更换服务器端口?(记得:防火墙开启端口并重新加载,更换本地配置) # 重启 ss 服务? === '''检查 IP 是否被锁''' === 输入 IP 检查分别在国内和国外的访问情况: https://www.vps234.com/ipchecker/
返回至“
FAQ:SS客户端
”。
导航菜单
个人工具
登录
命名空间
页面
讨论
大陆简体
已展开
已折叠
查看
阅读
查看源代码
查看历史
更多
已展开
已折叠
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
笔记
服务器
数据库
后端
前端
工具
《To do list》
日常
阅读
电影
摄影
其他
Software
Windows
WIKIOE
所有分类
所有页面
侧边栏
站点日志
工具
链入页面
相关更改
特殊页面
页面信息