ubuntu 搭建 socks5 真正能用的教程 danted server

时间:2024-11-07 14:55:56

别再傻乎乎的搜索了!

昨晚想在不同手机上使用socks5连接(用途秘密),谷歌了一下。。。前面10条中文标题的,都提及了使用 danted,却没有一个能正常开启。文章都是翻来覆去的你抄我炒你。。

真正能用的都是爬了外边文章,话不多说上干货,希望能懂的一步到位!

1: 更新系统

  1. sudo apt update
  2. sudo apt install dante-server

2: 查看 danted运行状态

  1. systemctl status

状态结果:

Output

● - SOCKS (v4 and v5) proxy daemon (danted) Loaded: loaded (/lib/systemd/system/; 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:(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: 修改配置文件

  1. sudo nano /etc/

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

logoutput: syslog
: root
: 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对应

  1. sudo ufw allow 1080

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

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

7: 重启服务

  1. sudo systemctl restart

8: 再次检测运行状态

  1. systemctl status

9: 重点!!!测试

A:输入如下命令浏览任何网址,如返回正常网页代码,即成功
  1. curl -v -x socks5://用户名:密码@服务器地址:端口 http://www.任意网址.com/

完毕