Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Centos7 iptables public network address rotation training

2025-03-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

As a crawler, in order to prevent the server's IP from being blocked.. Multiple server egress IP configurations are configured to rotate the egress IP.. each time you climb the page.

How to do it:

Through iptables's SNAT, we won't talk about this principle. If you don't understand it, just go straight to Baidu.

The machine here uses centos7.

Server-side configuration:

1. Enable IP forwarding

Echo'1' > / proc/sys/net/ipv4/ip_forward

2.-s represents the source address, and-o represents the exit of the public network.

Iptables-t nat-A POSTROUTING-s 10.150.2.0 Universe 24-o em2-j MASQUERADE

3.-- every represents the number of seconds it takes to re-select an IP, and generally fill in as many seconds as there are IP.

Iptables-t nat-I POSTROUTING-m state-- state NEW-p tcp-- dport 80-o em2-m statistic-- mode nth-- every 2-- packet 0-j SNAT-- to-source 1.1.1.1iptables-t nat-I POSTROUTING-m state-- state NEW-p tcp-- dport 80-o em2-m statistic-mode nth-every 2-packet 0-j SNAT-to-source 1.1.1.2

Configuration of the client:

The client only needs to point the default gateway to the server's private network IP.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report