hello friends! new(ish)!

Setting up a Server/DNS

From InstallGentoo Wiki v2
Jump to navigation Jump to search

DNS blurb goes here

Getting a Domain Name

The primary identifier of your server on the internet is the IP address. Not only is it often a huge pain to memorize and type the IP every time, but if you're hosting from home your IP likely changes periodically. It's a lot more convenient to have a domain like server.mydomain.net that you can use to get to the server.

You have two real options for a domain, either buy one directly from a registrar or get a free one from FreeDNS or similar.

From a Registrar

Think of a domain, go to the registrar and buy. Most registrars provide their own DNS servers, but few offer dynamic DNS - if you require dynamic DNS see here. Many registrars offer whois guard to protect the personal info contained in whois records, though you can often just falsify the whois information if this isnt offered (OVH is a notable exception). Some recommendations:

You can use TLD-List to compare prices and features, and domainhack.me to help you come up with neat domain hacks (though all the good ones are already taken).

FreeDNS

Make a free account, then go to subdomains and click add. Type in what subdomain you want to use, and pick one of the free domains. For example, if you want your server to be called cocks, and you pick the domain chickenkiller.com, your server will be accessible at cocks.chickenkiller.com (although this one is probably taken already). If you don't know your servers external ip curl http://ident.me/ from a shell to get it.

Click save, and it should pop-up in your subdomains. After a few seconds, the URL should point to your server's IP. You can test with SSH, ping, or opening in a web browser depending on what you have working. However, if your IP should change, you will need to manually update it. For doing this easily, FreeDNS actually provides an API. If you click the "ASCII" link there, you should get a table of all your domains. At the end of each line is an address. Every time you load this address in a browser, the IP will get updated.

To update it automatically put this in your crontab (crontab -e)

0 9 * * * curl https://freedns.afraid.org/api/?action=getdyndns&sha=API_KEY_GOES_HERE

This will run at 9 AM every day. If you want logging check this Python Script with logging.

Dynamic DNS

A dynamic DNS service keeps a system addressable from the same domain regardless of IP address changes (e.g. dynamic IP from residential ISP if you're hosting from home). There are a few options for this:

Running your own DNS server

Recursive

A recursive DNS server forwards and caches results from authoritative servers. Most they can be configured to answer queries from local data too, but not as flexibly as authoritative servers.

  • Unbound - high performance caching recursive DNS server
  • dnsmasq - Lightweight DNS forwarder available on most router software like OpenWRT. Can run with DHCP to map leases to domain names.

Authoritative

If you have domains of your own and want more flexibility than your registrar offers or just want to do it yourself this is the one you want. Recommended software:

  • Knot DNS - modern, easy to configure authoritative-only DNS server, runs the .cz tld zone among others.
  • NSD - modern authoritative-only DNS server, runs many tld zones including .nl and .fr.
  • PowerDNS - probably the most extensible open source DNS server out there.
  • Yadifa - authoritative-only, runs the .eu tld zone.
  • BIND - by far the most popular thanks to its age and proven reliability. Slowly fading in popularity, but it will never go away.
  • CoreDNS - another very extensible open source DNS server. Popular (and developed for) cloud applications.
  • djbdns - suite of DNS tools (tinydns is the authoritative dns server) created after frustration with bugs and vulnerabilities in BIND. Very popular in early 2000s, released into the public domain in 2009. Use tinydnssec or the version in Debian repos for IPv6 and DNSSEC support.

Knot, NSD and BIND all see extensive use for TLD zones and the internet root nameservers.