I have a VM as a server with IP address 10.91.55.2. I have another VM which acts as a client having IP address in the range 10.91.56.2......10.91.56.10. I want to write a script that will use all these IP address on the client to send HTTP request to the server (10.91.55.2). I have written a script that sends HTTP requests using the Physical IP address alone. Is there any way to send HTTP Requests from a range of IP address. My OS Is linux.
相关问题
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
- Correctly parse PDF paragraphs with Python
This is not a complete answer, but should provide you with a starting point.
You say "I have another VM which acts as a client", so I'll assume that you have a single client VM with multiple IP addresses. In this case I believe you can tell the Python socket module to bind to a specific network interface when sending. See this answer for details https://stackoverflow.com/a/335662/66349
This answer explicitly demonstrates its use: https://stackoverflow.com/a/8437870/66349
Here is an example of calling
socket.setsockopt
in conjunction with urllib2: https://stackoverflow.com/a/17882197/66349You might be able to piece those together into a functioning program.