Thursday, October 30th, 2008 | Author: Aleks

This might be a beginners topic for most of the people out there, but the dns setup can be a bit confusing. This is just a short guide for how to setup an easy setup. Nothing complicated, and no fancy-pancy setup. This example will show how to setup an domain example.tld with three sub domains and mail.

I know subdomains can be setup as wildcards, CNAME and A-records, but right now I use A-record for the subdomains. To just get it going we will consentrate of just getting it working with the following configuration.

Domain: example.tld
Subdomains: mail, admin, mysql
IP: 1.2.3.4

Now we will start by adding the domain to the named.conf – Though it might not be present at this path you might need to search for it. (Using for example webmin would help you show all configuration files).

# vi /etc/named.conf

Add a new zone to named.conf

zone “example.tld” {
type master;
file “/var/named/example.tld.hosts”;
};

Save the configuration

Push escape, then : x

The next step is creating the DNS records.  Add a new file to bind.

# vi /var/named/example.tld.hosts

In this file you will create your DNS-records.

$ttl 15m ; TTL Might be smart to have at 15 minutes until your conf are ok
example.tld. IN SOA ns.example.tld. user.example.tld. (
123456789 ;An unique number
86000 ;Refresh rate in seconds
7200 ;Update Retry in seconds
3600000 ;Expiry in seconds
600 ; minimum in seconds
)

example.tld. IN NS ns.example.tld.
example.tld. IN A 1.2.3.4
www.example.tld. IN CNAME example.tld
mail IN A 1.2.3.4
admin IN A 1.2.3.4
mysql IN A 1.2.3.4
mail.example.tld. IN MX 1 example.tld.

Now save the file and restart BIND

# service bind restart

Share and Enjoy:
  • Print this article!
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter
Category: linux
You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

One Response

  1. [...] var/log Yet another weblog How to setup subdomains in apache Friday, October 31st, 2008 | Author: Aleks It’s not difficult to run a website without using expensive applications like plesk. It’s really not that difficult to setup a subdomain or site yourself. Here I will show an easy method of setting up subdomains. Though this might not be a perfect way of doing it. At least it easy, and you have the site up and running in 5 minutes.If we do this guide by setup the site for example.tld and one subdomain, admin. The DNS records did I show how to setup in this guide about how to setup DNS in BIND. [...]

Leave a Reply