0

We have a service which can't be discoverable over IPv6 and so we have to reach it over IPv4 always. I'd like to do a Http request over IPv6 to the service on a port 1234 and i want to know what will be the error code cURL throws?

user1159517
  • 5,390
  • 8
  • 30
  • 47
  • it will more than likely just time out? any reason you cannot just try it and see what happens? also are you access it via nam or via IP? Does the name have AAAA records? is the host that you are accessing it from have IPv6 enabled? If it isn enabled does it not have IPv6 connectivity? The situation sounds like there might be other issues. – Doon Oct 31 '14 at 01:58
  • We have a cloud service setup for users and we do health monitor for users services. We are upgrading to IPv6 and there might be services which can't do http over IPv6. So i couldn't determine which service is that before updating our cloud service. I'm accessing it via cURL's curl_easy_setopt() method. All the machines have IPv6 connectivity. – user1159517 Oct 31 '14 at 02:05

1 Answers1

1

well you are probably going to be running dual stack. So the only way that curl is going to attempt an IPv6 connection is if it is handed an IPv6 address to check. So if you do an DNS lookup and you get an AAAA response, then it will try via IPv6. If it is given an A, it will issue via IPv4.

If you want to force one or the other you can use CURLOPT_IPRESOLVE and the values CURL_IPRESOLVE_V4, CURL_IPRESOLVE_V6, or CURL_IPRESOLVE_WHATEVER to pick one.

As I see it your current issue will only happen if your host lookup returns AAAA records, and then you cannot connect to it over v6. Which to me would mean the service you are monitoring is down/broken.

If you are worried that your transition to V6 is going to cause issues you can always due 2 per service, one with CURL_IPRESOLVE_V4 set, and one with CURL_IPRESOLVE_V6 set. This way you can monitor the service on both Protocols.

Also you might need/want to set options in your monitoring service to indicate if they want you to try IPv6 || IPv4 || both.

Doon
  • 19,719
  • 3
  • 40
  • 44
  • In addition, modern curl versions also use the happy eyeballs approach under the hood, which means it tries to connect to both IPv4 and IPv6 if available and uses the one that connects fastest. – Daniel Stenberg Nov 01 '14 at 13:19