Unable to find ideal network setup for VM


(Ben Chapman) #1

I am working with a Matrix demo on a virtual machine. Now, I can get either of these two scenarios:

  • Get an IP address that I can access Matrix on, but I can’t connect to outside hosts
  • Get an IP address that won’t load in the browser (setting it as matrixdemo.squiz.net in the hosts file), though I can connect to outside hosts (as per ‘curl’).

I am using VirtualBox with the two respective network settings:

  • Host-only adapter
  • NAT

I have tried switching through all the network options – well, most of them – but these are the only two settings that give me IP addresses.

I am at a loose end now. I can get into Matrix and design my site, but I can’t access any APIs, which are critical for me to set things up with.

I would be grateful for any help in understanding VirtualBox networking or diagnosing my set up.


(Marcus Fong) #2

This is really outside the scope of a Matrix discussion, but you can either configure your VM for bridged networking (which makes it act like a separate machine on the same network as the host computer), or use NAT and port forwarding to access the HTTP/HTTPS ports (TCP 80 and 443) on your host computer’s address.

https://www.virtualbox.org/manual/ch06.html#network_bridged - bridged networking
https://www.virtualbox.org/manual/ch06.html#network_nat_service - port forwarding

While bridged networking is easier to configure in Virtualbox, the VM then needs to obtain its IP address information from a DHCP server on your network. On a home network the DHCP server would normally be your router; on a corporate network there’s often a separate DHCP server.


(John gill) #3

FWIW, in corporate environments I find it safest to use the NAT network + port forwarding that Marcus mentioned.


(Ben Chapman) #4

Thanks for the explanation. As you suggested, I had a go with using NAT with port forwarding. My final solution was to have two network adapters, NAT with port forwarding and host-only.

So I have Matrix up and running and I can reach out to APIs and remote content.