I have configured the eth0 in my amazon instance with 2 private ips (primary and additional) and 2 elastic ip each one, so i can access through ssh to my server using the both public ips, but when i try to access to another server using wget o curl the instance always use the elastic ip associated to the primary private ip.

How can i access to internet using the current public ip from i'm connected?


For wget you can use the --bind-address=ADDRESS option, where ADDRESS is the local address you want to use. Curl provides the --interface option where you can provide an interface or address.

The exact option to use depends on the application you are using. Not all applications provide such an option. They can only use the default.

  • At the OS API layer, sockets can have the local address bound before use, or not. Other programs and libraries end up using (maybe not directly) this OS API layer. It's all a matter of whether the address is specified or not. If not it will be what the kernel finds first working. Whatever you are using to make the connection, you must use its way of setting this. – Skaperen Aug 13 '13 at 2:18

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.