Page 1 of 1
How to set up VM to be accessible from the Internet
Posted: 15. Mar 2017, 19:44
by alexismya2017
I need to know how to set up my VirtualBox so it can be seen on the Internet. Right now I have it set up for NAT.
I am using Gophish for my clients. They are remote. I need to have a route for my employees to be able to reach my VM from their locations in other states. Since I have Gophish set up on my machine in Virginia, I have to have a way for my employees to connect to my VM from their locations in other states. How do I do this?
Re: How to set up VM to be accessible from the Internet
Posted: 15. Mar 2017, 20:03
by socratis
Either use port-forwarding in the NAT configuration, or you change the network mode to Bridged and make it part of the network, like another computer. Of course your router has to be setup to forward traffic to the Gophish port, to the VM.
Re: How to set up VM to be accessible from the Internet
Posted: 15. Mar 2017, 20:30
by alexismya2017
Thank you for your reply. I am learning this all on my own and if given the exact instructions on how to do this I can get it done. So, you said:
"Of course your router has to be setup to forward traffic to the Gophish port, to the VM."
How do I set up the port forwarding in VM and then what do I do to the router? Detailed instructions will help me. Thank you!
Re: How to set up VM to be accessible from the Internet
Posted: 15. Mar 2017, 20:57
by socratis
I can point you to the basics, not specifics. And that as far as VirtualBox is concerned. After that you'll need to do some reading on basic network concepts. Or actually before that.
In VirtualBox the way there are two ways that you can connect to the Internet. The first is NAT:
You host with the help of VirtualBox translates the calls from the VM to access the Internet. It gets an address of 10.0.2.15, unless you manually change it (don't do it).
If you want to
be accessed from the internet, then you have to set some port forwarding rules to your Router to
forward any traffic on a specific port to the Host, and then configure the properties of the NAT network to
forward the traffic to the VM. Example at the end.
The second mode is Bridged:
Your VM is connected to the Router just like your host. It gets an IP from the Router and acts as another computer on the local network. If you want to
be accessed from the internet, then you have to set some port forwarding rules to your Router to
forward any traffic on a specific port to the VM.
Example
Say you have a webserver running on your VM. You want to access that VM from somewhere in the internet. You try:
http://<YourRoutersPublicIP>:<Port>
That request must be forwarded to the VM:
- In Bridged mode you setup your router that any traffic in <Port> (80 is the default for http but it may be occupied), will be forwarded to your VM's IP (let's say 192.168.x.x, or 10.x.x.x). Done.
- In NAT mode you setup your router that any traffic in port <Port> (80 is the default for http but it may be occupied), will be forwarded to your host's IP (let's say 192.168.x.x, or 10.x.x.x).
Then in the VM Settings » Network » Advanced » Port forwarding, you set a rule that any traffic coming to <Port>, should be forwarded to the VM (10.0.2.15 by default). Done.
Re: How to set up VM to be accessible from the Internet
Posted: 15. Mar 2017, 21:16
by Perryg
It's also worth noting that not all providers allow port 80 to be used. They do this to eliminate you using a web server over your private network. You would need to talk to them to be sure unless you want to use a different port.
Re: How to set up VM to be accessible from the Internet
Posted: 15. Mar 2017, 21:19
by alexismya2017
Thank you!