Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


How can share public IP to multiple VMs
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

How can share public IP to multiple VMs

Hi,

I have an old Dedicated server (CPU L5520, 32GB RAM) at home + 1 dynamic IP 100Mbps

Right now I install centos on the server (LEMP) and use no-ip to update my dynamic IP to some domain. => It works perfectly.

But I want to install centos on the server then install openvz to split it into some VMs to share it with my friend. How can I point all domains to my public IP, then some of them will go to one VM 192.168.1.101 , some will go to another 192.168.1.102...

I've did a lot of search + google, got some article about NAT but it only allow me to setup port forwarding instead of domain forwarding.

I've saw some similar stuff which @AnthonySmith did with his panel of littlehappycloud.net
We share the same IP, then add the proxy domain in the panel, the traffic to that domain will be redirect to properly VM with LAN IP.

Can you guys point out some keyworks or tutorials to start with?

thank you

Comments

  • 4n0nx4n0nx Member

    I think you basically just give each VM an internal IP address, then use iptables to forward traffic from your VMs to the internet. For incoming connections you use iptables as well, but with individual ports.

  • I have a home setup that I use a nginx reverse proxy to forward multiple domains to different internal servers.

  • servarica_haniservarica_hani Member, Patron Provider

    There is 2 different ways of doing it for incoming traffic

    1- through reverse proxy like nginx as @VPSSoldiers mentioned:
    The cons of this is that nginx only work with tcp based services and will not forward any udp based service.
    you have to configure your clients to connect to port 80 of the domain you want

    2- through DNS SRV records :
    by that way you can specify the port per application per domain for the vms you want to run but the clients that access the service must be able to deal with SRV records.
    for example most ssh clients does not know how to deal with SRV records so you have to add wrapper around them to make them retirieve the port first and then connect tot hat port. here is an example wrapper
    https://gist.github.com/taylor/1372925

    Thanks

  • @Hani said:
    There is 2 different ways of doing it for incoming traffic

    1- through reverse proxy like nginx as VPSSoldiers mentioned:
    The cons of this is that nginx only work with tcp based services and will not forward any udp based service.
    you have to configure your clients to connect to port 80 of the domain you want

    2- through DNS SRV records :
    by that way you can specify the port per application per domain for the vms you want to run but the clients that access the service must be able to deal with SRV records.
    for example most ssh clients does not know how to deal with SRV records so you have to add wrapper around them to make them retirieve the port first and then connect tot hat port. here is an example wrapper
    https://gist.github.com/taylor/1372925

    Thanks

    Yes, I just assumed that the traffic would be 80/443.

  • Just install nginx in a VM and do reverse proxy to the internal IPs based on hostname<>nat IP matching, few lines tops.

    You can even run SSL for all of them by using SNI.

Sign In or Register to comment.