部署SOCKS5代理服务器

Dante 由 Inferno Nettverk A/S 开发,它由一个 Socks 服务器和一个 Socks 客户端组成,并执行 RFC 1928 和相关标准。Dante 用于提供安全便捷的网络连接。Dante 是一个开源的 Socks 服务器,用于许多流行的网络应用程序,例如 Bloomberg 终端、大多数 Web 浏览器、即时消息程序,以及许多内置 Socks 支持的应用程序。

一、使用Dante工具设置 Socks5 代理

服务器安装dante

apt install dante-server

#修改配置文件
vi /etc/danted.conf

#将配置文件全部内容替换为如下:(注意:10.0.0.4替换为ifconfig显示IP)
logoutput: stderr
user.privileged: root
user.unprivileged: nobody
internal: 0.0.0.0 port=1080
external: 10.0.0.4
socksmethod: username
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
}

启动dante-server服务

#启动dante-server
service danted start

#查看dante-server运行
service danted status

● danted.service - SOCKS (v4 and v5) proxy daemon (danted)
     Loaded: loaded (/lib/systemd/system/danted.service; disabled; preset: disabled)
     Active: active (running) since Thu 2023-04-06 10:30:02 CST; 4s ago
       Docs: man:danted(8)
             man:danted.conf(5)
    Process: 235536 ExecStartPre=/bin/sh -c     uid=`sed -n -e "s/[[:space:]]//g" -e "s/#.*//" -e "/^user\.privileged/{s/[^:]*://p;q;}" /etc/dant
   Main PID: 235540 (danted)
      Tasks: 20 (limit: 2339)
     Memory: 8.8M
        CPU: 169ms
     CGroup: /system.slice/danted.service
             ├─235540 /usr/sbin/danted
             ├─235541 "danted: monitor"

二、使用proxifier在客户端测试

添加socks5代理

测试sock5连接

也可使用curl命令行测试

curl -v -x socks5://root:[email protected]:1080 http://www.baidu.com/

*   Trying 192.168.136.131:1080...
* SOCKS5 connect to IPv4 220.181.38.150:80 (locally resolved)
* SOCKS5 request granted.
* Connected to 192.168.136.131 (192.168.136.131) port 1080 (#0)
> GET / HTTP/1.1
> Host: www.baidu.com
> User-Agent: curl/7.84.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK

< Accept-Ranges: bytes
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Connection: keep-alive
< Content-Length: 2381

三、也可使用proxychains在服务器端使用

添加socks5代理

vi /etc/proxychains4.conf

[ProxyList]
# add proxy here ...
# meanwile
# defaults set to "tor"
#socks4	127.0.0.1 61281
socks5 xx.xx.xx.xx 1080 root xxxxxxx

测试socks5连接

proxychainx xxx