0

Assuming that Google can figure out where a machine (with its given IP address) is roughly located, why doesn't Google use the IP address of a machine versus using the IP address of a local DNS server to determine the machine's location? Any thoughts on this?

0

1 Answer 1

1

Short answer - Load Balancing is done (partly) based on a DNS lookup. The DNS lookup happens before you request the web page, and is done by the local DNS server - so Google needs to use that.

Long version: When your machine makes a DNS lookup it enquires against the local DNS server. Thus when working out the IP address to provide [ unless you are directly querying Googles nameservers ], it only has the address of the DNS server, so it has to use that to approximate your location - because the DNS server does not forward your details on with the request (and indeed, if someone else recently made a similar enquiry against that nameserver it may not even ask Google - prefering to return its cached answer.

2
  • Is there a way you could utilize the IP address of your machine to determine where you are located, and then direct your query to a server closer to you, for example using http re-direction?
    – Smreks
    Dec 7, 2015 at 4:43
  • If you control the web server aplication and can get an accurate ip-to-location database - which is where the problem would be as these databases are an approximation only - you could do this. You could also run your own DNS server on your network to resolve queries directly - but you may offset the advantages because forwarding non-cached requests would break the functionality you need, so you need to recursively resolve them, which is, on average, much slower.
    – davidgo
    Dec 7, 2015 at 16:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .