Can it be done? two servers one IP

8 posts / 0 new
Last post
#1 Sat, 12/20/2008 - 18:36
jsigned

Can it be done? two servers one IP

I've got one Virtualmin server up and running and it's great! Now I want a second development/test/whatever server that I can use and abuse without taking down the production system.

What I'd like to do is direct http, ftp, pop3 traffic to the test or production servers based on its url. For example http://www.mydomain.com goes to the production server and http://www.testdomain.com goes to the test server. I only have one routable IP address provided by my ISP. The servers are on my private 192.168.x.x network.

What would it take to do this? It seems that the big boy hosting companies don't have a one to one ratio of routable IP addresses to servers, or maybe they do.

Sun, 12/21/2008 - 13:12
ronald
ronald's picture

what exactly do you mean?
2 computers behind the router or two domains on 1 computer?
As for 2 computers I think you will have to run apache on a different port like 8080 and tell your router what to point to where (192.168.1.100 for port 80 and 192.168.1.101 for port 8080 for instance).

When 1 computer you would run mod_fcgid so you'll have independend php.ini's and such

Joe and Eric would have some better ideas I'm sure.

Sun, 12/21/2008 - 17:48
WolfstarHosting

Unless your edge router is capable of parsing the URL request for you, the answer is no.

Sun, 12/21/2008 - 18:42 (Reply to #3)
andreychek

Yeah, as Ronald said, we could definitely use some more info.

But while you can do some fancy work with testing on a URL and the various related headers when dealing with web traffic, you can't do the same thing with Email/POP/IMAP/etc.

That is, when connecting to an Email, POP, or IMAP server, the only thing the server sees is that there's an incoming connection. It can't tell what hostname was used to connect the same way Apache can when dealing with web traffic -- the browser sends a special "Host Header" to allow that, but other protocols don't do the same thing.

So you're probably going to be out of luck in setting up multiple services if you only have one IP address.

Some alternative ideas:

* Rather than try to be fancy, just setup a test server within a VMware Server instance on your desktop (or some other preferred computer). VMWare Server is free, so it won't cost anything to get that up and running.

* Buy a Linode or Slicehost (or whatever) VPS for $20, and setup your test environment there.

* Ask your ISP if you can have a second IP; some would sell you a second one for a few bucks more a month.

I fully agree that it's a great idea to have a test environment! In my case, I have a few VMware instances running on my laptop that I use for testing -- I tweak Virtualmin settings, test distro upgrades, and other goodies with that.
-Eric

Mon, 12/22/2008 - 05:41
jsigned

Thanks, I think this answers my question. What I want is two physical servers behind one inexpensive "home" class router. From what I see here my router isn't up to the task. I was hoping that it was a DNS setup that had to be done.

What kind of router would I need?

Mon, 12/22/2008 - 05:43 (Reply to #5)
andreychek

Well, the router isn't so much to blame as is the protocols you're hoping to use, and the fact that you only have one IP address.

If you get more than one IP, you'd simply need a router that supports two external IP addresses -- at which point, you'd be able to do all kinds of fun port forwarding to do what you're after.
-Eric

Mon, 12/22/2008 - 09:56
jsigned

So, here's a question, do the big boy hosting companies have a one to one ratio (or more) of routable IP addresses to physical servers? I've seen hosts with hundreds if not thousands of url's pointing to the same IP. I know there are a 1,000 variables, but it would seem that they should have the ability to move sites from server to server depending on the load. I know as a customer I would be very unhappy if I had to change my site's IP address.

Mon, 12/22/2008 - 10:08 (Reply to #7)
andreychek

Well, there's a few things going on here, and it depends on what protocol we're talking about.

With Apache, no problem -- you can setup as many websites as you want under one IP address. That's simply a new Virtual Host, and you can do that with your current setup.

SMTP and POP and IMAP and friends don't work that way. Your router can't redirect a request to to one server or another based on what domain name a user is connecting to for SMTP/POP/IMAP.

For Apache, all you need is one IP and you can run as many websites as you want.

But what you're asking for is to also do something similar for SMTP/POP/IMAP, and those don't work that way. For those, you'll need one external IP address per instance you wish to run (so if you want two SMTP services, you need two external IP's).

In a commercial hosting environment, most users would never notice if their domains IP address changed. They have the nameservers for their registrar pointed to the hosting company, and said hosting company maintains the IP address list.

Virtualmin actually makes it trivial to change the IP address of a given domain.
-Eric

Topic locked