I want it to be so that, when I attempt to visit my server at 94.xx.xx.xx, it will automatically redirect me to the internal address 192.xx.xx.xx, when doing so from the local network. Can this be done with OS X DNS and if so how?
MacOS – OS X Server DNS, on local network redirect external IP to internal IP
dnsmacosNetworkserver.app
Related Question
- IPad – iOS network connectivity on a local, isolated network with no DNS server
- Can’t Ping Local Devices by Network Name After DNS Change
- MacOS – Make mDNSResponder use local DNS server
- macOS DNS – How to Fallback to Default DNS if Custom Server is Unreachable
- Network – Mac Ignoring Local DNS Results for Local Hosts
- How to have a hostname always be resolved using the local network’s DNS server when I’m connected to a VPN
- How to add locally hosted DNS server while preserving default LAN DNS
Best Answer
No, it cannot be done by OS X DNS or any DNS, because you aren't interacting with DNS in your situation (according to your comment). Domain Name Service translates domain names into IP addresses and you aren't using any domain names to access the server.
If however, you set up DNS and used one name on external DNS and the same name on internal DNS - the same name could resolve to different addresses.
It doesn't matter if the numbers are at all similar, but you might find it easier to map things or check that the servers are correct. Setting up an internal DNS is worth the effort if you have several dozen hosts - otherwise it's easier to overload the local hosts file on the machines that need to resolve the name "internally" as opposed to externally.
(If you were using fully qualified domain names, there are ways to do this…I don't how "accepted" they are and I'm not enough of an expert to tell you all the possible side effects, but it can work.)
The issue you're having is a routing issue, from what I understand. Your public IP address is on a router that is not your server. Your server uses port forwarding on the router to receive traffic. You'd like to be able to connect to the public IP but from inside the local network. You need to enable/configure Hairpin NAT on your router, if it's supported. I can't think of any other solutions.