I have configured my Windows AWS instance to use two IP addresses and would like to be able to choose which of these two IPs are used for a HTTP GET request using curl (pycurl).

I want it to appear to the server-side that there are two separate clients - almost like one machine using itself as a proxy.

I have configured my instance to use as the static IP and as an additional (proxy) IP address.

> curl --interface example.com

is successful, however, trying with the other IP address yields a Timeout.

> curl --interface example.com
curl: (7) Failed to connect to example.com port 80: Timed out

Setting the verbose flag

> curl --interface --verbose example.com
*   Trying
* Name '' family 2 resolved to '' family 2
* Local port: 0
* connect to port 80 failed: Timed out
* Failed to connect to example.com port 80: Timed out
* Closing connection 0
curl: (7) Failed to connect to example.com port 80: Timed out

Can anyone please shed any light on why this connection might be failing when using the second IP (and how one might fix this in Windows)?

Thank you in advance!

  • How are the routes on the client and server? – Gerald Schneider Sep 4 '19 at 14:38
  • @GeraldSchneider sorry I'm not too sure what you mean? I'm pretty new to this sort of thing – Huw Thomas Sep 4 '19 at 14:40

It sounds like it might be a routing issue, can you ping or traceroute to the address? Check route print or Get-NetRoute in PowerShell to get an idea of whether the correct gateway is in place - the third column in each will tell you where a request is going for a given address (you probably want to look for the NextHop corresponding to DestinationPrefix

You need to look for issues in how the device routes your request to different IPs for the different interfaces to solve the issue.

  • I can ping and traceroute gives 1 hop back to my own machine. – Huw Thomas Sep 4 '19 at 15:51
  • And what does the routing table look like? See the other commands suggested in the anwer – LTPCGO Sep 4 '19 at 15:54
  • Sorry, I hit enter before I had finished adding everything! In route print for the destination, I see as the Netmask and my correct gateway with as the interface. Get-NetRoute gives again my gateway for the destination I'm surprised that in the Interface column for tracert I only see entries for and not any for – Huw Thomas Sep 4 '19 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.