CNAME or A record?

Eric Kom erickom at kom.za.net
Thu Sep 29 05:48:58 UTC 2011


On 28/09/2011 21:02, Mark Elkins wrote:
> On Wed, 2011-09-28 at 16:19 +0200, feralert wrote:
> 
>> The thing is that i want users redirected to 'www.domain.com' even
>> when they just type the domain name 'domain.com'.
>> In order to do so I am not sure if its best to have one A RR for each
>> or have an A RR for the domain and a CNAME RR pointing to 'domain.com'
>> for 'www.domain.com'.
>>
>>
>> domain.com           A            1.1.1.1
>> www.domain.com   A            1.1.1.1
>>
>> OR
>>
>> domain.com           A            1.1.1.1
>> www.domain.com   CNAME  domain.com
> 
> If named.conf is correctly set up with the domain name - then
> you could use
> 
What Mark tell you is a good principle!
if you can send us you named.conf config, It'll be okay.
> $TTL 3600
> @	IN	SOA	...the SOA info
> 	IN	NS	Nameserver record lines
> 	IN	A	1.1.1.1
> www	IN	A	1.1.1.1
> 
> Last line can be converted to a CNAME...
> www	IN	CNAME	domain.com.
> 
> When you include IPv6 addresses into the mix...
> using a CNAME saves you entering the same IPv6 address twice - so then
> there really is a saving - especially when you include other alternative
> labels like 'mail', 'pop', 'smtp', 'ftp' - etc - do them all as CNAMES!
> 
> $TTL 3600
> @	IN	SOA	...the SOA info
> 	IN	NS	Nameserver record lines
> 	IN	A	1.1.1.1
> 	IN	AAAA	2001:1:1::80
> www	IN	CNAME	domain.com
> 
> What I think is your real problem....
> Regardless of whatever which way you decide - apache will be given the
> original name - DNS will not re-write that.. so you have to spell out
> both names in your apache configuration files...
> 
> So (playing with virtual hosts)
> NameVirtualHost 1.1.1.1
> 
playing with the web server in this apache it's very important if your
domain is well configured as the above configuration.

You can decided to call your FQDN as you want, playing with the
ServerAlias directive.

> <VirtualHost 1.1.1.1>
>   ServerName domain.com
>   ServerAlias www.domain.com
>   ...
> </VirtualHost>
> 
> -and later for IPv6 - duplicate the above...
> (this line next to the other "NameVirtualHost"
> NameVirtualHost [2001:1:1::80]
> 
> <VirtualHost [2001:1:1::80]>
>   ServerName domain.com
>   ServerAlias www.domain.com
>   ...
> </VirtualHost>
> 


-- 
Your Truly

Eric Kom

2 Hennie Van Till, White River, 1240
erickom at kom.za.net | erickom at namekom.co.za | erickom at erickom.co.za
www.kom.za.net | www.kom.za.org | www.erickom.co.za

Key fingerprint: 513E E91A C243 3020 8735 09BB 2DBC 5AD7 A9DA 1EF5
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0xA9DA1EF5.asc
Type: application/pgp-keys
Size: 2174 bytes
Desc: not available
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20110929/1cbe8e33/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <https://lists.isc.org/pipermail/bind-users/attachments/20110929/1cbe8e33/attachment-0001.bin>


More information about the bind-users mailing list