Page 1 of 1

How can i make virtual box to communicate to the outside world

Posted: 17. Oct 2020, 17:05
by boringDog
So i am a total newbie (with huge intentions on learning).

I have set up active directory and ldap on my windows 2016 virtual server.

Now i wanna test ldap with a real website that asks for hostname , port but obviously the virtual server is hosted locally .

So my question is what should i read / how can i make this work so my localhost acquires real ip and port and is accesable to the internet ?


Thanks in advance.

Re: How can i make virtual box to communicate to the outside world

Posted: 17. Oct 2020, 18:41
by scottgus1
Always think of the VM as another PC. How would you get a new PC onto the internet? By connecting it to your internet-connected Ethernet LAN.

In Virtualbox, connecting the VM "PC" to the LAN is through Bridged. When a VM is connected through Bridged, it connects directly to the Ethernet network, like the host PC and all the other PCs on the network.

One possible problem would be if your host PC connects to the LAN through Wi-Fi. Bridged does not always work over Wi-Fi. See Virtualbox Networks: In Pictures: Bridged Adapter.

Re: How can i make virtual box to communicate to the outside world

Posted: 17. Oct 2020, 22:49
by boringDog
Hello, thank you so much for your reply . After i switch to bridge i get the yellow pyramid sign and no internet on my vm.
I am connected to the internet with ethernet on my main laptop which i created the virtual box.
From this image i see that the virtual ipv4 address hasn't get one from my router . I checked on my routers interface and DHCP is enabled(i have lots of devices connected and works fine)

Re: How can i make virtual box to communicate to the outside world

Posted: 18. Oct 2020, 00:56
by BillG
That is a NAT address. Are you sure you set it to bridged mode?
Bridge.PNG
Whether you are in a virtual or physical setup, a DC should always have a static IP. It should also have its own DNS server. It should never get its network config from a NAT router.

If you are serious about connecting your domain to the Internet, you have a bit more work to do. First off, I would recommend that you run your domain in an internal network, not NAT or bridged (just as you would set up a physical domain on its own network). All the domain members are in the same network and use the DC as their DNS server. You can do this manually or you can run your own DNS server on the DC.

If you want to connect that domain to the Internet, set up another vm to act as a router between you domain network and the physical network (and thence to the Internet). This vm would have two interfaces, one in your private LAN to act as the gateway for you domain network and one bridged to a NIC in the physical LAN. This one can use DHCP to get its config from your LAN router.

If you want your domain machines to have access to an Internet DNS service, add a forwarder to 8.8.8.8 or 4.2.2.2 to the DNS server on your DC. It can then resolve URLs for itself and its clients.

To successfully run a domain using vms and virtual networks, you have to use the same methods as you would use to set up a domain on a physical network. There are no magic shortcuts. The networking protocols and the AD limitations still apply.

Re: How can i make virtual box to communicate to the outside world

Posted: 18. Oct 2020, 10:07
by boringDog
Hello , i restarted the virtual server and it worked. I just want to do testing don't think of it as hosting a real life website on my virtual machine.

The real life domain i want to test on is also mine running on a a virtual private server and i just wanna play on how a real life website on a vps can interact with a virtualbox server .

Thank you for taking the time on reading this . I may post more things if i stuck again :)

Thanks everyone who contributes in this great project.