Bubble's blog
Home
About
使用 Dante 搭建socks5服务
Category:
技术
Date:
2024-11-13T11:58:35Z
### 1. 安装 Dante 在基于 Debian/Ubuntu 的系统上,执行以下命令来安装 Dante: ```bash sudo apt-get update sudo apt-get install dante-server ``` ### 2. 配置 Dante Dante 的配置文件通常位于 `/etc/danted.conf`。你需要编辑该文件来设置代理服务: ```bash sudo nano /etc/danted.conf ``` 使用以下配置示例(请根据实际情况修改): ```conf logoutput: syslog # 内部网络接口和端口配置(监听接口和端口) internal: 0.0.0.0 port = 1080 # 外部网络接口(用于向外连接) external: eth0 # 验证方法 method: none clientmethod: none # 使用非特权用户运行 user.notprivileged: nobody # 客户端访问规则 client pass { from: 0.0.0.0/0 to: 0.0.0.0/0 log: connect disconnect error } # 代理访问规则 socks pass { from: 0.0.0.0/0 to: 0.0.0.0/0 log: connect disconnect error } ``` **解释:** - `internal: 0.0.0.0 port = 1080`:监听所有网络接口,端口为 1080。 - `external: eth0`:指定用于对外连接的网络接口(可根据具体网络接口调整,如 `eth0`、`ens33` 等)。 - `method: none`:不使用身份验证(如需安全访问,请设置适当的验证方式)。 ### 3. 启动和启用 Dante 服务 启动服务: ```bash sudo systemctl start danted ``` 设置开机自动启动: ```bash sudo systemctl enable danted ``` ### 4. 检查 Dante 服务状态 确认服务是否正常运行: ```bash sudo systemctl status danted ``` 查看服务的日志: ```bash sudo tail -f /var/log/syslog ``` ### 5. 配置防火墙 确保防火墙允许 SOCKS5 端口(如 1080)通过: ```bash sudo ufw allow 1080/tcp ``` ### 安全建议 1. **访问控制**:建议在 `danted.conf` 中设置访问控制,以限制哪些 IP 地址可以连接到代理。 2. **身份验证**:如果代理是公开的,应启用用户名/密码身份验证来保护访问。 ### 可选的身份验证配置 如需启用用户名/密码身份验证,更新配置文件: ```conf method: username none ``` 然后添加系统用户来使用代理: ```bash sudo adduser proxyuser ``` ### 连接socks5 - 本机连接 ```bash curl --socks5 127.0.0.1:1080 http://example.com ``` - 在客户机使用公网IP连接 ```bash curl --socks5 公网IP:1080 http://example.com ``` 带身份验证的连接 ```bash curl --socks5-user username --socks5-pass password 公网IP:1080 http://example.com ``` - 测试服务器端口 ```bash telnet 公网IP 1080 ```
Share
Permalink
×
0 Comments
latest
No comments.
Name
Email
Site
Comment
Human check: 8 + 2 = ?
Links
CSDN
GitHub
WHOIS
吾爱破解
看雪论坛
Categories
Default
0
技术
24
时事
0
Change Theme
Perfect Blue
Black Swan
0 Comments latest
No comments.