From the Terminal
How Connecting to Cloudflare's Warp VPN Can Change Your Data Center Depending On Whether You Are Using IPv4 or IPv6
I recently moved to Maui, HI and have a Spectrum 960/20 land line hooked up. Cloudflare peers with DrFortress in Honolulu which allows me to ping 126.96.36.199 and get some incredible response times. At least for Hawaii:
64 bytes from 188.8.131.52: icmp_seq=1 ttl=58 time=13.7 ms
Well then I wanted to figure out how to play games on Japanese servers. For American servers I get about 40-60 ms for west coast and 110-130 for east coast. In particular my DigitalOcean VPS in NYC responds in 125 ms.
For my testing I'm using the server IPs for the game FFXIV. In this case one of the servers in the "Mana" Data Center in Japan.
Here's what I get pinging the data center with no VPN.
64 bytes from 184.108.40.206: icmp_seq=1 ttl=47 time=177 ms
Not ideal. Of course it's because it goes through LA on it's way to Japan. Doing a traceroute confirms that. But I knew going into this that there was a direct line to Japan from Honolulu and it is, in fact, possible to send a network packet directly to Japan from Hawaii. Unfortunately the routing depended on your ISP's routing to make it go directly. So then I started playing with VPNs.
I discovered that Cloudflare actually has a free VPN called Warp and while it doesn't provide the best throughput there's no real issue with using it for low bandwidth game connections and simple web browsing.
Trying it Out
I have a Linux desktop running Gentoo and a Macbook Pro. To test this I went ahead and setup Cloudflare Warp on my Macbook and pinged the same IP. Setting it up on MacOS is as simple as installing the official app.
So let's see what we get on the Macbook.
64 bytes from 220.127.116.11: icmp_seq=1 ttl=54 time=135.54 ms
A whole 40 ms shaved off the ping. Time to install it on my desktop!
On Linux there's an unofficial CLI utility called wgcf which will build you a Wireguard configuration you can use to connect to the service. I had to recompile my kernel to allow wireguard but no big deal. I ping the same IP on my desktop now. Again same internet but this time a wired ethernet connection instead of wifi.
64 bytes from 18.104.22.168: icmp_seq=1 ttl=51 time=160 ms
Huh?!? How could this be? I was promised speed!!!!
Well it turns out after visiting https://www.cloudflare.com/cdn-cgi/trace I found out what the issue was.
On my desktop I'm getting assigned to the LA data center. But on my laptop I'm getting assigned to Honolulu. All my research on this topic suggests that the "closest" is chosen via UDP broadcast probing but I wasn't entirely convinced so I went digging.
It turns out if you look at the file wgcf-profile.conf it will have this setting:
Endpoint = engage.cloudflareclient.com:2408
With IPv6 the IP I get when resolving the above hostname is an IPv6 address which is sending me to the LAX data center. When I resolved the hostname manually with nslookup I got 22.214.171.124 for IPv4 and I was able to disregard the IPv6 address. I changed the endpoint setting to use this IPv4 address instead and now my Wireguard connection goes to the HNL data center.