Dynamic subdomain redirection - dns

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

Related

Wildcard CNAME record for wildcard domain

Suppose I own a wildcard domain like *.example.com that points at 192.0.2.34
All requests to https://bob.example.com will point at the server 192.0.2.34.
Is there a way that I can also have a wildcard CNAME that points *.bob.stuff.com at the 192.0.2.34 server?
Basically I'd like a double wildcard domain so I can do apps.bob.example.com and blarg.bob.example.com and have all of those resolutions point at 192.0.2.34 over SSL.
You can not do a "double" wildcard, in the sense that *.*.example.com will not work as expected in the zone.
You can however put both *.example.com and *.bob.example.com in your zone, the later will override the former, and you can repeat that for any other string than bob.
See https://serverfault.com/questions/942124/can-i-use-nested-dns-wildcard-records for a similar example.

hostless DNS CNAME record

We are running BIND 9.9.7 on Centos 6.5 and for a long time I have been creating "hostless" DNS entries so that sites work with or without the www.
Eg:
www IN A 192.168.1.1
domain.com. IN A 192.168.1.1
However, our client wants to use a CNAME record to a cloudfront host and the "hostless" entry doesn't work as a CNAME record.
In fact, it more than doesn't work, BIND won't even load the zone file. The error is
"failed: CNAME and other data"
domain.com. IN CNAME host.cloudfront.net.
www IN CNAME host.cloudfront.net.
It will load and resolve fine without the domain.com entry. I have tried a few variations, but nothing seems to work. including "", "."
Can anyone tell me the correct syntax for this entry?
There is no correct syntax for this (and it is not BIND specific, it is a side effect of RFC1912 which states that A CNAME record is not allowed to coexist with any other data.
Detailed explanation: Why can't a CNAME record be used at the apex (aka root) of a domain?
Some DNS providers might offer workaround hacks.

Free dns with wildcard subdomains?

Are there any free dns services i can use to access my local host over external ip that support wildcard domains? This way i can set up virtual hosts to serve the subdomain content based on subdomain name.
For example, suppose the free fqdn with dns service is:
example.com
Example.com - my server root, default vhost
Site1.example.com - loads site1 vhost
Site2.example.com - loads site2 vhost
*.example.com - i can create a vhost for whatever the wildcard value is and it'll work like the two above
I don't mind if the free fqdn is a top level domain. Example.aa.bb.cc is fine as long as i can set up *.example.aa.bb.cc
A free fqdn/dns without support for wildcard subdomains but has lots of free subdomains i could set up would be OK, but not preferred.
Also, dynamic dns is not a requirement. My external ip very rarely changes so i wouldn't mind updating it if it ever changes.
I know I'm asking for a lot for free. I don't mind buying a domain name but I'm trying to get away with free if i can.
You should consider to build your own domain server to handle the subdomain information, for example using Bind software. After that you need to submit your NS record to your domain register
Found a good one. dtdns.com is free and allows for wildcard subdomains for free.

How will a CNAME DNS affect Google Engine

I'm hosting a clients site at client.mysite.com, but my client want to have its own domain, like www.clientsite.com.
With a CNAME configuration, I'll be able to hook my client domain to the content, but... considering I'm still hosting my clients content, which domain will be finally listed on Google with contents of client.mysite.com contents?
a) mysite.com
b) clientsite.com
Thanks for helping.
In the DNS hierarchy, the CNAME resource record will be attached to the clientside.com. A CNAME is simply a reference to the location of that site's A record. With that in mind, I believe mysite.com will be listed as hosting the data.
Does your client want it to appear under his name?
If so, then this should not be solved using DNS (well, not only using DNS).
If your client wants to get the content listed under his domain name, the best way to do this, is to add their name to your server.
Then point client domain name to your server.
The best way to do the pointing (when also considering SEO)
is to make an webforward (301 permanent) from the root, to the www
and make the www subdomain point to the ressource.
(Or vice verca)
IF you are using the example above (webforward on root) you can use a cname instead of an A record to point the domain name. However do not add a cname to the root of a domain (effectively shutting down your domain name).
So-
Short Answer:
client.mysite.com will have the content (also according to google).
Any attempt to obfuscate this is black hat or grey hat ;)
a better way of doing it is to simply setup the clients domain name on your server.
Then point only one hostname to the server. Server host/headers will take care of the rest.
Setup in DNS
# webforward 301 www
www a or Cname to server
Quick rules:
NEVER put Cname on the root of a domain
Only allow 1 hostname to show content (can be done both as explained above via DNS/webforward or via server configurations)

Point a main domain using cname

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.

Resources