Hi everyone,

I need to do what services like co.cc are doing, taking a subdomain of my site (call it domain.com), and directing it to another server.

The current setup has one cPanel reseller, which directs the viewer to another cPanel reseller via an IP address in an A name records. It uses the default system built into cPanel, meaning I cannot remove or otherwise modify these new zones.

In addition, these subdomains are reknown to not work, most specifically on older ISPs. As I'm running a web host, this is unacceptable. I need a solution that works universally, or as close to universally as possible. In addition, if the user creates subdomains of their subdomain, those fail almost all the time. I need to pass ownership of all subzones to the new server.

I was thinking it best to build my own DNS management utility on a VPS. It shouldn't be hard to build a script that creates/deletes DNS zones. I built my entire site from nothing. However, I have little experience with DNS. I need to know:

1) How do I create zones? Where are these files on the server? httpd.conf? If they go in that file, what's a zone file? Why are there other configuration files?

Yes, I have used guides, but some of them tell me httpd.conf and others talk about zone files, but don't mention a location.

2) What is the best type of zone to create? Keep in mind there will be thousands of these created, they need to work reliably, I want ownership of any subdomains transfered, and they are likely to be changed. I have A names now, but I'm thinking NS or DNAME(?) and I don't know how to set those up.

3) Let's say I now want to provide a page for all unused domains (WildCard DNS). How does this integrate with a system such as this, and how do I set zone priority?

4) If I want the main domain to direct to another server (to keep it online if this DNS server goes down) is this possible and how might I do this? I also want a few subdomains to direct to the other server.

5) Is it possible to set up a failsafe server, and how would I do this? (Visitors will go to this server if the main one goes down.)

My domain, at present, is housed with GoDaddy. I have the option to set nameservers, or create nameservers of my own directing to an IP address.

I know how to use SSH for most basic tasks, including navigating, modifying, deleting, etc... I know how to build a bash script. I am an expert at PHP.

Basically, I need to know how you would set this up to work with a couple subdomains, then I can build scripts to do all the rest.

Recommended Answers

All 7 Replies

1) DNS has nothing to do with HTTP, wrong service. Look at using bind or djbdns (if you're daring).
2) It depends on the purpose. If you want to create subdomains for the user you should offer the option of creating the hosts for them (IN A records) or giving them control of the subdomain (IN NS)
3) What is a zone priority? Wildcards apply if the host is not defined, then default to the wildcard. If you define a subdomain then it resolves as defined, if not it falls back on the wildcard
4) That is not the right approach. DNS functions whether or not a website is down. What you want is a high-availability website. For this you are best to get a paid service, but effectively you can just get a single high throughput line with one IP and pass it off to a load balanced server cluster. At that point you can apply updates and such to one server at a time without disrupting traffic.
5) Why setup a failsafe? If you can serve any content, you should be serving the sites' content. Please see #4

Not being critical but matter-of-fact: you're having a hard time separating what is DNS versus what is HTTP/web services. DNS defines IP addresses to go to, nothing more nothing less. A level of complexity is added with doing the slave configurations you're talking about but its still possible and done today.

And of course there are experts here, this is daniweb ;) !

Okay, let's start with something simple maybe that will help me.

I want to create a subzone on my domain and pass it to another server. What is the easiest way to do this via SSH?

Ultimately, users on the other server will have a cPanel there, and I want them to be able to use the subdomain as if the domain itself were directed to that server. This means subdomains (thisis.partof.mydomain.com) and email (myemail@partof.mydomain.com) should work perfectly via the new server.

I was playing around with editing files with this one which doesn't work at all:
http://myg.ismyhost.com/

And then I used DirectAdmin and created
http://myg2.ismyhost.com/

I set all the IPs in the host file to the new server, but still subdomains wont work there. See http://mysupertest.myg2.ismyhost.com/...

How many places must I change for a domain to work properly?

You need to install BIND from scratch and learn DNS. Using middleware (cPanel) will hide the true functionality of DNS, and you can't really learn. This is a very involved question and I think you should do some research on DNS.

Hi Sknake,

I actually have a fresh install of BIND. This server has no cPanel at all. I just needed to be able to pass the zone to the IP address of servers which have cPanel only, and no root access, which I've done successfully. I know 3 of my subdomains are working over 90% of the time, and they were created less than 12 hours ago. I've also managed to successfully pass ownership of the subzones and email is fully working on a zone that was created more recently.

As for research, believe me I've been there. Pages and pages of information when all I need is a simple guide to help me. (I am not joking to say I spent 8 hours on it yesterday alone.) DNS is really a 3-step process, but no guide breaks it down like that. Maybe I can write one. My problems now are as follows:

1) When I first create the subdomain, it doesn't work until the propagation is complete - at all. I know for a fact, it was pointing to the server just moments earlier when there was Wildcard DNS and that DNS only controls where the request goes, which would indicate that the server is deliberately not replying to this request.

Is there any way I can have the server serve up a page telling the user propagation is in progress, or something similar, during this time? How complicated would this be?

2) As for my failsafe idea, if I add more nameservers does that mean visitors will visit them in order until one of them works? I read somewhere of this, but I can't find it now. It would be great to be able to assign a backup server so visitors can still see some sort of page if the site is down.

3) I know DNS will start at the base zone, and work it's way through the sub zones. So, if I want to host my main domain with some paid hosting company (thus hiding it and ensuring that it can remain online if my VPS goes down), is there a way to do this without confusing the client?

I'm just thinking if the domain.com points to my paid hosting, then clients will look there for sub.domain.com, when I really want them to look at the VPS instead. If this is too complicated to figure out, maybe I should just point www.domain.com at the paid hosting, and create a HTTP redirect to there with domain.com? Or do you know how to do this properly?

----

I'm sorry if I'm confused, but if I knew a single person in my 750+ mostly tech-related contacts who knew about this, I wouldn't even be here. If you'd like I can give you a public thanks on my site, which has a lot of visitors?

Have you had any luck on this problem? If not tell me where you are at now and i'll give it another shot....

Yep,

I got it all working. Thanks for your help.

DNS is easy once you get the hang of it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.