Using cloudflare DNS stops my switch from routing the data locally

I have a sub domain I’m using for my media server and if I use cloudflare for my DNS server then my switch sees the cloudflare ip and routes it through my internet (which is very slow). If I use another DNS to make this sub domain then my switch sees that it goes to a local ip and uses my full bandwidth (which is very important for a media server). Is there a way to fix this without just using a different dns provider?

I am afraid that is rather a question for StackExchange than here.

Surely it’s good for here since it’s a problem caused by the way cloudflare works, not my setup?

That cant be a Cloudflare issue as Cloudflare cant resolve your internal hosts. Your internal hosts also wont work with any other public resolver.

Again, I am afraid that is something you should take to StackExchange.

It goes to my external ip but if I’m not using cloudflare as my DNS my ping is <1ms because the switch picks up on the fact it doesn’t need to leave LAN but if I do use cloudflare then it leaves LAN and ping resolves to a cloudflare ip, not my external ip. I’m imagining this is an inherent limit of cloudflare?

That is something you need to configure on your own router or wherever you run that resolution. No public resolver will return an internal address.

I repeat, it’s not an internal address, my dns is setup so a subdomain goes to this public ip.

What is the host in question?

My domain host is google domains and when using their dns my switch recognises that the domain resolves to my local server but if I use cloudflare that doesn’t happen.

I asked for the hostname.

Anyhow, if your previous DNS provider offered some way to recognise your IP address and then returned a different address, that it something non-standard and not supported by most public resolvers, including Cloudflare. If, on the other hand, you are doing that on a network level on your own network then you need to clarify this at StackExchange, as already mentioned.