My server has 5 different external IPs (all working)
I added them by using:
ip addr add xx.xx.xx.xx/32 dev eth0
ip addr add yy.yy.yy.yy/32 dev eth0
ip addr add zz.zz.zz.zz/32 dev eth0
How can I should curl to use either zz.zz.zz.zz IP address ?
...will force cURL to use "127.0. 0.1" as the IP address when requesting "www.example.com" over port 80 (HTTP). ...which will force cURL to use "127.0. 0.1" as the IP address for requests to "www.example.com" over ports 80 (HTTP and 443 (HTTPS).
To use an IP address instead of a domain name, simply enter the IP address in the URL in place of the domain name. For example, the URL http://192.168.1.1/index.html would take you to the same page as http://www.pcwebopedia.com/index.html.
If no connection can be reused, libcurl resolves the host name to the set of addresses it resolves to. Typically this means asking for both IPv4 and IPv6 addresses and there may be a whole set of those returned to libcurl. That set of addresses is then tried until one works, or it returns failure.
You should be able to use
curl --interface zz.zz.zz.zz http://example.com/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With