# [ SOLVED ]Virtual host/DNS - when is it's working correctly?

## CurtE

Okay, this could be considered a dumb question, but I ask a lot of them.

I've been working on two servers, trying to make Virtual DNS's out of them.  In the process, I found I had a lot of pieces missing.

I have the web sites up and going, working on the email server (still needs work) and will have to do the firewall.

What is next?

How do I know I finally have everything working?Last edited by CurtE on Wed Aug 26, 2009 6:08 pm; edited 2 times in total

----------

## Mad Merlin

Virtual DNS? What do you mean?

----------

## xaviermiller

Something like http://www.dyndns.org

----------

## CurtE

Sorry about that, I meant Virtual hosts.

I'm trying to setup the system like this:

CSMN1 and CSMN2 are the servers with static IP's.

CSMN1 contains the Virtual hosts at this time.  I would like to make CSMN2 a duplicate of CSMN1 but I'm sure there are issues there.

CSMN1 has 4 web sites with registered domain names.  One of the registered domains will also have sub-areas (e.g. www.xxx.com/sub).

CSMN1 & CSMN2 will both be used as email servers (one a backup? still working on how that is done).

Firewalls will be done as soon as I got everything running.  I want to make sure I'm not fighting the firewall myself.

Even though the servers are working, is there software that tells me that I've got every thing done, no missing pieces?

E.G., if I didn't know about firewalls, that it would indicate I need one.  Like when you open up the web page and the error saying it has a mysql error.

----------

## Mad Merlin

Ah, name based virtual hosting. I thought that's what you meant, but I wasn't sure, as you threw in a lot of other unrelated things.

There isn't really much to say about vhosts, the basic setup is dead simple -- you get sent a different hostname and you pick a document root based on that. Either it works or it doesn't. Unless you have further requirements, you're done.

Beyond that it sounds like you want load balancing for your websites. Now that's a complicated topic. How you do that depends almost entirely on your web site/application's architecture. If it's 100% static, then you've got it super easy, but nothing interesting is 100% static. Also, what's the purpose of the load balancing? Performance, high availability, disaster recovery, and/or something else?

I don't know much about the mail setup, but I'm fairly sure you can just list both servers in the MX records for the relevant domains.

----------

## CurtE

Okay, this is new.  One strange thing I've noticed with the virtual hosts.  I'm not sure how to read it.

I ping the web site www.cs-mn.com and get Unknown Host, same with all the other web sites, but all the sites are found.

----------

## doctork

 *CurtE wrote:*   

> Okay, this is new.  One strange thing I've noticed with the virtual hosts.  I'm not sure how to read it.
> 
> I ping the web site www.cs-mn.com and get Unknown Host, same with all the other web sites, but all the sites are found.

 

Your two name servers don't agree on the address of www.cs-mn.com.

 *Quote:*   

> c3 ~ $ host -ta www.cs-mn.com. csmn1.cs-mn.com.
> 
> Using domain server:
> 
> Name: csmn1.cs-mn.com.
> ...

 

--

doc

----------

## CurtE

Okay, my ignorance I guess.  I take it I have to have a different domain name for CSMN1 or is there another way to do this?

What would the reason be for:

www.reunions-with-flair.com

www.blue-moose-gifts.com

www.flitezimz.com

They are on CSMN1 only.

----------

## doctork

Your DNS servers need to agree on all of the addresses.  

Your problem is that you are defining aliases to addresses that don't exist.  For example:

```
host -ta www.blue-moose-gifts.com csmn1.cs-mn.com

www.blue-moose-gifts.com is an alias for blue-moose-gifts.com.

but

host -ta blue-moose-gifts.com.

blue-moose-gifts.com has no A record
```

The other domains are similarly screwed up.  It's not at all clear to me what it is you are trying to do, but it is clear that you don't understand DNS.

--

doc

----------

## CurtE

I agree, I don't.

I'm basically trying to run all these site on one server CSMN1, the main one will be www.cs-mn.com.  CSMN2 will be a backup server if something happens to CSMN1.  My idea is sound, not sure on the production.  

After the registrars run out on the others, they will not be renewed except www.flitezimz.com (not mine, just on server).

If you can lead me thru the misconceptions I have, I'll clean it up.

Just let me know what info you need to have.

----------

## doctork

I should have mentioned that one of your DNS servers should be a master, the other a slave to the master.  That way, you only have to change the zone files on the master when things on you network change.

Also, it appears that csmn2 has something reasonable in its zone files, while csmn1 does not.

--

doc

----------

## CurtE

That is probably true.  As you have probably read in my other threads, I screwed up CSMN2 in trying to update the server from 3+ yrs old setup.  It was the original server and was setup by my son.  He had a better understanding but too busy with his work now.

I started CSMN1 from scratch and I know it's missing stuff but unsure how much.

I guess the first order of business is to make master and slave.  Does it matter which one is which or do I just chose one?

----------

## doctork

 *CurtE wrote:*   

> I agree, I don't.
> 
> I'm basically trying to run all these site on one server CSMN1, the main one will be www.cs-mn.com.  CSMN2 will be a backup server if something happens to CSMN1.  My idea is sound, not sure on the production.  
> 
> After the registrars run out on the others, they will not be renewed except www.flitezimz.com (not mine, just on server).
> ...

 

Ok, there are many ways to accomplish that.  As I said above, what you have on csnm2 accomplishes the web stuff -- it directs all traffic to csmn1.cs-mn.com.  Howver, you may want to change that so that they point to another name (but the same address).  Change the aliases so that they point to "PICKYOURNAME.cs-mn.com".  Then add an A record in your cs-mn.com zone file for "PICKYOURNAME.cs-mn.com" that has the same address as csmn1.  Assuming that you have made csmn1 a slave to cnms2, the only thing you have to change is the new A record on csmn2 when you want to move the web services around.  If you prefer csnm1 as the master, just switch them in what I said above.

Re the MX stuff, what you have for flightzimz is almost there, but you have cnms1 listed twice when you probably wanted cnms2 in the second record.  Note that despite the different preferences, mail may still be distributed over both servers.

As an ex-gopher myself, I'm always happy to help a Minnesotan -- I grew up on the Iron Range and went to undergrad school in St. Paul.  

--

doc

----------

## CurtE

Well, if I had it my way, I'd stay up until we had it done but the wife decided we are taking two grandkids to the Historic Fort Snelling area tomorrow and I have to be up at 6 AM.  I'll leave in a little bit.  If there anything that you need me to post?  A zone record or something to see what I have done?  Or are you looking at it from a different method?

----------

## CurtE

This is what I have for CSMN1 cs-mn.com.zone:

```
$ORIGIN cs-mn.com.

$TTL 30 ; 30 sec (this is temporary)

@       IN  SOA   csmn1   admin (

              2009081403 ; serial

              7200       ; refresh (2 hours)

              1800       ; retry (30 minutes)

              14400      ; expire (4 hours)

              7200       ; minimum (2 hours)

              )

  IN  NS  csmn1

  MX  10  csmn1

  MX  20  csmn1

csmn1 IN  A       70.89.201.10

csmn2 IN  A       70.89.201.9

  

www     CNAME   @
```

and this is for CSMN2 cs-mn.com.zone:

```
$ORIGIN cs-mn.com.

$TTL 30 ; 30 sec (this is temporary)

@       IN      SOA     csmn1   admin  (

                   2009081403 ; Serial

                   7200       ; Refresh

                   1800       ; Retry

                   28800      ; Expire

                   7200 )     ; Minimum

                IN      NS      csmn2

                        MX      10 csmn1

csmn2           IN      A       70.89.201.9

csmn1           IN      A       70.89.201.10

www                     CNAME   csmn1

mail                    CNAME   csmn1

photos                  CNAME   csmn1
```

What do you suggest for the changes?

----------

## CurtE

Thanks to doctork, the DNS is now proper.

We made one of the servers to have slave zones and added some minor logic changes and it was good to go.

Problem solved.  :Smile: 

----------

