3

I am using CentOS-Linux and I want to send HTTP requests from virtual IP addresses like eth0:0,eth0:1,eth0:2,etc simultaneously with eth0. How to do this? I am actually tring to make one traffic generator tool using Python. I have been successful in sending multiple and concurrent HTTP requests and now my next step is to send such requests from multiple IP addresses. I dont know how to achieve this task. Can anyone help me?

Ulrich Eckhardt
  • 16,572
  • 3
  • 28
  • 55
Bhoomika Sheth
  • 323
  • 5
  • 17
  • You need to set `ip tunnel`. [check here](http://unix.stackexchange.com/questions/44065/linux-networking-routing-to-virtual-ip-addresses-from-a-different-subnet) – Arnab Nandy Nov 13 '14 at 07:34
  • 1
    `eth0:0` is *not* a virtual IP address. – Basile Starynkevitch Nov 13 '14 at 08:12
  • 1
    It sounds like you need [cur-loader](http://curl-loader.sourceforge.net/) – Leon Nov 13 '14 at 08:38
  • I used following cURL command to send request from eth0:1 " curl--interface 10.91.56.2 http:/10.91.55.3/file0.txt" and I was successful in generating traffic from virtual eth0:1. Can anyone guide me how to do this using python? 10.91.56.2 is my virtual eth0:1 IP interface and 10.91.55.3 is my server address... – Bhoomika Sheth Nov 24 '14 at 10:50

1 Answers1

0

2 options:

  1. use curl:

curl --i <'interface ip using which you want to generate traffic'> destination

eg for me, eth0's ip is 10.91.56.3 and eth0:1's ip is 10.91.56.4 so, to generate traffic using 10.91.56.4(eth0:1)

curl --i 10.91.56.4 http://10.91.55.3/filex.txt
  1. followed answer by @AKX here

In above answer in 3rd class write your interface's ip instead of 127.0.0.1 eg in my case i did like this:

class BindableHTTPHandler(urllib2.HTTPHandler):
    def http_open(self, req):
        return self.do_open(BindableHTTPConnectionFactory('10.91.56.4'), req)
Community
  • 1
  • 1
Bhoomika Sheth
  • 323
  • 5
  • 17