Can vmware esxi do this? multiple & different OS at the same time?

Discussion in 'Virtualized Computing' started by multi-tasking_guy, Dec 20, 2017.

  1. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    currently i have 2 servers at home, but instead of using 2 servers i just want to use 1 server, because having 2 servers is overkill, i have windows serverOS on one server and linux serverOS of the other

    the servers are just for getting experience and learning



    i can easily install both websites on 1 server, but that means i would either have to pick to use windowsOS or linuxOS

    i want to use both at the same time,

    so that means both websites will have the same IP


    so, when someone types in www.t-shirt-shop.com or www.my-dog-website.com, the server will direct the domain to the correct virtual machine

    this would save me from running 2 servers, and i can continue to run 2 different operating systems, which helps me learn different operating system,

    i tried virtualbox but virtualBOX can't do what i want, heres what i want, i drew a picture to help person understand better as its a bit confusing


    esxi.png
     
  2. Riouken

    Riouken Limp Gawd

    Messages:
    221
    Joined:
    Aug 28, 2015
    Yes what you need is a reverse proxy server. I have my home servers setup like that. My router directs all web traffic to the proxy server, proxy server pushes the web traffic to the correct server.

    myaddress.com/nextcloud - Goes to my nextcloud server
    myaddress.com/homeassistant - goes to my home automation server
    etc....

    I run caddy as a reverse proxy but I have used NGINX as well.

    https://www.nginx.com/resources/admin-guide/reverse-proxy/
    https://caddyserver.com/docs/proxy

    Also I dont have much experience with virtualbox but im pretty sure you can do this in it. But I have done it in Esxi and Now Zenserver(What im using Now). I just spin up the the reverse proxy server on zen give it a static ip, then point the router at it.
     
    Last edited: Dec 20, 2017
    MrGuvernment likes this.
  3. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    you said "server(s)"

    i'm just looking to have 1 server, i already have many servers, but i want to use only 1 server in total


    i think i made a mistake on my picture, here is the updated picture, as you can see those were not other servers, they were virtual machines inside 1 server

    esxi.png
     
  4. Riouken

    Riouken Limp Gawd

    Messages:
    221
    Joined:
    Aug 28, 2015
    Yes i am referring to virtual servers. I run one "Host" a dell R710 that runs xenserver bare metal. Then I virtulize the rest of my "Servers".
     
  5. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    so you are not using esxi? you said proxy server and then another server, i am confused about your setup,
     
  6. Riouken

    Riouken Limp Gawd

    Messages:
    221
    Joined:
    Aug 28, 2015
    Not anymore, Xenserver is a Virtualization platform like esxi or Hyper-V.

    I have a Physical server that I run other virtual servers on. One of those virtual servers is a reverse proxy that directs all web traffic coming in from my router to all my other web facing virtual servers

    ESXI is just software, you can do this on just about any Virtualization platform. It really has nothing to do with the bare metal virtualization.
     
  7. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    oh really! so i could probably do that with virtualbox, i always thought it was the virtual software needed to be able to do that
    so i could probably do it with any of them, virtualbox, esxi, proxmox

    i just need to setup that caddy proxy server you speak off

    so your setup looks like this,


    esxi.png



    i will have to try and see if i can setup that proxy server

    thanks!
     
  8. Riouken

    Riouken Limp Gawd

    Messages:
    221
    Joined:
    Aug 28, 2015
    Yes thats how it works. Caddy is probably the easiest to setup but it does not have as much documentation or tutorials out there like NGINX does.
     
    multi-tasking_guy likes this.
  9. 4saken

    4saken [H]ardForum Junkie

    Messages:
    12,565
    Joined:
    Sep 14, 2004
    Sounds like a good use case for Docker and Traefik or HAproxy/nginx.

    :D
     
  10. Grimham

    Grimham [H]ard|Gawd

    Messages:
    1,352
    Joined:
    Jul 20, 2004
    Maybe I don't understand fully. But it seems all you need to do is give one VM one IP address and one another, which is simply a matter of assigning them in VirtualBox or whatever you choose to use. If you don't like like the idea of a virtual NIC then throw another physical one in there. Then forward requests to the appropriate server as you're already doing. Did I read this all wrong? Because it seems you're over complicating things.
     
    Brian_B likes this.
  11. DMFD-Minister

    DMFD-Minister Limp Gawd

    Messages:
    404
    Joined:
    Jan 14, 2008
    Yes, VMware's free ESXi platform can do what you want. The only limit to the number of virtual machines on one server is the resources you have available.
     
  12. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017

    I don't have 3 ip address, I only have 2


    1 ip for my main desktop computer which i surf the internet and play games, and;
    1 ip for my server with 2 virtual machines inside

    if i had enough ips, i could easily let each vm have its own ip, but i dont want to purchase any more ips, i dont think my isp even lets me have more, and my plan is to have 7 vms in total in 1 server

    so i dont have enough ips. so my only solution is to give the 2 virtual machines internal ips and my server has the main ip


    here is my current setup
    Screenshot_2017-12-27_15-45-27.png




    as you can see the server, has the main ip, 82.xxx.xxx.xxx
    and the 2 vm's have internal ips, 192.168.1.20 and 192.168.1.21

    i put the vms on different ports

    192.168.1.20:80 -my website1
    192.168.1.21:81 -my website2


    so when someone types mywebsite1.com in the browser, it supposed to go to the server and the server tells it to go to vm 1


    thats what i was asking, im going to figure it out, by what people said here, to add a reserve proxy,

    because currently when someone types mywebsite1 and mywebsite2 in the browser, it takes them to my servers ip and into the esxi login form
    im new to esxi, so i think i have to add some sort of virtual router, i'll figure it out eventually
     
  13. Brian_B

    Brian_B [H]ard|Gawd

    Messages:
    1,830
    Joined:
    Mar 23, 2012
    Virtual router? No.

    Regular old Router? Yes.

    Virtual Machines aren't any different than regular machines, if you abstract it a bit.

    You have 2 physical machines now. You virtualize one of those, run it on a hypervisor on the other (that can be VMWare, it can be VirtualBox, it can be whatever you want - doesn't matter all that much). You still have 2 "Machines", just running on one CPU. The way you had them routed before from when they were 2 physical machines doesn't change. The VM can even have the identical IP address as the physical machine it replaces.
     
  14. Grimham

    Grimham [H]ard|Gawd

    Messages:
    1,352
    Joined:
    Jul 20, 2004
    192.168.x.x are internal (LAN) IP addresses, you can have over 250.

    Why does the traffic have to hit your server at all? Handle it in your router - forward :80 to one internal IP and :81 to another and so on...

    I really must be missing something here, and if so, I apologize. I just don't want you to have to reinvent the wheel on something that (in my mind) should be straightforward. If someone needs to set me straight I'll gladly take it though.
     
  15. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    because the domains needs to be attached to an IP, i can't attach a domain to a 192.168.1.20 address

    both domains mywebsite1 & mywebsite 2 will be attached to ip 82.xxx.xxx.xxx
     
  16. Brian_B

    Brian_B [H]ard|Gawd

    Messages:
    1,830
    Joined:
    Mar 23, 2012
    Just for the benefit of everyone here:

    You currently have 2 physical servers, one Windows and one Linux. With the intention of eventually running 2 different domains. You don't actually have that working yet though.

    So the networking aspect of it is one question. (if it's web servers, most web servers can easily handle multiple domains on a single external IP with no issue with Name Based Virtual Hosting, before you even hit something like a reverse proxy)
    Then, virtualizing it is a second question. (Get the first question working, and the answer to virtulization is "Yes, it works")
     
  17. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    I don't have 2 physical servers. I only have 1 physical server and inside that physical server are 2 virtual machines

    I have before used 1 webserver to host multiple domains, and it worked fine,

    but this time its different, It's 2 different webservers, each hosting 1 domain
     
  18. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    well, so far, i am having pretty much the same problem i got a little further than orcale virtualbox, but esxi still is giving me problems


    i got both virtual machines web servers up and running and domains working, but



    for the first domain, everything is working fine,

    but for the second domain, i have to put :8080 at the end of the domain



    my settings,

    Screenshot_2017-12-27_19-27-03.png



    typing domain
    surf2.png



    i think that what Riouken was saying at the beginning of the thread, to make another virtual machine, a reverse proxy virtual machine, will solve my problem


    on step closer!
     
    Last edited: Dec 27, 2017
  19. Biznatch

    Biznatch [H]ard|Gawd

    Messages:
    2,041
    Joined:
    Nov 16, 2009

    You can run them both in IIS with no issues on port 80, but you have to update the bindings so each site only listens for a specific host name. Delete the default website, and create 2 new IIS sites for each web site. So you'll have site 1 listening on port 80 for 'www.website1.com', and site 2 listening on port 80 for 'www.website2.com'. Any other host names will be ignored by IIS.

    If you want to keep the second site on a linux box, you can setup IIS as a reverse proxy and forward requests for that site to the linux box. No sense adding a second server to do something an existing box is already capable of.


    That will fix your current issue, but there are much bigger security concerns with how you have this setup.

    1- You absolutely need to get a firewall in front of your server. The firewall should be the only server with a public VM. Set up port forwarding so any requests on port 80 get redirected to the PRIVATE ip of the IIS server. You do not want your server completely open with a public IP, especially if you don't have it isolated in it's own DMZ

    2- You should have the binding on port 80, but all requests on that port should get redirected to port 443 with an SSL cert. It's a simple change to the web.config of each of the sites, and secures the connection between clients and your server from snooping ISPs/anyone else. ESPECIALLY if you are going to be passing secure info like logins/payment etc. You will have to add another rule on your firewall to forward inbound requests on port 443 to your IIS server as well. Then you'll need to import the certs on the IIS server and add a second binding for each site on 443.
     
    multi-tasking_guy likes this.
  20. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    thank you! i managed to get 1 server working with the proxy server

    now i am having problems getting both of them to work at the same time, i get a HTTP Error 404 not found on the second server, on the first server the website is working



    here is what i did,
    1. install centos7
    --install epel and nginx on centos7
    --open http/https port 80 on firewall centos7
    --edit the /etc/nginx/nginx.conf


    for both windows servers
    2. install windows server
    --both machines have different ip example: 192.168.1.104, 192.168.1.109
    --binded them both to their own domain website1.com and website2.com
    --both listening on port 80


    open ports
    3. port forward 80 on router on the linux vm, 192.168.1.102


    put domains pointing to ip address
    4. make both domains with the ip address, in my case it was 84.xxx.xxx.xxx





    that's pretty much it, i worked for 1 server, i can see the website, but when i tried another server, i am getting a HTTP Error 404. The requested resource is not found.


    i will continue and try to figure it out

    heres what my nginx.conf looks like

    Code:
    # For more information on configuration, see:
    #   * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    
    user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
    
    # Load dynamic modules. See /usr/share/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;
    
    events {
        worker_connections 1024;
    }
    
    http {
       server {
        listen 80;
        server_name WIN-svr1;
        location    /  {
            proxy_set_header     x-real-IP                $remote_addr;
            proxy_set_header     x-forwarded-for          $proxy_add_x_forwarded_for;
            proxy_set_header     host                     $host;
            proxy_pass           http://192.168.1.104;
        }
     
       }
     
     
         server {
        listen 80;
        server_name WIN-svr2;
        location    /  {
            proxy_set_header     x-real-IP                $remote_addr;
            proxy_set_header     x-forwarded-for          $proxy_add_x_forwarded_for;
            proxy_set_header     host                     $host;
            proxy_pass           http://192.168.1.109;
        }
     
       }
     
    
    }
    
    
    





    for some reason i cant see the second server's website, not sure if it nginx problem or wnidows,

    anyways i am getting closer!
     
  21. multi-tasking_guy

    multi-tasking_guy [H]Lite

    Messages:
    104
    Joined:
    Jun 16, 2017
    i got it working!!!!!!

    the windows vm's were giving me problems, the 404 error is a windows problem and i got no idea how to fix it, i thought it was an nginx problem,

    i setup 2 linux vms instead for my websites and boom! it worked,

    not sure why the windows servers wont work with nginx, must be something i have to set up, anyways for now, i will use linux vm's and i will eventually figure out the windows server problem

    but its working!!!!!!! 3vms, centos(nginx), centos(website1),centos(website2)


    awesome!!!!!!!!!!!!!!!!


    my nginx file looks like this:

    Code:
    # For more information on configuration, see:
    #   * Official English Documentation: http://nginx.org/en/docs/
    #   * Official Russian Documentation: http://nginx.org/ru/docs/
    
    user nginx;
    worker_processes auto;
    error_log /var/log/nginx/error.log;
    pid /run/nginx.pid;
    
    # Load dynamic modules. See /usr/share/nginx/README.dynamic.
    include /usr/share/nginx/modules/*.conf;
    
    events {
        worker_connections 1024;
    }
    
    http {
       server {
        listen 80;
        server_name website1.com;
        location    /  {
            proxy_set_header     x-real-IP                $remote_addr;
            proxy_set_header     x-forwarded-for          $proxy_add_x_forwarded_for;
            proxy_set_header     host                     $host;
            proxy_pass           http://192.168.1.110;
        }
      
       }
      
    
    

    i also added this in my /etc/hosts file

    Code:
    127.0.0.1    localhost localhost.localdomain localhost4 localhost4.localdomain4
    ::1          localhost localhost.localdomain localhost6 localhost6.localdomain6
    192.168.1.108 localhost.localdomain website1.com website2.com
    
    gonna shop around for a server or desktop that has lots of ram
    thanks everyone for the help
    solved!
     
  22. Riouken

    Riouken Limp Gawd

    Messages:
    221
    Joined:
    Aug 28, 2015
    Congratulations. Glad you got it working.
     
    multi-tasking_guy likes this.