Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

This has been bothering me for quite some time, I feel this may be possible, but given my decent knowledge of networking, I can't seem to figure how.

It's easiest to understand with an example: if I run 2 servers named serverA and serverB, and I wanted to be able to ssh into each of them, I could do ssh serverA.home.example.com or serverB.home.example.com and have my internal DNS resolve these requests, both from within the LAN (which is already does) BUT also over the WAN.

Realize this is an example, I know this could be accomplished with port forwarding and changing the ssh port on each - I'm just interested in learning and understanding DNS better.

My line of thought is if a DNS request comes into port 53, my DNS server responds with my public IP address (assuming that host is in its table). What I can't figure out is when the request is then made to my public address, NAT would have no idea which host the request is intended for.

share|improve this question

closed as not constructive by John Gardeniers, EEAA, Khaled, Tom O'Connor, MDMarra May 15 '12 at 0:01

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Sorry but if you don't have at least a basic understanding of DNS then your knowledge of networking most definitely is not "decent". –  John Gardeniers May 13 '12 at 6:19
1  
I feel that's an unfair judgement - I do have a basic understanding of DNS, and a decent understanding of networks, I've took 2 years of CCNA prep-courses and did well enough to take the exams for free. The 2 topics that always confused me were VLANs and DNS. This weekend I set up a lab for the sole purpose of getting a better understanding of DNS, not for work, for my own self improvement. –  NFicano May 13 '12 at 9:34
add comment

2 Answers 2

DNS resolves domain names to IPs. As you want access from outside, you want public IPs. Once domain name resolved, SSH will connect to the IP. If you don't specify port, it will connect to the default port (22). If you have one public IP, NAT have no way to know which host you want to connect to, A or B - just as you said.

Options to go around it:

  1. Deploy IPv6 already.
  2. Have 2 public IPs.
  3. Different ports and port forwarding. (- just as you said)
  4. Different ports and port forwarding, add SRV records for your serverA and serverB and use SSH wrapper to support SRV records
share|improve this answer
add comment

You need to have 2 DNS servers, one for the LAN that answers for example.com and returns the private IPs, and another DNS server on the Internet that answers for the same domain but returns the public IPs.

share|improve this answer
    
No need for 2 DNS servers, as this is normally done with split DNS, also known as DNS "views". –  John Gardeniers May 13 '12 at 6:21
    
Good point. You could use 2 DNS servers or you could use split DNS. I've seen the use of 2 DNS servers is many networks, the simpler approach, yet the later is a better solution. –  P. Corelli May 13 '12 at 17:36
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.