6hz7vif 发表于 2024-7-1 12:50:51

利用adsl拨号服务器VPS构建代理IP池


    <div style="color: black; text-align: left; margin-bottom: 10px;"><img src="https://pic2.zhimg.com/80/v2-dd957e3d4a9a9318769ff139e2eb35e1_720w.webp" style="width: 50%; margin-bottom: 20px;"></div>
    <h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">1、</span><span style="color: black;">工具</span>准备</h2>动态vps: 我用的是云立方的动态vps,0.5G内存,11G硬盘,20G宽带,一年1800元,动态vps<span style="color: black;">重点</span>是运行代理服务,比较耗宽带,<span style="color: black;">经过</span>拨号来更换IP,实现动态代理的效果固定IP服务器:用的阿里云服务器,1核1G内存,40G云盘,一年836元,该服务器<span style="color: black;">重点</span>是实时获取动态vps的IP,并对外<span style="color: black;">供给</span>接口,这些服务不怎么耗资源,该服务器还<span style="color: black;">能够</span>用来跑爬虫<span style="color: black;">或</span>搭网站<h2 style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">2、</span>环境搭建</h2>
    <h3 style="color: black; text-align: left; margin-bottom: 10px;">动态vps</h3>功能:搭建代理服务,并<span style="color: black;">经过</span>在vps上拨号切换IP,将切换后的IP传到固定IP的服务器上<span style="color: black;">工具</span>:代理服务-tinyproxy, 发送IP-python的requests库系统:云立方的<span style="color: black;">能够</span>预装系统,我选的是CentOS7.1系统,在管理后台进行操作连接服务器:ssh user@ip -p port拨号操作:断开网络:adsl-stop, 拨号:adsl-start查看公网IP:curl<a style="color: black;"><span style="color: black;">http://</span><span style="color: black;">icanhazip.com</span></a>加代理查看IP:curl -x ‘ip:port’ -v <a style="color: black;"><span style="color: black;">http://</span><span style="color: black;">icanh</span></a>azip.com判断IP<span style="color: black;">是不是</span>变化:先查看公网IP,<span style="color: black;">而后</span>断开连接,重新拨号,再看下公网IP,<span style="color: black;">倘若</span><span style="color: black;">发掘</span><span style="color: black;">无</span>变化,<span style="color: black;">能够</span>多试几次,有几率重播后公网IP依旧没变<h3 style="color: black; text-align: left; margin-bottom: 10px;">1、代理服务搭建:tinyproxy</h3>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">安装命令:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;"># 添加EPEL仓库,<span style="color: black;">而后</span>更新yum源:</span>
      <span style="color: black;">sudo</span> <span style="color: black;">yum</span> <span style="color: black;">install</span> <span style="color: black;">epel</span><span style="color: black;">-</span><span style="color: black;">release</span>
      <span style="color: black;">sudo</span> <span style="color: black;">yum</span> <span style="color: black;">update</span>
      <span style="color: black;"># 安装</span>
      <span style="color: black;">sudo</span> <span style="color: black;">yum</span> <span style="color: black;">install</span> <span style="color: black;">-</span><span style="color: black;">y</span> <span style="color: black;">tinyproxy</span>
    </div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">修改配置:</p>
    <div style="color: black; text-align: left; margin-bottom: 10px;"><span style="color: black;">vim</span> <span style="color: black;">/</span><span style="color: black;">etc</span><span style="color: black;">/</span><span style="color: black;">tinyproxy</span><span style="color: black;">/</span><span style="color: black;">tinyproxy</span><span style="color: black;">.</span><span style="color: black;">conf</span>
      <span style="color: black;">修改</span> <span style="color: black;">Port</span> <span style="color: black;">端口,默认为</span> <span style="color: black;">8888</span>
      <span style="color: black;">Port</span> <span style="color: black;">8888</span>
      <span style="color: black;">注释掉</span> <span style="color: black;">Allow</span> <span style="color: black;">127.0</span><span style="color: black;">.</span><span style="color: black;">0.1</span><span style="color: black;">,<span style="color: black;">暗示</span><span style="color: black;">准许</span>所有人<span style="color: black;">拜访</span>代理</span>
    </div>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">起步</span>服务:service tinyproxy start</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> 日志:/var/log/tinyproxy/tinyproxy.log</p> 本地测试:curl -x ‘ip:port’ -v <a style="color: black;"><span style="color: black;">http://</span><span style="color: black;">icanhazip.com</span></a>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"><span style="color: black;">重视</span>点&amp;坑:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">我一<span style="color: black;">起始</span>用的芝麻VPS,到这一步后,在vps上用局域网IP<span style="color: black;">能够</span><span style="color: black;">经过</span>代理服务器<span style="color: black;">拜访</span>,但在本地<span style="color: black;">经过</span>公网IP就<span style="color: black;">没</span>法<span style="color: black;">拜访</span>,最后发现是<span style="color: black;">因为</span>外网<span style="color: black;">没</span>法<span style="color: black;">拜访</span>该服务器,试过开放端口等操作,<span style="color: black;">没</span>果,云立方的是直接<span style="color: black;">能够</span><span style="color: black;">经过</span>公网IP<span style="color: black;">运用</span>代理</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;"> yum安装时,报错:yum doesn’t have enough cached data to continue, <span style="color: black;">处理</span>办法:</p>
    <p style="font-size: 16px; color: black; line-height: 40px; text-align: left; margin-bottom: 15px;">将/etc/yum.repos.d/epel.repo中的mirrorlist改为baseurl/etc/resolv.conf文件中<span style="color: black;">增多</span> nameserver 144.144.144.144在断开重播时,有时adsl-start会执行失败,报错:“/usr/sbin/adsl-start: line 217: 5749 Terminated C O N N E C T " CONNECT " CONNECT"@" &gt; /dev/null 2&gt;&amp;1”,最后<span style="color: black;">发掘</span>可能是断开连接的不干净,多执行几次adsl-stop,在执行adsl-start就会成功了</p>在代理服务tinyproxy运行<span style="color: black;">时期</span>,报过这个错:Waiting servers (0) is less than MinSpareServe


maqg 发表于 2024-8-29 21:31:43

顶楼主,说得太好了!

9q13nh 发表于 2024-9-24 23:48:10

外链发布社区 http://www.fok120.com/

nqkk58 发表于 2024-10-16 15:46:14

软文发布平台 http://www.fok120.com/

4zhvml8 发表于 2024-10-17 18:42:05

我深受你的启发,你的话语是我前进的动力。

qzmjef 发表于 2024-10-31 09:13:26

外贸B2B平台有哪些?
页: [1]
查看完整版本: 利用adsl拨号服务器VPS构建代理IP池