How do I send an HTTP request using a virtual IP address in Linux?
I am using CentOS-Linux and I want to send HTTP requests from virtual IPs like eth0: 0, eth0: 1, eth0: 2, etc. along with eth0. How to do it? I am actually trying to make one traffic generator tool using Python. I was able to send multiple and concurrent HTTP requests, and now my next step is to send such requests from multiple IPs. I don't know how to achieve this task. Can anyone help me?
+3
source to share
1 answer
2 options:
- use curl:
curl --i <'interface ip with which you want to generate traffic'> destination
for example, for me, eth0 ip is 10.91.56.3 and eth0: 1 ip is 10.91.56.4, so 10.91.56.4 (eth0: 1) is used to generate traffic
curl --i 10.91.56.4 http://10.91.55.3/filex.txt
- after @AKX answer here
In the above answer in 3rd grade write your interface ip instead of 127.0.0.1 for example in my case I did the following:
class BindableHTTPHandler(urllib2.HTTPHandler):
def http_open(self, req):
return self.do_open(BindableHTTPConnectionFactory('10.91.56.4'), req)
0
source to share