1: 更新系统

sudo apt update
sudo apt install dante-server

2: 查看 danted运行状态

systemctl status danted.service

状态结果:

● danted.service - SOCKS (v4 and v5) proxy daemon (danted)
    Loaded: loaded (/lib/systemd/system/danted.service; enabled; vendor preset: enabled)
    Active: failed (Result: exit-code) since Wed 2021-12-15 21:48:22 UTC; 1min 45s ago
      Docs: man:danted(8)
            man:danted.conf(5)
  Main PID: 14496 (code=exited, status=1/FAILURE)

Dec 15 21:48:21 proxies systemd[1]: Starting SOCKS (v4 and v5) proxy daemon (danted)... 
Dec 15 21:48:22 proxies systemd[1]: Started SOCKS (v4 and v5) proxy daemon (danted). 
Dec 15 21:48:22 proxies danted[14496]: 
Dec 15 21:48:22 (1639604902.102601) danted[14496]: warning: checkconfig(): no socks authentication methods enabled. This means all socks requests will be blocked after negotiation. Perhaps this is not intended?

如有报错,先自行解决安装问题。

3: 修改配置文件

sudo vi /etc/danted.conf

4: 直接复制如下代码到配置文件!!度娘找到的没一个能用!

logoutput: syslog
user.privileged: root
user.unprivileged: nobody
 
# The listening network interface or address.
internal: 0.0.0.0 port=1080
 
# The proxying network interface or address.
external: eth0
 
# socks-rules determine what is proxied through the external interface.
socksmethod: username
 
# client-rules determine who can connect to the internal interface.
clientmethod: none
 
client pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
}
 
socks pass {
    from: 0.0.0.0/0 to: 0.0.0.0/0
}

5: 系统开放端口,后面1080就是端口,跟上面配置文件中的1080对应

sudo ufw allow 1080

6: 为连接新增用户,禁用登录,把“用户名”修改为英文登录名称

sudo useradd -r -s /bin/false 用户名
sudo passwd 用户名

7: 重启服务

sudo systemctl restart danted.service

8: 再次检测运行状态

systemctl status danted.service

9: 重点!!!测试

输入如下命令浏览任何网址,如返回正常网页代码,即成功

curl -v -x socks5://用户名:密码@服务器地址:端口 http://www.任意网址.com/

完毕!
 

原文链接:https://blog.csdn.net/tiyoleung/article/details/126907329