Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2002 12:15:59 -0600 (CST)
From:      Ryan Thompson <ryan@sasknow.com>
To:        Taylor Dondich <thexder@lvcm.com>
Cc:        isp@FreeBSD.ORG
Subject:   Re: What's a good name server daemon for virtual hosting?
Message-ID:  <20020423114546.J4042-100000@catalyst.sasknow.net>
In-Reply-To: <000f01c1ea2a$5c832870$6401a8c0@penguin>

next in thread | previous in thread | raw e-mail | index | archive | help
Taylor Dondich wrote to isp@FreeBSD.ORG:

> I understand that bind out of the box isn't very good for virtual
> hosting because of the complexity of the zone files and how you
> can't do dynamic look ups well.  I would think that a database
> implementation would make this easier.
>
> What is everyone's name server daemon of choice and what would be
> good for a virtual hosting scenario where I'm hosting multiple
> domains that are added/removed/edited each day?

Reading this thread, I see a lot of good suggestions with respect to
BIND. If you just need to do quick virtual hosting for a bunch of
www.domain.com sites on a small number of IPs (i.e., name based
virtual hosting), you can just use something as braindead as:

echo 'zone \"$dom\" { type master; file \"s/template12\"; }' >> /etc/named.conf
ndc reload $dom

(Needless to say, you'll certainly want appropriate error checking :-)


Where s/template12 is something like:

$TTL		43600

@		IN	SOA 	primary.yourdomain.com. host.yourdomain.com. (
				1	; Serial
				3600	; Refresh
				43600	; Retry
				604800	; Expire
				43600 )	; Minimum TTL
; Nameservers -----------------------------------------------------------------
		IN	NS	primary.yourdomain.com.
		IN	NS	secondary.yourdomain.com.
; Host addresses --------------------------------------------------------------
		IN	A	192.168.0.12
		IN	MX 	10 mx1.yourdomain.com.
		IN	MX 	20 mx2.yourdomain.com.
www		IN	A	192.168.0.12
ftp		IN	CNAME	ftp.yourdomain.com.


That way, you don't have to edit any zone files. yourdomain.com is
YOUR (hosting company's) zone. By virtue of the @ SOA, this template
automatically picks up the customers' zone from the $dom inserted in
named.conf. So, www.$dom resolves to 192.168.0.12. We have scads of
these domains. Less than 1% of our domains require their own zone
file.

If, once in a blue moon, the IP of the web server changes, tell your
boss it'll take half an hour to update the DNS for 100,000 zones.
Just update the one zone file, bump the serial, call ndc reload, and
spend the next 25 minutes making yourself a nice loose meat sandwich.
:-)

We use something more complicated, as we have multiple servers, and a
few different templates based on different customer types... but it's
still based on this, and there aren't many permutations.

This approach can later be augmented with MySQL, a web interface, etc,
etc... :-) And you don't end up having 100,000 mostly identical zone
files laying around that all need to be updated the next time you add
a new MX, or renumber your server(s). :-)

Hope this helps,
- Ryan

-- 
  Ryan Thompson <ryan@sasknow.com>

  SaskNow Technologies - http://www.sasknow.com
  901 1st Avenue North - Saskatoon, SK - S7K 1Y4

        Tel: 306-664-3600   Fax: 306-664-3630   Saskatoon
  Toll-Free: 877-727-5669     (877-SASKNOW)     North America


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-isp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020423114546.J4042-100000>