[clug-talk] Name Based Virtual Hosting

William Astle lost at l-w.ca
Mon Mar 28 11:23:12 PST 2005


Shane wrote:
> Hello group.
> 
> I was wondering if someone would be willing to discuss virtual hosting from 
> the BIND stand-point. I have setup "name based" virtual hosts on my machine, 
> but the DNS part I'm a little unclear about...
> 
> For some reason, my setup doesn't register with anyone on the Telus 
> network...
> 
> I have in named.conf:
> 
> zone "thevirtualdomain.com" {
>         type master;
>         file "virtual.com";
> };
> 
> And in 'virtual.com':
> 
> $TTL 3D
> @       IN      SOA     thevirtualdomain.com. root.randomwords.ca. (
>                         20041101
>                         8H
>                         2H
>                         4W
>                         1D )
>                 NS      ns.randomwords.ca.
>                 MX      10 randomwords.ca.
>                 TXT     "randomwords.ca"
> theserpentstooth.com.   CNAME   randomwords.ca.
> www                     CNAME   randomwords.ca.

That looks rather weird. You have a CNAME from an unrelated domain in 
your zone file. Unless that's just a typo. If you meant 
"thevirtualdomain.com." instead of "theserpentstooth.com.", then you 
have another problem.

You cannot have a CNAME record and another record at the same point in 
the DNS tree. This means the root of your zone cannot have a CNAME 
record because there's an SOA and NS records.

Assume that your IP address for the virtual hosting is 10.1.1.1. You 
might construct a zone file as follows (I'm not going to include the SOA):

@	NS	ns.radnomwords.ca.
	MX	10 randomwords.ca.
	A	10.1.1.1
www	CNAME	@

TXT records are irrelevant for this situation.

Note that this is not ideal because if you have to change the IP address 
of the server, you have to change every zone but I'm not aware of a good 
way around it.

Note also that if you don't need "virtualdomain.com" to respond on HTTP 
but just "www.virtualdomain.com", you can leave out the A record all 
together (and the issue from the previous paragraph goes away).

> 
> 
> 
> _______________________________________________
> clug-talk mailing list
> clug-talk at clug.ca
> http://clug.ca/mailman/listinfo/clug-talk_clug.ca
> Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
> **Please remove these lines when replying


-- 
William Astle
finger lost at l-w.net for further information

Geek Code V3.12: GCS/M/S d- s+:+ !a C++ UL++++$ P++ L+++ !E W++ !N w---
!D !M PS PE V-- Y+ PGP t+@ 5++ X !R tv+@ b+++@ !DI D? G e++ h+ y?



More information about the clug-talk mailing list