Ping to same address gives me different IP´s

0

When on windows 10 in cmd.exe a ping is made to cryptopia.co.nz, I get one of the following results:

Pinging cryptopia.co.nz [45.60.13.241] with 32 bytes of data:
Reply from 45.60.13.241: bytes=32 time=7ms TTL=54
Reply from 45.60.13.241: bytes=32 time=12ms TTL=54
Reply from 45.60.13.241: bytes=32 time=12ms TTL=54
Reply from 45.60.13.241: bytes=32 time=10ms TTL=54

Ping statistics for 45.60.13.241:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 7ms, Maximum = 12ms, Average = 10ms

or

Pinging cryptopia.co.nz [45.60.11.241] with 32 bytes of data:
Reply from 45.60.11.241: bytes=32 time=111ms TTL=55
Reply from 45.60.11.241: bytes=32 time=110ms TTL=55
Reply from 45.60.11.241: bytes=32 time=114ms TTL=55
Reply from 45.60.11.241: bytes=32 time=111ms TTL=55

Ping statistics for 45.60.11.241:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 110ms, Maximum = 114ms, Average = 111ms

These two pings were carried out with 1 second inbetween. I thought my computers DNS cache would keep the adress resolved the first time, why isn´t it? Is there a way I can force the system to use the IP with 13 in it for all operations? It´s got a much better ping time.

Corey Hart

Posted 2018-04-11T11:02:08.780

Reputation: 23

Sounds like a case of a load balancer. What do you find unusual? Google does the same thing – Ramhound – 2018-04-11T11:15:59.300

1“Is there a way I can force the system to use the IP with 13 in it for all operations?” - You can’t – Ramhound – 2018-04-11T11:16:34.687

But if this domain is in my DNS cache, why is it not picking the IP it was first resolved to the next time? – Corey Hart – 2018-04-11T13:45:14.357

The two A records you received are probably both cached for exactly the same amount of time, and your local resolver arbitrarily picks one. There are other scenarios but in this case, the server returned two A records at the same time, at least for me. – tripleee – 2018-04-11T14:02:52.873

Answers

1

Take note of the IP address on your first query, then ping the IP address explicitly.

A:\> nslookup cryptiopia.co.nz
Server:     10.9.8.7
Address:    10.9.8.7#53

Non-authoritative answer:
Name:   cryptopia.co.nz
Address: 45.60.11.241
Name:   cryptopia.co.nz
Address: 45.60.13.241

A:\> ping 45.60.11.241
Pinging 45.60.11.241 [45.60.11.241] with 32 bytes of data:
Reply from 45.60.11.241: bytes=32 time=111ms TTL=55
Reply from 45.60.11.241: bytes=32 time=110ms TTL=55
Reply from 45.60.11.241: bytes=32 time=114ms TTL=55
Reply from 45.60.11.241: bytes=32 time=111ms TTL=55

Ping statistics for 45.60.11.241:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 110ms, Maximum = 114ms, Average = 111ms

Of course, without prior knowledge, you don't know which of the IP addresses will be faster, or whether choosing a different one will in fact make any difference at all, or whether asking again would produce yet another set of IP addresses.

tripleee

Posted 2018-04-11T11:02:08.780

Reputation: 2 480

Thank you, so what does that tell me? That they´re both used by cryptopia, but can I choose which one my requests should go to? I´m a noob on this exact field... – Corey Hart – 2018-04-11T13:40:48.333

Like I said, you can pick one IP address and then it's out of your resolver's hands. They gave you two addresses, for reasons of load balancing or redundancy, and your resolver is behaving responsibly by doing the balancing part. – tripleee – 2018-04-11T14:04:22.817

Ah got you now, I think. So you mean I should manually replace the hostname with the IP address of my choice? Unfortunately that doesn´t work. For instance, in the browser, https://45.60.13.241/api/GetMarketHistory/ETH_BTC, gives me a proxy error from the host. This would work with the hostname replacing the IP.

– Corey Hart – 2018-04-11T14:55:29.910

Indeed, HTTP 1.1 requires the host name to be transmitted in many cases. This is quite different from your question about ping. A browser plug-in may give you more control over this, but again, that should really be a new question if you need more help. – tripleee – 2018-04-11T15:00:50.810

In fact it´s a httpjob library within b4j (programming language) where the request needs to be sent from. I was thinking that the scenario is the same whether if using ping or through a http request, that I would need to set the IP address somewhere in the local DNS cache. Sorry if I´m wrong about that. – Corey Hart – 2018-04-11T15:12:00.313

printf "GET %s\r\nHost: %s\r\n\r\n", url, host produces a valid HTTP request which can the be sent to the IP addresss of your choice. – tripleee – 2018-04-11T15:20:13.973