Access Samba share from different subnet

Hi I have a GL-AR300M running OpenWrt connected to my household router(virgin media). I would like people connected to the VirginMedia box to be to be able to access a Samba share on a server connected to the GL-AR300M.

OpenWrt 18.06.1 r7258-5eb055306f / LuCI openwrt-18.06 branch (git-18.196.56128-9112198)
Virgin Media 192.168.0.0
GL-AR300M 192.168.8.1

I found a post which appears to be the same issue and was resolved by setting up a redirect. Link to post

So I have the following,

firewall.@redirect[0]=redirect
firewall.@redirect[0].target='DNAT'
firewall.@redirect[0].src='wan'
firewall.@redirect[0].dest='lan'
firewall.@redirect[0].proto='tcp udp'
firewall.@redirect[0].src_dport='137-139'
firewall.@redirect[0].dest_port='137-139'
firewall.@redirect[0].name='SAMBA'
firewall.@redirect[0].src_port='137-139'
firewall.@redirect[0].src_ip='192.168.0.0/24'
firewall.@redirect[0].dest_ip='192.168.8.248'

firewall.@redirect[1]=redirect
firewall.@redirect[1].target='DNAT'
firewall.@redirect[1].src='wan'
firewall.@redirect[1].dest='lan'
firewall.@redirect[1].proto='tcp udp'
firewall.@redirect[1].src_dport='445'
firewall.@redirect[1].dest_ip='192.168.8.248'
firewall.@redirect[1].dest_port='445'
firewall.@redirect[1].name='SAMBA2'
firewall.@redirect[1].src_ip='192.168.0.0/24'
firewall.@redirect[1].src_port='445'

But I can't access the Samba share on 192.168.8.248 from the 192.168.0.0 subnet, any idea what I am doing wrong? Any help appreciated.

  • Have you permitted traffic from Zone X to Zone Y?
  • Since this rule is on WAN - please confirm this interface:
    • Is not facing your ISP; and
    • if so, that they permit SMB over the Internet

It is highly uncommon that an ISP would permit such residential traffic as those ports are common vectors for malware and rarely used for file sharing across a WAN.

2 Likes

Do not use "src_port", it does not mean what you think it means.

If the clients on the WAN side have a route to reach the SAMBA server, you do not need to use NAT but a forwarding rule. If they do not have such route, packets will never reach the router.

Is the SAMBA server configured to accept connections from the WAN range?

3 Likes

@lleachii I'm not trying to access from outside the ISPs router. Let me try to explain, I have router1 which includes a modem running the ISPs own firmware. Then I have router2 running openwrt connected via ethernet cable to router1.

router2 has two zones, wan and lan, I have configured wan with access to lan. Also lan has access to wan.

If I want to access a device on router1 from router2 this works fine. I can't access any device connected to router2 from router1. Apart from the router itself.

I think I'm missing some major point, I'm quite new to this sort of thing. Maybe router1 doesn't know how to see the devices on router2?

@eduperez Would I need to configure a static route on router1 (has next to no configuration available, certainly nothing to do with routes) or router2? Or both?

To avoid redundant NAT, yes.

No need, assuming that R1 is the default gateway for R2.

Note, that if you run Samba on OpenWrt, it binds to LAN interface by default no matter how you configured firewall.

@vgaetera Thanks for the help, router1 has no configuration for static routes. So the only option is to activate modem only mode on the ISP's router1, then attach another router with openwrt to this? Then setup the static route. The whole reason for this is, I just want to access files on my router2 connected device from my media streamer on router1