生成似乎来自多个IP的请求 [英] Generating requests which appear to be coming from multiple IP's

查看:181
本文介绍了生成似乎来自多个IP的请求的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试创建一个模拟脚本,我们需要将TCP数据包数据发送到服务器,因为它似乎每次都来自不同的IP。
基本上我们需要模拟多个设备(具有不同的IP),这些设备不断向服务器发送数据。
服务器仅为来自新IP的请求创建新连接。
实现它的最佳方法是什么?有没有办法使用代理服务器或某种虚拟化来实现这一目标?

We are trying to create a simulation script where we need to send TCP packet data to the server in way that it appears to be coming from different IP every time. Basically we need to emulate multiple devices ( with different IP) which are constantly sending data to the server. The server creates a new connection only for request coming in from a new IP. What is the best possible way to achieve it ? Is there a way of using proxy servers or some sort of virtualization to accomplish this ?

推荐答案

你想要使用的是IP别名。这允许您创建虚拟网络接口。每个虚拟接口都可以分配一个或多个IP地址。

What you want to use is IP aliasing. This allows you to create virtual network interfaces. Each virtual interface can have one or more IP addresses assigned to it.

link 显示了如何在Linux中执行此操作。

link 显示了如何在Windows中执行此操作。

This link shows how to do it in Linux.
This link shows how to do it in Windows.

接下来,您的客户需要指定要使用的地址。使用 getifaddrs()枚举可用的地址。然后在执行 connect()之前,在套接字上使用 bind()系统调用。这样,您可以拥有多个客户端,每个客户端将使用不同的源IP地址。这个发布有详细信息。

Next your clients need to specify which of your addresses to use. Use getifaddrs() to enumerate the available addresses. Then use the bind() system call on the socket before you do a connect(). This way you can have multiple clients and each one will use a different source IP address. This post has the details.

这篇关于生成似乎来自多个IP的请求的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆