Change IP address dynamically?

前端 未结 7 664

Consider the case, I want to crawl websites frequently, but my IP address got blocked after some day/limit.

So, how can change my IP address dynamically or any other id

7条回答
  •  梦谈多话
    2021-01-29 19:23

    If you have public IPs. Add them on your interface and if you are using Linux use Iptables for switching those public IPs.

    Iptables sample rules for two IPs

    iptables -t nat -A POSTROUTING -m statistic --mode random --probability 0.5 -j SNAT --to-source 192.168.0.2
    
    iptables -t nat -A POSTROUTING -m statistic --mode random --probability 0.5 -j SNAT --to-source 192.168.0.3
    

    If you have 4 IPs then probablity will become 0.25.

    You can also create your own proxy with simple steps.

    These rules will allow the proxy server to switch its outgoing IPS.

提交回复
热议问题