I run Ubuntu on my personal machine, and have an network of servers on my local network at my house. I have a cloud server, and a software development server, as well as some others.
My servers have quite a few services which rely on SSH and I have several servers with OpenSSH services running on a few different ports. The internal services are all connected to a domain through DDNS.
The internet that is available for my area is very quick, but it has a bandwidth cap. Let's take a scenario to explain my question.
Say I have a large 10 GB file that I want to transfer from my cloud server to my personal machine and I want to transfer it through SFTP using the Ubuntu OpenSSH client. Say my personal machine is currently connected to the same local network as the server.
My personal machine has some SSH profiles that I use to connect to this server, but they point at "cloud.mydomain.com:22" rather than "192.168.1.1:22". Is the client "smart" enough to know that the domain is pointing to the same external IP it is making the request on and instead route directly to the internal IP, or will I be making the transfer both ways and transferring 20GB of file over my internet connection, rather than just transferring the 10GB file directly?
Description of Network:
Router #1 is the router which provides the internet. All ports forward to Router #2. Router #2 is a repeater bridge with specific ports forwarding to certain IP addresses. (2222 points to the cloud server SSH, 22 points to the development server SSH, etc.) (Set up like this so I can move my setup to a new router #1 and just forward all the ports to Router #2 with one setting.)
The cloud server updates the DDNS every 5 seconds or so. Domain.com points to Router #1, which in turn forwards all external traffic to Router #2. Depending on port, traffic will be routed to whichever server the port is mapped to.