You are not logged in.

#1 2012-09-16 12:05:06

twarkie
Member
Registered: 2007-09-16
Posts: 24

[Solved] Re-export samba share with NFS or SMB

TL;DR: how can reshare a Samba mount using NFS (or Samba)?

Long version:

My media player needs to access a samba share that is available behind an OpenVPN server. Problem is that the media player has no way of connecting to the VPN server. So I have my arch server for that. My first idea was to mount the samba share on the server, and then reshare it using SMB or NFS so that the media player can access it. I have tried both protocols but I end up with empty folders (the share is shown, but the content is empty). Can I make this work some how?

What I've tried:
* Both NFS and SMB
* Disabled oplocks in Samba
* Tried sharing a symlink to the mounted folder

What else can I try?

Edit:

Hm, thought of something. Can I somehow proxy the connections using iptables? So all smb connections to my arch servers gets sent throught the VPN to the remote server?

Edit 2:

Solved! But it's not the prettiest solution:

iptables -t nat -A PREROUTING -p tcp --dport 137 -j DNAT --to-destination xxx.xxx.xxx.xxx:137
iptables -t nat -A PREROUTING -p tcp --dport 138 -j DNAT --to-destination xxx.xxx.xxx.xxx:138
iptables -t nat -A PREROUTING -p tcp --dport 139 -j DNAT --to-destination xxx.xxx.xxx.xxx:139
iptables -t nat -A PREROUTING -p tcp --dport 445 -j DNAT --to-destination xxx.xxx.xxx.xxx:445
iptables -t nat -A POSTROUTING -j MASQUERADE

Where xxx.xxx.xxx.xxx is the IP to the server behind the VPN-server.

Last edited by twarkie (2012-09-17 05:01:42)

Offline

Board footer

Powered by FluxBB