1

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 ?

Craig S. Anderson
  • 6,966
  • 4
  • 33
  • 46
Ashav
  • 141
  • 1
  • 9

1 Answers1

1

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.

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

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.

Community
  • 1
  • 1
Craig S. Anderson
  • 6,966
  • 4
  • 33
  • 46