Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    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!

  2. #2
    Just Joined!
    Join Date
    Sep 2012
    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.

  3. #3
    Linux Engineer
    Join Date
    Apr 2012
    Virginia, USA
    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.

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts