I know the question is vague and I’m a newbie when it comes to networking, so let me give you all the details:
My current setup is the following:
A) Physical server running Windows 10, referred to as Host below
B) Virtual Machine under Hyper-V running Ubuntu 18.04
C) Web Application, ERP (Odoo) deployed on Ubuntu 18.04 VM
D) Softether VPN Server running on Host (A, above)
E) Linksys Modem/Router connected directly to the ISP, assigned a private IP by the ISP (192.168.1.1) and distributing the connection among all connected devices creating a local network
The current setup is fully functional and I am able to access the web application (C, above) in the Host’s browser by typing the VM’s (B, above) IP address and specifying the designated port. So no problem here.
I have chosen to test the VPN tunnel on my local network, so when the Host (A, above) is connected to the local network, I am able to access it via VPN on any other device on the local network. So no problem here either.
However, once the Physical Server is connected to the local network (either by LAN directly to the router, or through wifi), the router (E, above) gives it a private IP address (192.168.1.33) and understandably, the VM is assigned an IP address by the same router as though it is a unique device connected to the local network (so 192.168.1.34).
I have created a Virtual Switch in Hyper-V, bound to the hardware network adapter of the Host in order to give the VM access to the Internet.
The problem is that I am obviously able to connect to the Web Application with no security whatsoever and on any device connected to the local network, just by typing the IP address of the VM and the designated port, regardless of whether said device is connected to Host via VPN or not.
My goal is to be able to gain access to the Web Application if and only if I am connected to the Host via VPN. In other words, how can I make the VM part of sub-network on the Host?
Thanks for your help and I apologize in advance for the misuse of technical terms.
P.S: I can provide more information, I just don’t know what you will need to be able to help