How to configure ips for multiple servers linux/windows hosting

This is for discussing general topics about how to use VirtualBox.
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

you don't need 4 nics in bridged mode, all you need is 1 nic, but yes you do need multiple ips,
i can have 20 ips and 1 nic and bridged mode will work fine


yes i thought that's how it worked, i thought all you needed is 1 ip (89.123.123.123) and the virtualbox would be smart enough to redirect the traffic into the correct vm server sub ips(10.0.2.16)

because on my real server, i only have 1 ip and 1 nic, and have 10 domains and with the same ip, when they all go to my server, my server is smart enough to re-direct the domain to the correct website


even now with virtualbox, i can do the same and it works fine,

see in my photo below, i am running windows server 2012,
main ip 89.123.123.123
port 80 is open on router and forwarded to 192.168.1.104
vm ip 192.168.1.104
bridged network
both websites are running on port 80

and both websites work fine, even my domains have the same ip, because when the ip hits the sever, the server is smart enough to re-direct the domains into the correct website,
i can have as many websites as i want using the same ip and 1 nic

Image




the problem is when i turn on a second vm server,
if i turn on the second server, win2012 clone, virtual box is not capable of re-directing the domains into the correct vm server because they are SEPARATE servers


Bill's solution does not work, i have tried virtualbox Nat and port forwarding/different ports, and it does not work because virtualbox isn't capable of telling the domains on port or which server to go to
it only works if you have 1 vm server, and not SEPARATE vm servers,


u can try it yourself, but i am willing to bet money its not possible, nat does not work for SEPARATE vm servers using only 1 ip
Last edited by vm_guy on 6. May 2017, 14:41, edited 1 time in total.
Perryg
Site Moderator
Posts: 34369
Joined: 6. Sep 2008, 22:55
Primary OS: Linux other
VBox Version: OSE self-compiled
Guest OSses: *NIX

Re: How to configure ips for multiple servers linux/windows hosting

Post by Perryg »

because on my real server, i only have 1 ip and 1 nic, and have 10 domains and with the same ip, when they all go to my server, my server is smart enough to re-direct the domain to the correct website
There is the real problem. You think using VirtualBox is the same as running on one server when in fact they are separate servers. Look at this as having 3 different servers with different domains. Just as on metal you would need to do more to make them communicate with each other since they are using different hardware and operating systems. So ask yourself how would you solve this if it were three different servers running on a LAN. The solution is the same.
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

i would have no need for the severs to talk with each other if i had 3 separate servers as i would have 3 ips

the only reason i want to run 4 vm servers or more from virtualbox, is so that i can stop using my 4 real severs, and do everything from 1 server
because i can't do that now, my isp gives me only 3 ips, so i can only run 2 servers, 1-my desktop and 2 servers,

technically, if i use my router i can run 10 servers since i have 10 real servers

but the whole point of me trying virtualbox is so i dont have to use 10 real servers, i could use 2 servers and 5 virtual servers inside those 2 servers

if i had 10 ips i wouldnt care and just use 10 servers, but i also dont have much space left running 10 severs in my room


i think vm ware esxi is capable of doing this, isnt it? but its not free, i also heard about proxmox, its a linux virtual box,



and yes, i thought virtualbox would act as 1 big sever





i thought virtualbox would have this capability, i hope the virtualbox team adds this feature in the future,

they can call it, "port forwarded to the correct virtual server when using separate servers)"
BillG
Volunteer
Posts: 5104
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to configure ips for multiple servers linux/windows hosting

Post by BillG »

I give up! It is like talking ta a brick wall.
Bill
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

BillG wrote:I give up! It is like talking ta a brick wall.


you missed my post, i said i did try your solution but it does not work, i think you are mistaken
BillG
Volunteer
Posts: 5104
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to configure ips for multiple servers linux/windows hosting

Post by BillG »

You are missing the basic point about port forwarding, even though it has been pointed out. If the machines have different public IP addresses, you can use the same port number for HTTP on all systems. The IP address determines which server is addressed. If you use the same public IP address for all HTTP connections you have to use some other way to differentiate them. You do that by using a different port number for HTTP on each server. You then forward these ports through NAT.

Set server 1 to use port 8081 for HTTP and server2 to use 8082. Forward these ports in NAT. From a machine on the Internet try to contact a web server using http://publicIP:8081 or :8082 .
Bill
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

Dear Bill sir,

I understand what you mean, but the problem is, it doesn't work correctly

please listen carefully i will explain


I have linuxOS installed on a desktop, on that desktop i installed virtualbox
i made 2 virtual machines on virtualbox
desktop ip: 89.123.123.123


vm1 - running linux server
--settings: 10.0.2.15, listening on port 80, mydomain1.com
---vm nat setting forward port 80

vm2 - running windows server
--settings: 10.0.2.16, listening on port 8080, mydomain2.com
---vm nat setting forward port 8080


both domains pointing to 89.123.123.123



for mydomain1.com: when i type mydomain1.com in the browser it goes to the correct website, there is no problems here

for mydomain2.com: this one has many problems
-----when i type mydomain2.com in the browser, it goes to the mydomain1.com website(this is bad)
----when i type mydomain2.com:8080 it goes to the correct website(this is good)

But this is a big problem, because when someone types mydomain2.com it goes to the mydomain1.com website, except it says mydomain2.com in the browser, its very confusing for people, no one will remember to put 8080 in browser, and when they see server 1 website, they will feel confused,


So you can see, yes i have have 2 virtual server machines on the same virtualbox application, but they don't work well together


it would be great if both virtual server machines could work off port 80, since they can't, it would be great if the second domain would work correctly,
if i type mydomain2.com, shouldn't i get a blank error and not go to the other server? why can't virtual box re-direct it to the correct server,
even if i type 8080 it doesn't work,


can you please tell the developers about this bug, that way, they can fix it, or even better maybe they can make both servers work off port 80, and domain work correctly,
i believe it is possible!! virtualbox should be smart enough to handle this, and i believe the developers are smart enough to accomplish this also,

because i don't really want to put :8080 in the domain, it doesn't look professional.
Last edited by vm_guy on 13. May 2017, 05:57, edited 1 time in total.
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

deal bill sir,


here are the blueprints of how i think it should work


as you see in my photo,

1. the same domains go to the virtualbox application
2. the virtual box application is smart and tells the domains which server to go to,
3. the domains arrive at the correct server,
4. everyone is happy
2servers.png
2servers.png (15.36 KiB) Viewed 4191 times

this is how it should work, both on port 80, and we don;t need :8080 on the domains,
BillG
Volunteer
Posts: 5104
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to configure ips for multiple servers linux/windows hosting

Post by BillG »

No, that is not how it should work. That is how you would like it to work.

The way it works is exactly how it works with physical machines. It is a basic function of TCP/IP.

Perhaps you should look at the topic of host headers. That seems to be what you want, not port forwarding.
Bill
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

i will look into host headers and report back to see if it works or not

thanks,
vm_guy
Posts: 49
Joined: 16. Apr 2017, 18:42

Re: How to configure ips for multiple servers linux/windows hosting

Post by vm_guy »

i ended up doing what i wanted, im surprised no knew about it, i went on another forum and they told me what i needed to do,

so they told what i needed to do was make a virtual machine and turn it into a "reverse proxy"


that's exactly what i did, made a centoOS virtual machine, install nginx, and then configured it to re-direct the ips to the correct virtual machines

easy as pie!
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: How to configure ips for multiple servers linux/windows hosting

Post by socratis »

vm_guy wrote:they told what i needed to do was make a virtual machine and turn it into a "reverse proxy" ... im surprised no knew about it
You ended up using a virtual router. That was the very first suggestion made...
Perryg wrote: Just as on metal you would need to do more to make them communicate with each other since they are using different hardware and operating systems. So ask yourself how would you solve this if it were three different servers running on a LAN. The solution is the same.
Perryg wrote:VirtualBox deals with hardware and not configuration issues.
Perryg wrote:You can work around this but that is not within the scope of this forum
BillG wrote:If you really don't want to run a router, physical or virtual...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply