首页 > 解决方案 > 如何使用squid更改IP?

问题描述

我有带有 1 个主 IP 和 2 个附加 FO IP 的 VPS 服务器。我下载“squid”包来管理我的 IP 地址。我编辑了 /etc/squid/squid.conf 并添加了行(教程:https ://tastyplacement.com/squid-proxy-multiple-outgoing-ip-addresses ):

acl tasty3128 myportname 3128 src 51.75.50.116/24
http_access allow tasty3128
tcp_outgoing_address 51.75.50.116 tasty3128

acl tasty3129 myportname 3129 src 54.38.50.208/24
http_access allow tasty3129
tcp_outgoing_address 54.38.50.208 tasty3129

http_port 51.75.50.116:3128 name=3128
http_port 54.38.50.208:3129 name=3129

我怎样才能使用这个“鱿鱼”配置?我可以在哪里传递参数来使用taste3128 IP?我正在寻找有关此的信息,每个人都在谈论配置,而不是执行。将来我想通过 Python 脚本(或由 Python 执行的另一个脚本)管理 IP。

标签: pythonnetworkingserversquid

解决方案


您的代码完全正确,但行的顺序不正确;

在你的 squid.conf 中:

  • 首先配置:http_port 51.75.50.116:3128 name=3128
  • 然后配置:acl taste3128 myportname 3128 src 51.75.50.116/24 等等。

推荐阅读