rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: MoTivE on March 17, 2021, 03:06:35 PM

Title: Running HFS Behind A VPN
Post by: MoTivE on March 17, 2021, 03:06:35 PM
Hi all,

Hope everyone is keeping well,

I wanted to know how I could access my HFS server if I have a VPN connected as it seems once I activate my vpn the external ip address that HFS then detects (from the vpn) does not actually connect to the server anymore ? why is this happening..  >:(

Is there way to get this working as it would be good to have as it would provide encryption while also hiding your real ip address publicly.

Thanks in advance!
Title: Re: Running HFS Behind A VPN
Post by: Mars on March 18, 2021, 01:26:13 AM
When you are connected to a VPN, your machine is no longer visible on your local network,

for hfs to be visible on the web again, the remote user would need to connect to the VPN provider's IP address and activate a port forwarded to your machine, this is a situation that does not seem to have a solution,

 the VPN should only affect your browser, other programs using your router directly
Title: Re: Running HFS Behind A VPN
Post by: MoTivE on March 18, 2021, 11:39:01 AM
Ah ok thats a shame, well thank you for explaining anyway!
Title: Re: Running HFS Behind A VPN
Post by: danny on March 19, 2021, 10:33:23 PM
The problem is similar to Carrier Grade Nat (aka double-nat); so the work-arounds for that (such as pagekite) should also work for VPN. 
Title: Re: Running HFS Behind A VPN
Post by: Mars on March 20, 2021, 03:03:56 AM
Several situations can approach the solution

How to: Accessing Local Network Resources While Using VPN
https://community.spiceworks.com/how_to/113798-accessing-local-network-resources-while-using-vpn

https://windowsreport.com/vpn-split-tunneling-windows-10/

https://superuser.com/questions/166555/how-to-use-one-connection-to-the-internet-for-vpn-and-another-for-accessing-othe
Quote
Follow these steps to set up a VPN connection in Windows Vista that uses split tunneling:

    From the Control Panel, choose "Network & Internet."
    Click "View Network Status and Tasks."
    Click "Manage Network Connections."
    Right-click on your VPN connection and select "Properties."
    Select the "Networking" tab.
    Highlight "Internet Protocol Version 4 (TCP/IP v4)."
    Click "Properties."
    Click "Advanced."
    Uncheck the "Use default gateway on remote network" box.
    Click "OK" three times to close the windows you opened.

From that point forward, only traffic destined for your corporate network will be sent through the VPN. All other traffic will use the local network.

https://apple.stackexchange.com/questions/134766/using-vpn-and-wifi-at-the-same-time
Quote
In Network preferences, choose your primary interface, and hit Advanced.... For me, this was wi-fi, but the same thing should work for ethernet, etc. Whatever you normally use to connect to the internet

In the DNS tab (where you may already have entries), add the VPN DNS. Also make sure that your main DNS(s) are there. Then, add the VPN domain into the search domains box.

Example:

VPN settings http://elibaum.com/img/Screen%20Shot%202014-06-18%20at%2021.18.22.png

Here, 10.0.1.1 is my home wifi router, which in turn routes to my ISP's DNS servers. 10.8.1.22 is the local DNS server on the VPN.

So, if I request www.google.com, the request is sent to my router, whether or not I am on VPN.
However, if I request server while on the VPN, the primary DNS fails, and moves on to the next nameserver. However, since this nameserver (10.8.1.22 in my case) is on the VPN's subnet, traffic is automagically routed to the VPN. The search domain field example.com transforms server into server.example.com, and the DNS lookup succeeds.

Important Note: this workaround requires that your primary DNS fails on non-existent domains — that is, your ISP is not doing DNS hijacking. If they are, switch to OpenDNS, Google Public DNS, etc. Also see my related question: https://superuser.com/questions/766713/what-is-67-63-55-3 in which I sorted out DNS hijacking in relation to this problem.

Is this enough to allow hfs to be visible from the internet through the local router, that remains to be seen

it is possible to assign several ip to the network card of a PC, is one of them able to override the VPN, it remains to be tried
Title: Re: Running HFS Behind A VPN
Post by: patriciafoster on June 03, 2021, 07:30:21 AM
Can you ping any other devices by hostname? It sounds like the DNS settings for your VPN are setup incorrectly, you need to set it up so that points to the local DNS server when connected.