Can't access smb shares

This forum is for general conversation and user-user networking.
Post Reply
esso82
OpenVpn Newbie
Posts: 4
Joined: Fri Aug 10, 2018 7:46 pm

Can't access smb shares

Post by esso82 » Sat Aug 11, 2018 9:41 am

Hi guys,

I am trying to set up OpenVPN server on my home server running Debian 8 to serve Raspberry Pi3 running LibreElec.

On RPi I have add-on VPN Manager by zoomboid, where I imported .ovpn file I created, all good, but I can't access smb share on my home server. I tried to use the same .ovpn file on my windows 10 laptop and there, I am able to access the smb share maped from my home server, but the very same .ovpn file imported to the RPi only gets expected IP address from range 10.8.0.0/24 but if trying to add source via file manager, smb://192.168.0.200/Data says "No route to host".
ssh into RPi, route says:
Kernel IP routing table

Code: Select all

Destination	Gateway		Genmask			Flags	Metric	Ref	Use	Iface
default		dir-615		0.0.0.0			UG	0	0	0	wlan0
10.8.0.0	10.8.0.5	255.255.255.0		UG	0	0	0	tun0
10.8.0.5	*		255.255.255.255		UH	0	0	0	tun0
192.168.0.0	*		255.255.255.0		U	0	0	0	wlan0
192.168.0.1	*		255.255.255.255		UH	0	0	0	wlan0
So what I aim to do is:
I don't need to redirect all traffic via vpn, in fact, I need to keep the IP of local inet provider, I just need to access that single smb share on remote network, where OVPN server runs, so I can play media shared from the server on remote network on local network, where RPi sits
network where server (with that smb share) runs: 192.168.0.0/24, accessed via internet from completely different country
local network, where ovpn client (Rpi LibreElec) runs is also 192.168.0.0/24

Could anyone please help me configure server.conf or/and client.ovpn to reach my (what looked like very simple) goal?

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 4886
Joined: Fri Jun 03, 2016 1:17 pm

Re: Can't access smb shares

Post by TinCanTech » Sat Aug 11, 2018 12:37 pm

So,
  • NOTE: your local LAN uses the extremely common subnet address 192.168.0.x or 192.168.1.x. Be aware that this might create routing conflicts if you connect to the VPN server from public locations such as internet cafes that use the same subnet.
:arrow: Never use 192.168.0.0/24 or 192.168.1.0/24 (or other common subnets) for your OpenVPN Server LAN :!:
  • You are advised to change your server LAN to a more unique RFC1918 compliant subnet.
    For example: 192.168.143.0/24

esso82
OpenVpn Newbie
Posts: 4
Joined: Fri Aug 10, 2018 7:46 pm

Re: Can't access smb shares

Post by esso82 » Sun Aug 12, 2018 9:03 am

OK, thank you for advice, I never thought I'll need to vpn these two private home networks, that's why I set both to 192.168.0.0/24 subnets, they were ment to be just small home networks on their own. So I'll try to change the network addressing on the server side, when I'll have access, will see what it does.
Still, it's weird that it runs as expected on the win10 laptop, but not on the RPi running LibreElec...

User avatar
TinCanTech
OpenVPN Protagonist
Posts: 4886
Joined: Fri Jun 03, 2016 1:17 pm

Re: Can't access smb shares

Post by TinCanTech » Sun Aug 12, 2018 5:44 pm

esso82 wrote:
Sun Aug 12, 2018 9:03 am
it's weird that it runs as expected on the win10 laptop, but not on the RPi
Maybe it doesn't work at all and you are mistaken.
esso82 wrote:
Sat Aug 11, 2018 9:41 am
Could anyone please help me configure server.conf or/and client.ovpn to reach my (what looked like very simple) goal?
HOWTO: Expanding the scope of the VPN to include additional machines

HOWTO: Request Help ! {2}

MikeRobinson
OpenVPN User
Posts: 16
Joined: Fri Aug 03, 2018 1:46 am

Re: Can't access smb shares

Post by MikeRobinson » Mon Aug 13, 2018 2:31 am

There really are two separate issues here . . .

When you are directly connected to an OpenVPN server as a logged-in user, you will find that you are assigned an IP-address in the 10.8.0.x subnet. (In the case at bar, the server assigned you address #5.) Therefore, your Windows machine will see incoming network traffic from that IP-address range ... not from the IP-addresses now in use at your local coffee shop. So:
  1. Your local router might see traffic bearing these IP-addresses, and it must know to send that traffic to your local OpenVPN server-machine's IP "as a gateway." (You'll need to arrange for that machine to have a predictable local-IP.)
  2. Your server-machine's properly suspicious software firewall must permit the traffic to pass.
  3. Your server's file-sharing daemon also must not refuse activity coming from these addresses.
But meanwhile, the address range of the services being accessed, from your perspective within that coffee-shop, is still 192.168.0.x, and this is an obvious address-range conflict. A basic tenet of "all TCP/IP routing" – and here, OpenVPN is simply acting as a router – is that all IP-address ranges on the total combined network must be unique. "192.168.0.11" (say ...) can't refer simultaneously to your home-network and to the computer that's being used by that weirdo in the corner of the shop. Each address must have one, and only one, "route to its destination." Therefore, if you anticipate accessing "your home network" from anywhere-else, reconfigure your home router to dole-out private-network addresses that are not 192.168.0.x. Now, OpenVPN will be able to construct a rule that will send the traffic that is destined for this now-unambiguous address range through the tunnel.

esso82
OpenVpn Newbie
Posts: 4
Joined: Fri Aug 10, 2018 7:46 pm

Re: Can't access smb shares

Post by esso82 » Mon Aug 13, 2018 8:52 am

Thank you for replies guys. But I still believe, that configuring the two networks with identical subnets shouldn't be a problem in my case. The problem is with LibreElec, just don't know where. Maybe I'm missing something in the server configuration from the Windows10 vs. LibreElec point of view. Because:
TinCanTech wrote:
Sun Aug 12, 2018 5:44 pm
Maybe it doesn't work at all and you are mistaken.
Yes, I'm sure it works. My laptop gets an address from the VPN pool which is 10.8.0.0/24 and I can browse and read/write the already mapped smb share. I also tried to map the same smb share again, browsing the remote network worked like a charm.
So, as I said, it works when connecting from windows laptop, but it doesn't work when connecting from LibreElec

EDIT:
Reading the OpenVPN log in KODI, it says:

Code: Select all

ERROR: Linux route add command failed: external program exited with error status 2
I reckon that might be a clue where to look, but I don't know where...

esso82
OpenVpn Newbie
Posts: 4
Joined: Fri Aug 10, 2018 7:46 pm

Re: Can't access smb shares

Post by esso82 » Mon Aug 13, 2018 1:57 pm

OK, you were right. I changed the local subnet from 192.168.0.0/24 to 192.168.101.0/24 and it works now. Funny that windows managed to do it right, LE on the other hand was looking for IP from local network instead of looking for IP from remote network via tunnel.

Anyway, it works now, thanks for directing me the right way ;)

Post Reply