On my home gateway/router, I have multiple services running on various ports (SSH, IP camera over HTTP, etc) exposed to the internet via port forwarding. I also use these services internally while on our home network as well. I would like to be able to only set up these connections once, say home.mydomain.com:9876 for our SSH, for both internal and external use, and have them both work. But I would also like for the traffic to remain internal if I am on the internal network, e.g. I know home.mydomain.com would resolve correctly from within the internal network, but I am assuming it would go out to public DNS servers and do this lookup, then connect outbound, then back inbound, to hit the router and be port forwarded correctly.
So I believe there are really two parts in play here, the DNS lookup and the port forwarding. How can I keep all of this internal, when on our private network at home?