Hi,
I am working in a French multinational company, in charge of Greater China region, sit in Shanghai, China.
We are using Google Apps (G-Mail, Contacts, Calendar, Drive, Sites, etc.) for office application.
As we all know the GFW (Greater Firewall) in place, which blocks access to many Internet resources (Google, Facebook, Twitter, SalesForce, GitHub…). So we implemented tunnels to Hong Kong/Taiwan to cross it.
The network layer topology is simple:
On DNS part, since China DNS providers are doing DNS poisoning, we choose a France DNS provider as resolver.
The solution works ok, except France DNS always reply record according to the breakout IP. This causes slowness when we access China website, e.g. open www.taobao.com, but in fact access a Taobao’s CDN node in Iceland.
My idea is to change to Google DNS (or maybe OpenDNS) and utilize EDNS-Client-Subnet.
After my research, I don’t think Windows Server support EDNS-Client-Subnet yet. Another stable Name Server should be adopted to replace it for local DNS service.
So I am asking is there any recommended solution to achieve such goal? Any special considerations?
Thanks in advance,
On DNS part, since China DNS providers are doing DNS poisoning, we choose a France DNS provider as resolver.
The solution works ok, except France DNS always reply record according to the breakout IP. This causes slowness when we access China website, e.g. open www.taobao.com, but in fact access a Taobao’s CDN node in Iceland.
My idea is to change to Google DNS (or maybe OpenDNS) and utilize EDNS-Client-Subnet.
After my research, I don’t think Windows Server support EDNS-Client-Subnet yet. Another stable Name Server should be adopted to replace it for local DNS service.
If you are interested in using the DNS-over-HTTPS API (https://developers.google.com/speed/public-dns/docs/dns-over-https) we do propagate supplied ECS data to the authoritative servers except for the (very non-hypothetical) case where we are contractually obligated not to do so (the experiment won't reveal this, since it is querying our own authoritative server, where we can do so). There are some tools out there (search Google) that will proxy regular DNS to DNS-over-HTTPS, so this might work for you.
You don't want to use Windows DNS Server for this, and they don't support ECS. Unbound (edns-subnet branch) and PowerDNS (https://github.com/PowerDNS/pdns/issues/573) seem to be the only standard recursive servers that support it.
DNS to DNS-over-HTTPS proxy is a good option, I searched around but can't identify an outstanding candidate. Do you have recommendation for me to study deeper into?
I tried PowerDNS Recursor these days (it claims support ECS), and set "forward-zones-recurse=8.8.8.8".But when I dig it with +subnet option, it always return same IP for both China and Kong Kong subnet. Meanwhile 8.8.8.8 respond 2 different IP as desired. It looks like PowerDNS either doesn't respond to ECS, or doesn't chain the ECS info to 8.8.8.8? Not sure it needs further configuration of not.
Either https://github.com/wrouesnel/dns-over-https-proxy (Go) or https://github.com/aarond10/https_dns_proxy (C) look plausible, you should probably try them both and use the one that works best for you (or if they both have problems, the one where you are most comfortable debugging the code)
Without checking, I would expect that PowerDNS is ignoring the ECS data it receives. If you run the PowerDNS Recursor on a different network from your client, you can use o-o.myaddr.l.google.com and see whether the original client IP is passed to Google as ECS from PowerDNS. (Note that if your original client IP is an RFC1918 private address—10.*.*.*, 172.{16-31}.*.*, 192.168.*.*—passing that to Google is useless and may well be ignored, so you need to use a public routable IP address for your clients (which may make things a bit tricky to get it passed through the tunnel). There might be a PowerDNS configuration option to map client subnet IPs, I don't know. Using (public) IPv6 (addresses) for the clients to contact PowerDNS Recursor may give better results (it is possible that PowerDNS doesn't handle IPv6 addresses in ECS data properly, but Google can handle it, as can most ECS-enabled authoritative servers).
I did more test on pdns-recursor and finally make it forward query to 8.8.8.8 with ECS option appended. (Through a very tricky setting after several days of source code reading and recompiling! I am checking with PowerDNS team is it a bug or intentional design).However, the pdns-recursor by now only take source IP as ECS data, and ignored the original ECS data set in dig command. I am also discussing with PowerDNS team to see whether it is possible to add support of the ECS data in query, like 8.8.8.8 is now doing.Anyway, since Windows DNS don't support ECS in query, so current pdns-recursor behavior can work. Except must do something on the DNS packet routing.Current:Windows DNS connect to pdns-recursor through local LAN, which source IP is a private IP, which make no sense to 8.8.8.8. So it still respond with a node for Hong Kong.TODO:- Set pdns-recursor on another site than Windows DNS located.- Let Window DNS send query through local public IP (still a Shanghai IP though) to remote public IP of pdns-recusor.- pdns-recursor will take the valid public source IP of Windows DNS, then generate ECS option to 8.8.8.8- After get result (should be optimal node for Shanghai, rather than for Hong Kong) from 8.8.8.8, pdns-recursor will send back to Windows DNS.Will share result of such test.
Confirm it works as what I want.
If you can share any details of your PowerDNS Recursor configuration (even generally) I imagine there may be others who find it useful.
But for a few websites, e.g. www.sohu.com, www.cctv.com, 8.8.8.8 still reply according to Source IP (Hong Kong). Seems 8.8.8.8 can't find a optimal China node for ECS OPT subnet (Shanghai), therefore fall down to use Source IP (Hong Kong)? sohu and cctv are definitely China websites with many CDN nodes.