找回密码
 免费注册

[Linux] 使用dante搭建的socks5代理服务器多网卡多用户多IP代理实例

[复制链接]
admin 发表于 2024-3-25 17:17:49 | 显示全部楼层 |阅读模式
192.168.1.218为主网卡的内网IP,192.168.1.134为副网卡弹性IP的内网IP。配置dante多网卡多IP前提条件,需要内部网卡跟外部网络连通,云服务器模式下,创建虚拟网卡与弹性IP绑定后,要在操作系统上添加路由,其中192.168.2.1为网关地址eth1为对应些网段的网卡,table 116为路由表不可重复。

云服务器绑定弹性IP后需要配置策略路由
  1. # 添加辅助IP地址(如果没有在云服务器上绑定)
  2. sudo ip addr add 192.168.1.100/24 dev eth0
  3. # 创建路由策略
  4. sudo ip rule add from 192.168.2.116 table 116
  5. # 添加路由路径 192.168.2.1为弹性IP的网关
  6. sudo ip route add default via 192.168.2.1 dev eth1 table 116
复制代码

dnate多IP进出的配置文件:etc/danted/sockd.conf
  1. internal: 192.168.1.218  port = 1080
  2. external: 192.168.1.218
  3. internal: 192.168.2.116  port = 3389
  4. external: 192.168.2.116
  5. external.rotation: same-same

  6. method: pam none
  7. clientmethod: none
  8. user.privileged: root
  9. user.notprivileged: sockd
  10. logoutput: /var/log/sockd.log

  11. client pass {
  12.         from: 0.0.0.0/0  to: 0.0.0.0/0
  13. }
  14. client block {
  15.         from: 0.0.0.0/0 to: 0.0.0.0/0
  16. }
  17. pass {
  18.         from: 0.0.0.0/0 to: 0.0.0.0/0
  19.         protocol: tcp udp
  20.         method: pam
  21.         log: connect disconnect
  22. }
  23. block {
  24.         from: 0.0.0.0/0 to: 0.0.0.0/0
  25.         log: connect error
  26. }
复制代码

参考文档
  • https://www.ctyun.cn/developer/article/432233321193541
  • https://www.cnblogs.com/dinmin/articles/16893073.html
  • https://www.cnblogs.com/osnosn/p/12388465.html
  • https://cloud.tencent.com/developer/article/1485335
  • https://blog.csdn.net/qq_33611327/article/details/78271289/


socks5-ips.png

回复

使用道具 举报

 楼主| admin 发表于 2024-3-26 00:47:56 | 显示全部楼层
  1. ip rule add from 192.168.2.116 table 116
  2. ip route add default via 192.168.2.1 dev eth1 table 116
  3. ip route show
  4. ip route show|column -t
  5. ip rule
复制代码

值得注意的是,策略路由配置在系统重启后会丢失。为了让配置持久化,你需要在网络配置文件或者启动脚本中添加这些命令。不同的Linux发行版可能有不同的配置文件和方法,你需要根据你的系统文档来操作。
回复

使用道具 举报

 楼主| admin 发表于 2024-3-26 20:05:16 | 显示全部楼层
使用以下命令可以产看路由和路由规则:
ip rule     --->查看路由规则
ip route  ---->查看默认路由表
ip route list table 100   --->查看 路由表为100的路由
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

QQ|Archiver|手机版|小黑屋|信息共享网

GMT+8, 2024-5-16 08:56 , Processed in 0.089755 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表