Cloudflare Tunnel routing through wrong locations

I have a tunnel that I use as an alternative to opening ports on my local network, however, there is a lot of latency when going through the tunnel. I ran a traceroute and saw that it was routing traffic through the USA (Ashburn) even though I am based in Hungary. I am aware that the Anycast network is supposed to route to the two closest locations, however it is not working. Is there a way to select which location traffic goes to? Or any possible fixes?
4 Replies
Chaika
Chaika3mo ago
I ran a traceroute and saw that it was routing traffic through the USA (Ashburn) even though I am based in Hungary.
That's pretty vague, if by any chance your traceroute was showing GeoIP locations for Anycast they're completely unreliable. Here's a better way of determining locations: From your tunnel logs, assuming you are using systemd/a linux system: journalctl -u cloudflared -f --lines=100 look for connections being established for example cloudflared[..]:.. INF Registered tunnel connection connIndex=1 connection=uuid event=0 ip=<publcip> location=pdx02 protocol=quic (you may need to restart the tunnel if it's been running for a while) The location there is the airport code your tunnel is connecting to. Your tunnel is supposed to connect to at least two distinct datacenters. Not all datacenters can support connectors. Additionally, the datacenter your client connects to may be different. The best way to determine that, is to visit the special path of /cdn-cgi/trace on your tunnel's public hostname. For example, https://cloudflare.com/cdn-cgi/trace. the loc field there is the airport code of the Cloudflare DC you connected to.
Is there a way to select which location traffic goes to? Or any possible fixes?
Your ISP has the final authority over which routes you use for anycast IPs.
Pelefant
Pelefant3mo ago
I activated cloudflare proxy on my domain. Pinging it responded from an IP in the USA (my server is in Sweden) and the incoming IPs to the server were cloudflare IPs listed in Russia. Didn’t feel great, I have disabled it for now
Hello, I’m Allie!
The "Geolocation" of the IP has no influence on where your requests are actually being served from. For example, my website, www.goalastair.com, responds with the IP 104.18.26.33, which is geolocated in San Francisco, and yet requests I make to it are served from Copenhagen. Geolocation services are run by companies like Google, Maxmind, etc. They use data about the users of IPs to guess where the IP might be located. This isn't always accurate, especially in the case of anycast IPs
Idle
Idle3mo ago
:facepalm: