How to open access to the server installed from the image on the virtual machine?

Evgenii Roldugin Posted in Technical Support 5 years ago

Hi! Have ip in vmware 192.168.0.111 for OSSN and host pc have 192.168.0.113, connect to network from quest is "bridge". In DHCP router ip host and quest are constant, from local network connection to OSSN have be established but from internet no. Use portforwarding on port 3389 to ip 192.168.0.111 but still no effect. How connect to OSSN from internet? Use Vmware 12 and router TL-WR841N

Replies
Russian Evgenii Roldugin Replied 5 years ago

Yes, ngrok help! Unbelievable how i glad! Big thanks guys!

us Rishi B Replied 5 years ago

Actually, you SHOULD be able to run ngrok on either one, but personally I run it on the host (which runs windows 10 on my setup). There is a version of ngrok for Linux though, so you could also run it on the guest OS, assuming your network settings are configured correctly for you to make outgoing internet connections on the guest os. If you want to do that, you don't need to specify the IP that the guest os has. You would just run:

ngrok http -hostname=myhostname.com 80

The reason I prefer to run ngrok from my host machine is because I have other webservers running on that machine (on windows) for which I use ngrok, and it's a lot more convenient for me to define all my tunnels in a single config file and then run ngrok. You can find info on specifying multiple tunnels + using config files in the docs at http://docs.ngrok.com

Russian Evgenii Roldugin Replied 5 years ago

Thx! It`s really pain, ngrok for VMware quest or host machine?

us Rishi B Replied 5 years ago

As Arsalan said, we don't know how your network is set up. If your router/network properties of vmware are correctly setup, the vm image pretty much works right out of the box (I'm also using the vm image, via vmware on win10x64). First check if you're able to access your ossn site from the machine running vmware/virtual box (not from within the virtual machine). For example, if your IP for the virtual machine is 192.168.0.111, first make sure you can access this from the host machine (for testing purposes, you may want to temporarily set your ossn config to use this private IP url, i.e. http://192.168.0.111). Once you verify that you're able to access the site through a privateIP, you just need to route requests from the Internet to that IP appropriately. This can be accomplished with port forwarding, but in my experience, it doesn't always work and is a real pain to get working with vmware. A much easier solution is to use a reverse proxy to make your private IP internet-accessible, which can accomplished very easily using a reverse proxy such as ngrok, localtunnel, serveo, probably some others I'm missing. I use ngrok and it's really easy to set up, you can either use it with a custom hostname (read the docs at ngrok.com for further info on setting up custom hostnames, this allows you to use your own domain name) or will assign you a random subdomain address under *.ngrok.io. One advantage of this solution is that ngrok also provides https urls, even if your webserver isnt set up to serve over ssl. This is useful for things likr webhooks that today usually require https urls. This is the command I use to start ngrok:

ngrok http -hostname=myhostname.com 192.168.45.128:80

You can find more info on that particular reverse proxy at ngrok.com. you may also wanna check out serveo.net and localtunnel.me.

Russian Evgenii Roldugin Replied 5 years ago

Yes, everything works fine within the local network, but there is no access from the Internet, when i port forwarding from the router to the local network, the network is redirected to the local network ip (for example, virtual machine address 192.168.0.111, Internet address 84.63.56.72 of the physical machine and in virtual machine too, I do the redirection in the router from port 6565 to the address 192.168.0.111) it should turn out that when entering 84.63.56.72:6565 it will redirect to 192.168.0.111 but it`s no working. It seems to me that VMware does not listen on the ports or the router does not correctly redirect

Indonesian Arsalan Shah Replied 5 years ago

We are not sure about how router works, if VM shows ip using ifconfig 192.168.0.111 then you should try to visit 192.168.0.111 from your browser and it should show you a social network.

Further you may make sure the apache is running in your VM.