Domain name setup for your home Linux server

You have set your home Linux server on a small single board computer, Raspberry or Cubieboard or similar, and now you want to make use of it. Since it can be left to operate 24×7, you want to use it from the outside world, i.e. when you are not at home. Or you want to set up some services for other people to use.

Since it is on your home LAN, you have to access it via public IP address of your router, which is not permanent and, even if you make it permanent, it is not nice. You don’t want to call your server https://421.321.221.121, you want to call it https://cubie.myveryowndomain.wow or similar. I, unforget.rs, would want to call it https://cubie.unforget.rs, if I had one.

Static IP address

First thing that should be considered here is static IP address. Your home router’s public IP address is volatile, your internet provider may change it at its own will, more or less frequently and – without your possible influence on it.

So you may want to ask your internet provider is it possible to set up a static IP address for you, and for how much money (it is not free). With static IP address you can make a permanent nameserver setup and, which is also important, if you plan to have your own private mail server – it will have better “blacklist rating” if it resides on a static IP address. Many mail servers, especially the big ones, refuse to receive mail from mail servers with dynamic IP addresses, knowing that they may be used by spammers.

However, static IP address is not mandatory. Depending on your needs, you may live happily with the dynamic one.

Domain name administration

Free domains, usually for dynamic IP

With dynamic IP address and dynamic funds (no money), you may want to try some of available free options. This would also work for static IP address. For example, no-ip offers free subdomains in the form of yourdomain.hopto.org, yourdomain.ddns.net and similar (replace yourdomain with your preference), and there are many more out there. Just ask internet for “dynamic IP dns”.

Purchase your own domain

With static IP, you may want to register your own domain for a small annual fee. Internet search for “domain name registration” will yield an endless list of possibilities, and once you opt for one of them and walk through the procedure, you will be given access to a control panel where you can administer your domain, i.e. enter your static IP address and link it to your domain name. More detail on that below.

This will also work for dynamic IP address, but you will have to update your domain name setup each time your IP address changes, and each time it will take some time to propagate this change throughout the internet (default is up to 12 hours). Your server will be unreachable in that period and, which is even worse, someone else’s router which got your old IP address will respond to requests to your domain name. Bad!

You already have a domain

If you already have a registered domain, you should have access to a control panel to administer it. You are ready for the setup, and DNS record administration is what you are after, somewhere in the control panel’s menus.

  • If your new static (or, alas, dynamic) IP address is the only one you have, you will most probably simply attach it to your domain.
  • If you already have a server on your main domain, you will register your home server as a subdomain.

In either case, you will have to add a new address (A) record to your DNS records table, something like the first entry on the picture below:

Here is the overview of the first entry:

  • cubie.some-domain.wow is the name of your home server, in this case as subdomain of the domain some-domain.wow,
  • A is the record type, meaning that you are assigning an address to the above name,
  • 421.321.221.121 is your router’s public IP address, hopefully static, which you are hereby assigning to the above name,
  • 43200 is this record’s “time to live”, i.e. for how long other machines on the internet will keep this information in their memory before asking for it again (43200 seconds is 12 hours).

The default TTL of 43200 seconds is standard DNS setup, you can set the smaller value, but not small enough to catch up with changing of dynamic IP addresses. Remember that DNS administrator don’t like small values, as they increase network traffic, so lower limmit may apply on this number.

With this entry in place, you can call your home server a cubie.some-domain.wow, or maybe a some-domain.wow if you have only this server, and you set it up accordingly in DNS setup. Whis would be enough to run a web server, access it via ssh and many other things.

If you want to run a mail server on your home Linux server, you need to set up something like the second entry on the picture above. Here is the overview:

  • some-domain.wow is the mail domain for which you are registering the mail server, i.e. for mail addresses like person.name@some-domain.wow,
  • MX is the record type, meaning that you are describing a mail server here,
  • 10 cubie.some-domain.wow is actually two entries displayed together:
    • 10 is a preference, technically you may have more than one server with different preferences,
    • cubie.some-domain.wow is the server name,
  • 43200 is this record’s “time to live”, as already said above.

With such MX record in place, you can set up the mail server on your home Linux server, and other mail servers on the internet will know where to find it.

Leave a Reply

Your email address will not be published. Required fields are marked *