Sometimes, it’s nice to give a home machine a subdomain for development purposes, or just for fun! Here’s how to do it through Dreamhost.
- You have a Dreamhost host account (if you want one, let me know!)
What this post will not cover
If you have a router at home, you will need to setup port forwarding to forward external traffic to your machine. For example, if you have the machine that has a web server you want to make accessible, you will want to forward all traffic on port 80 (and 443 if you’re using SSL) to the machine.
Setting up your DNS record
DNS (Domain Name Service) is used to translate domain names (google.com) into IP addresses. To setup your home machine, you only need to create a DNS record for it. Dreamhost lets you add custom DNS entries.
For a subdomain to point to your home machine, we will need an A Record (for a list of the various types of records, see this Wikipedia article).
- Log in to your Dreamhost account panel
- Go to Domains -> Manage Domains.
- Click on the DNS link under the domain name you wish to make the subdomain.
- In the Add a custom DNS record to [YOUR DOMAIN] section, enter the following:
- Name: the name of the subdomain
- Type: select the A type (use AAAA if you want to set an IPv6 address)
- Value: your home IP address
- Submit the form.
It may take a little while for your DNS record to be propagated throughout the Internet. But, it’ll be available soon!
What if my home IP address changes?
Of course, if your IP address changes, your subdomain may be pointing to someone else’s machine. Fortunately, Dreamhost has an API that allows you to update your IP address. More info will come on that soon in another blog post.