document/linux/Shadowsocks.md
2024-05-31 17:55:08 +08:00

41 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 机场 Shadowsocks
可以通过v2rayN进行代理连接实现翻墙
## Shadowsocks 安装
```sh
sudo apt update
# 安装包
sudo apt install shadowsocks-libev -y
# 配置 Shadowsocks创建并编辑 Shadowsocks 的配置文件。这个文件通常位于 /etc/shadowsocks-libev/config.json。
sudo nano /etc/shadowsocks-libev/config.json
# 配置项
{
"server":["::1", "127.0.0.1"],
"mode":"tcp_and_udp",
"server_port":8388,
"local_port":1080,
"password":"07RT9gL2zLZ2",
"timeout":86400,
"method":"chacha20-ietf-poly1305"
}
# 启动和设置开机自启
sudo systemctl start shadowsocks-libev
sudo systemctl enable shadowsocks-libev
# 配置防火墙
sudo ufw allow 8388/tcp
sudo ufw allow 8388/udp
sudo ufw reload
# 检测服务状态
sudo systemctl status shadowsocks-libev
```
### 配置项解释
"server": ["::1", "127.0.0.1"]:定义服务器地址。::1 是 IPv6 的本地回环地址127.0.0.1 是 IPv4 的本地回环地址。这意味着当前配置只会监听本地回环接口。
"mode": "tcp_and_udp":定义 Shadowsocks 工作模式,这里配置为同时支持 TCP 和 UDP 协议。
"server_port": 8388定义服务器监听的端口这里设置为 8388。
"local_port": 1080定义本地代理的端口这里设置为 1080。
"password": "07RT9gL2zLZ2":定义连接到代理服务器时需要使用的密码。
"timeout": 86400定义连接超时时间单位为秒这里设置为 86400 秒(即 24 小时)。
"method": "chacha20-ietf-poly1305":定义加密方法,这里使用 chacha20-ietf-poly1305这是一种安全性较高的加密算法。