DNS entry to resolve to an external IP

I’ve been a silent user of Virtualmin for about 6 years now! But I only started using BIND DNS server last night. BIND is running perfectly on my server and all my domains are resolving.

Now, what I want to do is very simple: I’d like my DNS to resolve a non-existing subdomain of one of my domains to an outside IP address (for example resolve myhome.domain.com to the static IP of my home network).

Why do I want to do this? So that from outside home I could do (e.g.) ssh myhome.domain.com rather than ssh (assuming that’s the static public IP of my home’s network).

How can I achieve this?

1 Like

The simplest would be to just add a DNS record on the domain you want to use - this is done under Server Configuration -> DNS Records.
Just click Create Record of Type (A) -> enter what you want to use as subdomain and the IP address of your home network.

Or were you thinking of something else?


Yes, correct. However you might not want to advertise your home IP address publicly, and could use local /etc/hosts file (on PC from which you’re trying to access your remote, home server).

#/etc/hosts     localhost localhost.localdomain localhost4 localhost4.localdomain4
::1           localhost localhost.localdomain localhost6 localhost6.localdomain6 myhome.domain.com
1 Like

Of course, that is also an option.
Or, if using linux, add an entry in .ssh/config

Host myhome
User myuser

But adding an A record is simpler if you also want to be able to connect from different computers from time to time. :slight_smile:

Awesome guys, thanks for your help!

Wow talk about overthinking it. Duh… of course the simple way is to add the A-record! (I don’t know why I wasn’t realizing it!!).

The solution with the host file is valid, but as toreskev pointed out I want to switch from computer to computer from time to time.

Also, creating entries in ~/.ssh/config is exactly what I’ve been using thus far. But since I started using my own DNS server I thought why not just give it a public name.

Thanks again, I added the A record and it’s working as intended.

1 Like