Results 1 to 3 of 3
Hi everyone,
I have a KVM virtual machine server. and I'm running 2 clients VM, with apache webserver in it. My problem is that I have only 1 public IP. ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 09-07-2012 #1Just Joined!
- Join Date
- Jul 2012
- Posts
- 7
Using single IP on KVM webservers
Hi everyone,
I have a KVM virtual machine server. and I'm running 2 clients VM, with apache webserver in it. My problem is that I have only 1 public IP. So I want redirct visits from domain A into VM A. Redirect visit from domain B into VM B.
I'm thinking of using iptables to filter and redirect the visit. Is it a feasible solution? and it seems too difficult for me. Can anyone give me an example?
Thank you in advance!
- 09-07-2012 #2Just Joined!
- Join Date
- Sep 2012
- Location
- Russia
- Posts
- 5
Hello, esojourn.
I hope that you understand that there is no point to use different VMs to host the same site on one IP address. The reason not to do this is a possible crash of a webserver application on one of your VMs. To prevent failure you should monitor both sites, which is not a trivial task, and change iptables chains when something goes wrong.
However the solution for you is to create an internal network on your server machine and to translate destination IP address of the incoming packets depending on something (like source IP) to different internal addresses. This is a basic example and can be found in many online practical studies.
- 09-07-2012 #3Linux Enthusiast
- Join Date
- Apr 2012
- Location
- Virginia, USA
- Posts
- 563
In order to do this, you'll need to set up either a proxy or loadbalancer type configuration on the host machine, or in front of the host machine, or set up something like layer 7 iptables - Google Search
If you want to go the proxy route, NginX is often used for this type of setup.
I have not done any of these personally, but that should be enough information to get you started. That Layer 7 iptables thing looks promising.


Reply With Quote
