One website I often visit have a configuration that if you are from a specific ISP you would go to a specific IP that is from that ISP, so the connection would be the best for users from different ISP. I heard that this could only be done on DNS, but exactly how is something I wan to know.
Bind has views, which allows you to serve different answers to different people based on their IP address. I'm sure other DNS servers have similar features. For example, PowerDNS has a GeoIP backend that might be suitable.
If you are large enough to have your own PI address space, I believe you can use BGP to advertise the same range from two different networks, and clients would use the one nearest to them. I can imagine that clients would get upset if routes changed to the other site and you used server side state. You'd also have consistency issues to deal with.
If you're physically close enough to that ISP, you could ask to peer with them, so users from that ISP would have a dedicated network connection to use.
What do you want to do?
If you want to spread the requests to your website one solution could be Anycast. By this every client will connect to a different server, which may be used for load balancing. Another solution would be DNS round robin.
If you want to offer different mirrors which are located in different countries to offer your clients more speed, I don't think there is a solution concerning DNS. You will have to choose a mirror server on one of your main servers, which are resolved by DNS, based on the client's IP address. You can then redirect your client from that main server to the chosen mirror.
There are domain lookup based techniques used by many multi-national organizations for the purpose of load balance and sometimes region/language specific support.
- Google has country specific TLDs while others use different methods depending on how their service provision works (who is running the service, how much would they like to invest in maintaining and managing the service, etc).
If you see a redirect to a TLD or domain prefix that is is region specific, a domain based divert was made for you. A TLD based divert is likely to be uniquely registered for each country where-as, a prefix based divert (say, country.sitename.com) is more likely diverted internally by the company owned assets.
If the resolved IP address changes with the redirect, you are looking at a domain based 'balance' across the company servers.
To find where you are coming from -- there are various ways, one quick way: www.ip-adress.com