0

I am told that there are two major (only?) ISP in China - China Telecom (CT) and China Unicom (CU) - and that traffic routed between the two is really slow, almost as bad as traffic that has to cross the Great Firewall. To work around this problem, you (as a web site operator in China) are supposed to get two external IP addresses for your web site, one for each provider.

Feel free to comment on if that is really necessary, but if it is, how would one implement the proper routing for this? Put both IP addresses into DNS for the same host name and let the client somehow figure out which one is better? Separate host names?

1
  • That sounds like a scam to me, perpetrated by each of them to increase hosting plan sales. Try testing the latency yourself (watching several TCP handshakes with tcpdump would be adequate I think) and determine if the latency is actually a problem. If it is a problem, determine how much the problem is worth to you to solve. How much do your sales increase if you drop page load times by 1 second?
    – Ladadadada
    Feb 22, 2013 at 10:54

3 Answers 3

4

I am living in China and can confirm what you are saying.

Most big chinese internet portals like qq.com or baidu.com really have connections to both big ISPs and then route your traffic through one or the other depending on your internet connection.

I don't know how they do it, but i can see that depending on where I am the DNS record qq.com (one of china's biggest portals) resolves into different IP addresses:

My home connection:

mst@mst-gentoo-nb ~ $ nslookup qq.com
Server:         192.168.1.1
Address:        192.168.1.1#53

Non-authoritative answer:
Name:   qq.com
Address: 119.147.15.13
Name:   qq.com
Address: 119.147.15.17

My office connection:

mauro@sylvester:~ ssh$ nslookup qq.com
Server:         10.60.1.249
Address:        10.60.1.249#53

Non-authoritative answer:
Name:   qq.com
Address: 220.181.138.59
Name:   qq.com
Address: 125.39.127.22

And if i check the whois records of these different IPs I can see that they belong to different providers.

So I'm guessing this mechanism is somehow implemented in their DNS. But i also don't know the details about how to do it.

3
  • 2
    The probably have views set up in their DNS servers, you can have a DNS server like bind respond differently depending on the origin of the request, by IP, by subnet, etc..
    – NickW
    Feb 22, 2013 at 11:13
  • that would make sense
    – replay
    Feb 22, 2013 at 11:21
  • Can you also check and compare ping/traceroute response times from your two locations to both IPs? Does it get noticeably slower when you contact the "wrong" IP?
    – Thilo
    Feb 23, 2013 at 11:18
1

Routing multiple IPs is fairly simple, it's a breeze with PBR, you create separate routing tables with iproute2, add rules that traffic coming through or originating from that IP are re-routed out through the same interface. As for the multiple IP addresses via DNS, you'd just need to set up views in BIND, making an ACL for users from ISP1 and one for users from ISP2, then have the BIND server respond with the correct IP for that netblock..

3
  • You may have to run your own DNS server for this, though. It seems that providers don't usually have this feature, see e.g. this thread on Hover: help.hover.com/entries/21455915
    – Thilo
    Feb 27, 2013 at 0:06
  • Very possibly, it does add a layer of complexity for web interfaces.
    – NickW
    Feb 27, 2013 at 10:03
  • It seems that the better Chinese DNS providers have this feature, for example DNSPod.
    – Thilo
    Mar 14, 2013 at 7:14
0

It seems to me that DNS is only part (and maybe the lesser part) of the solution, as it deals with incoming traffic. The responses are usually much larger than the requests, so you should probably have some routing tables installed on your servers to send the outgoing traffic through the right network adapter as well.

Update: Apparently, some hosting providers offer "BGP connections", which get rid of this problem, by routing a single IP address directly through gateways through all providers.

You must log in to answer this question.

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