Point a main domain using cname - dns

I need to point a domain using a CNAME to another, but I need to point both as the main domain www.
I think that it is not possible with cname. I need to point a domain to other domain like a cname, but also main domain.
How i can do it?

To redirect an entire domain, you actually want to use DNAME instead of CNAME. You can do CNAME records too, but you'd need one CNAME for every equal record, whereas DNAME lets you do just one. DNAME records aren't quite as well supported, however.

Related

Can a subdomain have different CNAME records or must the entire domain have the same CNAME?

Like my question asks - should the entire DNS/CNAME be the same for the domain?
Thanks!
Any domain can have its own CNAME record. In most practical situations, the 'main' / apex domain (For example foo.com) can usually not get a CNAME record. But otherwise every CNAME record is for a specific (sub-)domain, and every CNAME record can point to something else.

Is a CNAME required if domain registrar and hosting company are the same?

I had a domain through web.com as well as hosting with them. I tried a new company, zenfolio, and after the year was up I decided to stop using them. The issue is now the site keeps pointing to an empty zenfolio page. I removed the CNAME record directing to zenfolio, waited a while and nothing seemed to happen. So I Added a new cname - "WWW" and "domain name" but nothing is occurring with that adjustment either. Should I simply remove the CNAME as I am using the original hosting site again?
A CNAME is just an alias that resolves to an address. You don’t have to have them at all, but it’s a common convention. Ultimately your CNAME must resolve to an A record with the address of your site.
You need to first find out how your domain name is being resolved and by who (old provider or new?) and then add the right entries (A or CNAME as appropriate). A good resource for these occasions is http://dns.squish.net - put in your site name and it will show you how it resolves.

Setting up domain alias CNAME record

I have a website setup at bryantmakesprog.10b3.com. I also own the domain sneaky.fish. I want my domain to point to this website by pointing to to the url, NOT the ip address. The end result being that visiting sneaky.fish/sample-page renders bryantmakesprog.10b3.com/sample-page but the URL says sneaky.fish/sample-page.
What would be the best way to go about this? I've seen some people have CNAMEs setup, but I'm not having any luck. Here's what I've tried:
To clarify, the domain must point to the subdomain. It is not sufficient to point to 10b3.com.
So there were two parts to this issue.
The first, the CNAMEs worked, it was just a matter of waiting.
The second issue was with the subdomain. sneaky.fish redirected to 10b3.com, and only bryantmakesprog.sneaky.fish would redirect to bryantmakesprog.10b3.com.
The solution for this was to use PHP to determine if a CNAME record exists pointing to bryantmakesprog.10b3.com and to handle that accordingly.

Can a DNS record have a multi-level name?

For a domain example.com, it is normal to have a record as follows:
blog IN CNAME www.example.com
Is this also allowed?
alex.blog IN CNAME www.example.com
Or, is it that there should be an NS record delegating the subdomain blog.example.com that can in turn have a record such as:
alex IN CNAME www.example.com
If it is possible, could someone also point me to an RFC/online-resource where I can read more.
It's absolutely possible, and extremely common in the in-addr.arpa. and ip6.arpa. subtrees. I don't think there's an RFC that discusses it directly, it just falls out naturally from all other rules. You only need the NS and SOA records when delegating control of a subtree to someone else (or yourself, just because you want to treat it as separate).

Dynamic subdomain redirection

How do I redirect a dynamic subdomain to the same subdomain on a different domain?
*.example.com to *.example2.com
Can this be handled with Zerigo?
Depending on your exact requirements, you could achieve that with a DNAME record:
For example, you could have the following in your example.com zone file:
example.com. IN DNAME example2.com.
and a pretty standard example2.com zone, you can mostly achieve the effect.
Querying dig www.example.com, you'd get:
example.com. IN DNAME exmaple2.com.
www.example.com. IN CNAME www.exmaple2.com.
However, if you had DNS records that you need directly under either zones, e.g. an A, MX or TXT record, they don't "alias" so you need to store them in both zones.
In any case, DNAME is not supported in most DNS providers (Zerigo included) that only gives you a web interface, so you'd need to run your own DNS server.
In DNS you can not redirect, that is an HTTP function. But what you can do is use CNAMEs. A CNAME take a dns name and under the covers resolves it to another name. For example:
www.example.com resolves to www.example2.com. In the web browser the user will see www.example.com though.
What you will want to do is look into "wilcard CNAME". There is a limitation though. A wildcard CNAME will only point to a single address. This means that:
*.example.com will only ever point to a single address at example.com2 (let's say you pick bang.example2.com)
foo.example.com -> bang.example2.com
bar.example.com -> bang.example2.com
baz.example.com -> bang.example2.com
cux.example.com -> bang.example2.com
It is also important to note that not every DNS provider allows for wildcard CNAMEs. Also, not every DNS server allows wildcard CNAMEs. If you really want to have a wildcard CNAME point to the corresponding entry in example2.com, then you may want to look into powerDNS. It allows for 3rd party plugins written in various languages like lua. It also can be backed by a mysql, postgress, ldap, or a sqlite backed. This means that you can add that functionality yourself if it does not already exist.
Good luck

Resources