Remotely access SMB folders

Max90

Explorer
Joined
Nov 21, 2020
Messages
75
Try sysctl net.inet.ip.forwarding=1, please.
You should be able to connect to SMB at 192.168.1.20, then, even over OpenVPN.

If that makes it work, you can set a tunable in "System > Tunables":
  • type: sysctl
  • name: net.inet.ip.forwarding
  • value: 1
So the setting will be permanent across reboots.
I launched the command from ssh but I still have the problem from the smartphone connected via openvpn..
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Does your OpenVPN client have a default route into the tunnel?
 

Max90

Explorer
Joined
Nov 21, 2020
Messages
75
Does your OpenVPN client have a default route into the tunnel?
how do i see it? I don't know how to answer you.
I created the openvpn server and client from truenas and generated the key. Once imported into the openvpn app it makes me connect.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
There's probably an option in the OpenVPN client. Never used Android, sorry.
 

Max90

Explorer
Joined
Nov 21, 2020
Messages
75
There's probably an option in the OpenVPN client. Never used Android, sorry.
No, there is only one entry after you have imported the key which is called server override.
maybe it must be set by truenas before generating the key? maybe I got some settings wrong ..
 

Max90

Explorer
Joined
Nov 21, 2020
Messages
75
possible that no one has ever configured the vpn? no one who can help me ..
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Never on TrueNAS and never with Android, sorry.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
OpenVPN ... server on my OPNsense, client on my Mac. I don't work from mobile devices. When I need to "access stuff" I have my Macbook pro with me. Always.

Now replaced by WireGuard. But I did have OpenVPN running, just not on TrueNAS.

Then there's Nextcloud, if it's just files ...
 

Alecmascot

Guru
Joined
Mar 18, 2014
Messages
1,177
it seems strange to me that no one does. How do i get to my network folder when i'm off the lan? ...
I have ovpn server running on the router and access file shares from the NAS on my android phone using an SMB capable filemanager and using the NAS ip address.
 

Max90

Explorer
Joined
Nov 21, 2020
Messages
75
I have ovpn server running on the router and access file shares from the NAS on my android phone using an SMB capable filemanager and using the NAS ip address.
that's what I'm trying to do. Instead of using the router I am using truenas, but obviously I am doing something wrong..
maybe i need to open some other ports on the router to use SMB?
connected in wifi, if I ping from Android the server where the network folder is located responds.
If I ping the data network and connected in vpn it does not respond. So there is some routing problem or unopened ports ..
 
Last edited:

lorinom

Cadet
Joined
Mar 14, 2022
Messages
9
I hate to revisit a past post, but I'm looking for help with a similar issue. I use Pfsense as my router and have OpenVPN running on it. I can successfully connect to the home network and can ping all internal network devices, including the TrueNAS server, but I cannot access the SMB shares when remoted in via OpenVPN. I can log into the TrueNAS server via a browser tab while remotely connected via OpenVPN, but cannot access the shared drives. I'm doing this from a windows PC. Anyone know how I can fix this? Thanks in advance!
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
What happens when you enter \\<ip-address-of-truenas>\<name-of-some-share> into that Windows search box or the Explorer address bar?

Yo will not be able to browse the shares in "network neighborhood" across a VPN connection.
 

lorinom

Cadet
Joined
Mar 14, 2022
Messages
9
Thanks Patrick. It does allow me access to the shares that way...however my mapped drives in Windows Explorer still do not work. I get the following error message:

"The local device name is already in use. The connection has not been restored."

Also, when I click to map a new drive, it does not even show the TrueNAS server despite being connected to the network via OpenVPN. I suppose this is what you mean by not being able to browse shares in network neighborhood?

Is there a workaround to allow mapped drives to work? This worked perfectly when I was using a Netgear ReadyNAS, and only when I started using TrueNAS did mapped shared drives no longer work when VPNed into the local network.

Many thanks!!!!
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
How precisely did you map them? What host/servername?

truenas.local won't work. You can delete the mappings and recreate them using the IP address instead. Or make sure via your local DNS - in your router probably - that there is a consistent hostname that always resolves to the IP address of your NAS. And of course configure the VPN to use that same DNS server like when you plugged into your home LAN.
 

lorinom

Cadet
Joined
Mar 14, 2022
Messages
9
How precisely did you map them? What host/servername?

truenas.local won't work. You can delete the mappings and recreate them using the IP address instead. Or make sure via your local DNS - in your router probably - that there is a consistent hostname that always resolves to the IP address of your NAS. And of course configure the VPN to use that same DNS server like when you plugged into your home LAN.
Hi Patrick! Thanks for the insightful information. You definitely enlightened me that there are numerous ways to map shared drives. Until now I had always just hit the "Browse" button next to folder name and selected the network device which I now know only maps based on network name (in this case it mapped as \\TRUENAS\). Apparently, that created issues. I now mapped directly to the IP address which seems to resolve the issue.

My TrueNAS server is on a dedicated IP which never changes, therefore anytime I now VPN into the network I should have direct access to the shared drives using the IP assignment. I've never had any issues not being able to ping (or see) the IP behind the firewall.

I did take your advice and checked the DNS settings and found something interesting...which I'd appreciate any further guidance/feedback.

In my pfsense DNS settings, under DNS Resolution Behavior I have it set to "Use remote DNS settings, ignore local DNS" and have 8.8.4.4 and 8.8.8.8 set as my DNS server(s).

However, under the OpenVPN settings in pfsense I have DNS default domain checked so that a default domain is provided to OpenVPN clients. Also, DNS Server is enabled so that my pfsense server provides DNS services to clients. SEE ATTACHED SCREENSHOTS

I suspect this may have been causing part of the issue I was having. Should I change the OpenVPN DNS settings? If so, how?
 

Attachments

  • Screenshot 2022-10-07 130850.jpg
    Screenshot 2022-10-07 130850.jpg
    193.2 KB · Views: 100
  • Screenshot 2022-10-07 131008.jpg
    Screenshot 2022-10-07 131008.jpg
    271.6 KB · Views: 110

Glorious1

Guru
Joined
Nov 23, 2014
Messages
1,211
There is an alternative approach that does not rely on openVPN and is arguably just as secure.
 

lorinom

Cadet
Joined
Mar 14, 2022
Messages
9
There is an alternative approach that does not rely on openVPN and is arguably just as secure.
Thanks for the link, although I don't see any advantages to this method over using OpenVPN. Would I still be able to print to the local printer after connecting into the network this way? What about accessing other devices and services behind the firewall not connected to the TrueNAS box?
 
Top