IP and DNS question

Alright, I have u-verse, so when I did a port forward, server1 and server2 happened to be the same PUBLIC IP. U-verse has a weird port forwarding thing, where you choose which device you want to be your webserver, DNS, etc. If I want to make server 1 my DNS server, how would I do that?

do you want to:
have two separet server,
use server 1 as dns,
use other as web, and other things..

?

Say i set server 1 as the MySQL, webserver, and server 2 as the rest. How do i get them to work together?

I use EHCP =)

I want to tell step by step, since this is some complex thing,

first, a separate mysql server: (this is mostly from ehcp gui)
normally, a separate mysql server is done like this:
scenario:
server1: mysql
server2: other hosting functions, webserver, dns, etc..

to achive this:
* install ehcp on both server
* on server 2, login to ehcp gui, options, advanced settings/options, check multiserver, submit, then,
* click add server
* you will see a page with server properties.. (only mysql ser can be configured with this interface), attached image is this,
* in input fileds enter:
-> serverip: the ip of mysql server, internal or external ip.. this ip should be reachable by this server.
-> servertype: choose mysql server,
-> server option: click whichever you want, i suggest "always" for start, otherwise, each time user tries to add a db, a selection of mysql server will be presented,
-> if optional: if above option is not "always", this means is this server is default mysql server, to be presented to user,
-> mysql pass: enter mysql root pass
-> default mysql user hostname: you should write ip of webserver here, in this scenario, ip of server2, in next scenario, ip of server 1 which will contain webserver, read explanation right to it to understand..
(This is host of mysql user, to connect from,
You should write hostname/ip of your webserver here.. Otherwise, webserver cannot connect to your mysql server.)

* click submit. this way, you identified your mysql server at server1 to ehcp on server 2. From now on, you should use ehcp on server2.
* (XX) go to server 1 (on which mysql server resides) go to phpmyadmin, click on privileges, click on edit on right of root user, goto "Change Login Information / Copy User", write ip of server 2 to host input, keep the old one, then click go; this way, you let server2 to connect to mysql on server 1. this way, server 2 will be able to manage server1's mysql. understand ?

(In future, i think to simplify these things more and more, just like scenarios I wrote on above posts)

--------

Up to now, I only told about separate mysql server. now, we are going to add webserver capabilities to server 1:
I want to note that, adding a separate webserver or ftp is not directly supported, or easily done in ehcp, So, we will do many manual tasks..
if we add webserver to server1, we also need to give it ftp duty. Because files should be put on there for webserver.

first ftp: (on server 1)
open file: /etc/pam.d/vsftpd
edit part: host=localhost, replace localhost to ip of server2, with same user/pass as server2 (you should use all same passes in both ehcp installs in both servers, to simplify things)
restart vsftpd: /etc/init.d/vsftpd restart

for webserver:
what we need: ehcp handles all apache configuration files. So, to let apache function by information on server 2, we need to modify ehcp's config on server1 to read its database from server2, not itself.
so,
on server1: go to /var/www/vhosts/ehcp
edit config.php
$dbhost=ip of server2;
other parts same, if you use same pass in server2

now, go to phpmyadmin in server 2, do same as (XX) above, to let server1 to connect to server2 through mysql. (so, both servers see each other through mysql)
restart ehcp on server1: /etc/init.d/ehcp restart

this way:
ftp in server1 will read users from server 2,
webserver in server1 will read domains from server 2 and setup dirs and configs related to that,

server 2's ehcp gui will be used to manage things.
server 2 will do dns, postfix, etc.. as usual...

I know that this is quite complex, but unfortunately, there is no more easy way yet, as far as I know... Maybe somebody else may find some more easy way..

In future, i think to make things like scnearios, give a server a functionality, build server plans, and make them work out of box... I hop i will do it as I have time..

see you,

image at: http://www.ehcp.net/sites/default/files/ehcp_multiserver.png

Alright a couple of questions
To access get to those files, I use ubuntu server and do i just plainly type
/var/www/vhosts/ehcp
Because i think I've tried that before and it didn't work.
Also, I don't want to setup a DNS because that will have to use my router's DNS. Wouldn't it? or how would i setup a nameserver?
If it requires my routers IP, I would use the domain registrar's DNS to point it at what server? server1 or server2. Or do i point it to whichever has the DNS setup on it?

I use EHCP =)

you dont need to do anything extra to install nameserver, with ehcp.
Ehcp automatically installs bind9 dns nameserver, and configures it.
You need to point your registrar's dns (for your domain) to your nameserver, in this case, server 2,

that is:
just point your registrar to your server 2 , (after you install ehcp on it) you are done..

Those are correct if both your servers has public/real/static ip address.
If your servers are behind your router, in an internal network, for example,
your router has external/real/static ip address of 85.99.xx.yy,
your server1 has internal ip of 192.168.1.101
your server2 has internal ip of 192.168.1.102
Then, you should redirect your dns in registrar for your domain to your external single ip, and,
you need port redirection in your modem/router for port 53 to ip of server2,
for other services on server 1, setup port redirection in router to your server 1,
you should also do same for any services in server 2, such as mail, etc..
(mail ports: 25,110,143 dns:53, web:80, ftp:20,21, ssh:22)

Alright! When i get back home I'll see if all works. And, can i combine the users on server 2 with server 1? or does that already happen when i add the servers together?

I use EHCP =)

servers will have different duties, different roles,
so, they will have different types of users,
you cannot sum different types of users.

Will both servers have the ability to host a domain?

I use EHCP =)

same answer,
both servers will behave like a single server, with distributed roles..

to explain more: only one apache will be used, only dns of one server will be used. only one of ftp will be used..
this way, it will be like a more powerful single server, i hope.

I'm going to do what we've been talking about, server 1 as the MySQL server, while the other server does the rest. As for balance, I don't know if it's a good idea, but MySQL seems good for web stats etc.

I use EHCP =)

(09:57:42) Sean: but anyways, can the MySQL server also be used to serve domains?
(09:58:12) bv-infoehcp: maybe, but, this contradicts the "two server nature"
(09:58:24) bv-infoehcp: because, the purpose of "two servers" is
(09:58:34) bv-infoehcp: is to make a more powerful server
(09:58:51) bv-infoehcp: if you give the duty of serving domain to "mysql server" , then
(09:59:01) bv-infoehcp: it will no longer be a dedicated mysql server
(09:59:12) bv-infoehcp: if you wish "both servers do all things",
(09:59:13) bv-infoehcp: then,
(09:59:20) bv-infoehcp: you may just install two separate ehcp's
(09:59:27) Sean: will that work
(09:59:39) Sean: but with port forwarding, I can only assign 1 web server
(09:59:46) Sean: for port 8-
(09:59:47) Sean: 80

(10:00:18) bv-infoehcp: hmm, if you are behind a router, then you may redirect port 80 only to one server
(10:00:29) bv-infoehcp: you can use the second one for another purpose..
(10:00:35) bv-infoehcp: you may have only one webserver.
(10:00:59) Sean: what can i use it for then, having to do with Ehcp,
(10:01:37) bv-infoehcp: best way is to use it as: mysql and mailserver
(10:01:47) bv-infoehcp: if you concern balance between them,
(10:01:57) bv-infoehcp: webserver = dns+ mysql + mailserver
(10:02:04) bv-infoehcp: in fact this depends on your type of business,
(10:02:22) bv-infoehcp: if you host a mail website, such as little gmail,
(10:02:33) bv-infoehcp: then, mailserver must be separate dedicated server,
(10:02:36) bv-infoehcp: on a normal system,
(10:03:00) bv-infoehcp: server1 (webserver+ftp) = server2 (dns+mail+mysql) would be a good balance
(10:03:23) Sean-ehcpuser-multiserver: alright, and to set that up, I go to options, multiserver then what
(10:04:30) Sean-ehcpuser-multiserver: how do i dedicate it to be an ftp server?
(10:05:01) Sean-ehcpuser-multiserver: oh and when i forward it through the router, it gives boh machines the same IP
(10:05:05) Sean-ehcpuser-multiserver: idk why though]
(10:05:11) Sean-ehcpuser-multiserver: both
(10:06:20) Sean-ehcpuser-multiserver: Is that a good thing, is all i have to do now is setup the EHCP add server?
(10:09:00) Sean-ehcpuser-multiserver: so yeah... hehe

(10:23:45) Sean-ehcpuser-multiserver: Both the server's public Ip adresses appear the same
(10:24:52) bv-infoehcp: this works fine, if both server has different roles.. as i described , server1=web+fpt, server2=dns+mail+mysql

(10:25:06) Sean-ehcpuser-multiserver: And I want to make 1 server the mail/Ftp/MySQL server
(10:26:09) Sean-ehcpuser-multiserver: alright, but do I still need to add a server with the options>multiserver>
(10:26:22) Sean-ehcpuser-multiserver: and put it's local IP?
(10:27:11) bv-infoehcp: your central ehcp will be server2, the mysql server will be that server, so itself,
(10:27:21) bv-infoehcp: so, you wont need options->multiserver thing..
(10:27:41) bv-infoehcp: but you will need the manual settings in server1 for apache-webserver and ftp
(10:28:10) bv-infoehcp: look, dont mix things
(10:28:19) bv-infoehcp: we planned server1=web+ftp
(10:28:25) Sean-ehcpuser-multiserver: ehh, lol, that seems difficult
(10:28:25) bv-infoehcp: not mail+ftp+mysql
(10:28:35) Sean-ehcpuser-multiserver: yeah
(10:28:42) bv-infoehcp: pay attention:
(10:28:48) bv-infoehcp: * webserver must be same as ftp
(10:28:55) Sean-ehcpuser-multiserver: got that
(10:29:11) bv-infoehcp: so, web+ftp=serv1, mail+mysql+dns=serv2
(10:29:21) bv-infoehcp: you may move mysql duty to server1,
(10:29:33) bv-infoehcp: in this case, you need options->multiserver->add server
(10:29:48) bv-infoehcp: in central ehcp server which is server2

I know I can use the domain providers DNS, no need for that. Now, I want to use 2 servers to host 1 website. How would I manage that?

I use EHCP =)

the duties of servers are important in this case,
and the configuration heavily depends on the duty of servers you think to give them.

possible scenarios:
Scenario 1:
server 1: dns
server 2: webserver, mysql, etc

Scenario 2:
server 1: dns,mysql
server 2: webserver, ftp, etc

Scenario 3:
server 1: dns, webserver, mysql, etc
server 2: dns, webserver, mysql, etc
(both has same duties, with clustered or failover capability)

Scenario 4:
server 1: mysql
server 2: dns, webserver, ftp, etc

The number of scenarios may be increased, with different combinations of duties of dns, apache, mysql, ftp etc..
These are not automatically managed by ehcp, ehcp is designed for now, to only manage one server (except mysql).
ehcp can handle a separate server for mysql, but no other scenarios can be handled by ehcp directly, we need to make some extra configuration or manual things to realize them...

So, which scenario do you think to install ?