DNS set-up for self-hosted domains (optional DDNS / dynamic DNS)

This article describes how I registered a domain name, set up a virtual host on my own computer, and set up DNS to make the domain name accessible via the web.

[I registered my domain names at hostingon.com, so some of this may be a little specific to the hostingon.com interface, but it should be very analogous to other companies that register domain names.]

1. Registering on hostingon.com is easy. But to point the thing to your IP addr
isn't explained at all. The tools are there, but there is a learning curve as
to the meaning of what you need to do, and actions taken take fairly long periods
of time to work their way through the web's DNS infrastructure, so, it takes a
while to know the effect of something you just tried--to the tune of 10 minutes,
2 hours, or 24 hours.

2. Set up a Hurricane Electric Internet Services account. It's free. And DDNS
(Dynamic DNS) is free there. The site is difficult to understand for a noob (aka me),
and looks primitive and bare-bones, but they are basically a big co-lo player for
big, important companies, and I guess they run a big data center in Fremont CA.

NOTE ABOUT DynDNS -- a famous dynamic DNS provider: they aren't free anymore for DDNS. They charge a minimum of $40/year, which I absolutely don't want to pay.

NOTE ABOUT Hurricane Electric: their he.net login is DIFFERENT from their dns.he.net login. I was initially very perplexed, and it caused some anxiety about their reliability. Like I said, their site is quite bare-bones and doesn't explain things well at all to noobs.

3. Indicate to he.net (Hurricane Electric) what domain names you want them to
cause to be pointed to your IP address. Then add an "A Record" to that domain's
data there, inculding the IP address where you're hosting it. I'm a little unclear
about whether you need to add several A records, like these three:
Or, just @.example.com -- does that handle all possibilities?
Anywhoo..., I also set TTL to the shortest possible so as to cut down on the
potential time I'd have to wait for godknowswhat to happen. I intend to change that
to 24 hours later, but not a big priority for me.

4. That done, there will be a red message popping up saying:

"This zone does not appear to be properly delegated to our nameservers. If you have
corrected this issue, please click the 'Check Delegation' tab below [it's actually a
button] to have the zone rechecked. Keep in mind that once the change has been made to
reflect our nameservers in your whois record, it may take up to 24 hours for the actual
delegation to take place."

...I know understand what this means: (First, though, just leave this alone and come back to it later--don't press the button yet). It means that he.net has looked up your whois to see if it is identified as the nameserver for that domain name. Since you haven't changed the official nameserver yet at hostingon.com (or wherever you registered the domain name), then he.net isn't going to effectively be able to handle redirecting
requests for your domain to your IP address.

Therefore, got to the next step:

5. In hostingon.com's tab "My Domains" go to "Registered Domains" and click the icon "Edit DNS settings". Now enter "ns1.he.net" .. "ns5.he.net" into the "Change NS" fields and then click the button "Change NSes".

This is the part that will take a while to migrate to the (whatever they're called) 'publically canonical namer servers' or whatever.

So, I then go to https://whois.icann.org and search for that domain name to see what the world sees (Have to wait for and respond to their damned captcha). Right off the bat you'll see hostingon.com's name servers (or whatever the original nameservers were when you registered your domain name. You want them to eventually be "ns1.he.net" .. "ns5.he.net". Only when they are that way will public traffic be directed to your IP, via what you entered at he.net.

6. Now that traffic is coming into your IP address, it's up to you to handle it. This involved the router and web server.

SHIT, my computer is currently plugged directly into the modem, so as to eliminate any router confusion. I'm dreading dealing with the router, as where I last looked, it mandated DynDNS to exclusively handle incoming DDNS. I hope this isn't an issue.

I've already set up the web server (Apache2) to handle serving my linuxie.com domain. This involves setting up "virtual hosts". Here's those notes:

This is where I got a lot of the following virtual host information:

This looks really good, too:

NOTE: i SQUEEZED IN TWO NEW DOMAIN NAMES HERE: linuxie.com (which worked) and lolcoder.com, which I'm tring as I write this to confirm that everything's working. That is, a repeatable test.

A: I made conf file(s) for apache to recognize when the requests are coming
in. Like so:

sudo mkdir -p /var/www/html/www.linuxie.com
sudo mkdir -p /var/www/html/www.lolcoder.com

sudo vi /var/www/html/www.linuxie.com/index.html
sudo vi /var/www/html/www.lolcoder.com/index.html


Welcome To www.linuxie.com



Welcome To www.lolcoder.com

sudo chown -R www-data:www-data /var/www/html/www.linuxie.com/
sudo chown -R www-data:www-data /var/www/html/www.lolcoder.com/

sudo chmod 755 /var/www/html/www.linuxie.com/
sudo chmod 755 /var/www/html/www.lolcoder.com/

E: ----------I don't know if I need both these
sudo vi /etc/apache2/sites-available/www.linuxie.com.conf

ServerAdmin admin@linuxie.com
ServerName www.linuxie.com
DocumentRoot /var/www/html/www.linuxie.com

ErrorLog ${APACHE_LOG_DIR}/www.linuxie.com_error.log
CustomLog ${APACHE_LOG_DIR}/www.linuxie.com_access.log combined

sudo vi /etc/apache2/sites-available/linuxie.com.conf

ServerAdmin admin@linuxie.com
ServerName linuxie.com
DocumentRoot /var/www/html/www.linuxie.com

ErrorLog ${APACHE_LOG_DIR}/linuxie.com_error.log
CustomLog ${APACHE_LOG_DIR}/linuxie.com_access.log combined


sudo vi /etc/apache2/sites-available/www.lolcoder.com.conf

ServerAdmin admin@lolcoder.com
ServerName www.lolcoder.com
DocumentRoot /var/www/html/www.lolcoder.com

ErrorLog ${APACHE_LOG_DIR}/www.lolcoder.com_error.log
CustomLog ${APACHE_LOG_DIR}/www.lolcoder.com_access.log combined

sudo vi /etc/apache2/sites-available/lolcoder.com.conf

ServerAdmin admin@lolcoder.com
ServerName lolcoder.com
DocumentRoot /var/www/html/www.lolcoder.com

ErrorLog ${APACHE_LOG_DIR}/lolcoder.com_error.log
CustomLog ${APACHE_LOG_DIR}/lolcoder.com_access.log combined

sudo ln -s /etc/apache2/sites-available/www.linuxie.com.conf /etc/apache2/sites-enabled/
sudo ln -s /etc/apache2/sites-available/www.lolcoder.com.conf /etc/apache2/sites-enabled/
sudo ln -s /etc/apache2/sites-available/linuxie.com.conf /etc/apache2/sites-enabled/
sudo ln -s /etc/apache2/sites-available/lolcoder.com.conf /etc/apache2/sites-enabled/

sudo service apache2 restart

H: // I think this is just convenience hints for apache so it doesn't have to go finding them off the www. In other words, it will not look for them online if they are listed here.
sudo vi /etc/hosts

Add: www.linuxie.com linuxie.com www.linuxie.com linuxie.com

and add: www.lolcoder.com lolcoder.com www.lolcoder.com lolcoder.com

====================When your IP address changes===============================
...and you need to manually update your Hurricane Electric "A records" which point to your IP address..
(This is a little out of context for this post. I was also doing dynamic DNS using Hurricane Electric. Check 'em out.)

log in at dns.he.net,

If you're doing this from the IP address where the domain name is hosted, when you click each "A Record" (which need their IP addresses updated), Hurricane Electric's javascript tool AUTOMATICALLY DETECTS YOUR IP ADDRESS AND FILLS IT IN for you. All you have to do is click the Update button.