A while ago I was setting up a Ventrilo server for a few friends and I to use when playing online games. My Internet provider doesn’t give a static IP address, so I’d need to use a DDNS service to give the server address to my friends, the problem was I find those host names a little ugly.
After a little googling, I found a way to use my own domain (robweeks.net) to resolve to my home IP address through CNAME records.
Firstly, you need to set up a Dynamic DNS provider, ideally one that’s compatible with your router to aid updating it. If you’re running Tomato like me, dnsomatic.com works pretty well. Once you’ve got this set up, you’ll get a host name which will resolve to your IP address; lets say it’s “something.foo.org”.
Secondly, decide what host name you want as the “pretty sub-domain” (voip.bar.net for example) and set up a CNAME record on your domain to create an alias. Depending on who’s providing your domain name, you might have access to do this yourself or need to submit a support ticket. It will look a little like this (yes, the trailing . is needed).
voip.bar.net. CNAME something.foo.com.
When a DNS request is made to “voip.bar.net”, it will alias to “something.foo.com” then restart the DNS request at “something.foo.com”.
Finally, if you have problems in connecting to “voip.bar.net” from your internal network when “something.foo.com” resolves to an another IP address on your internal network, you’ve hit the “NAT Loopback” problem I had. To resolve it, enable “NAT Loopback” on your router, and/or, if you have access to Dnsmasq (like on Tomato firmware), add the following entry.
Doing this will basically ensure machines on your internal network can connect to other machines inside your network by an external IP address.
If you now ping something.foo.com and voip.bar.net; they will resolve to the same IP address and you can use voip.bar.net from both machine outside and inside your firewall.