[Samba] Samba behind NAT

Igor sprog at online.ru
Thu Jan 21 14:29:56 MST 2010

Hello All,

  I have a strange problem regarding samba 3.0.37

  I have samba server installed in the local network behind NAT, the
  router iptables are configured as follows:
  $IPT -t nat -A PREROUTING -i $INET_IFACE -p udp  -d $INET_IP -m multiport --dports 137,138 -j DNAT --to-destination $FILESERV
  $IPT -t nat -A PREROUTING -i $INET_IFACE -p tcp  -d $INET_IP -m multiport --dports 139,145 -j DNAT --to-destination $FILESERV

  $IPT -A FORWARD -p udp -m state --state NEW -i $INET_IFACE -d $FILESERV -m multiport --dports 137,138 -j ACCEPT
  $IPT -A FORWARD -p tcp -m state --state NEW -i $INET_IFACE -d $FILESERV -m multiport --dports 139,145 -j ACCEPT

  The samba server is working fine and both smbd and nmbd are started. I
  have no problems accessing samba shares from local network using \\IP or

  But when I try to access samba from outside of my network I can only
  use \\IP, any attempt to use \\HOSTNAME results in "Windows couldn't
  find HOSTNAME..." message, though HOSTNAME on windows machine is resolved

  I thought it might be related to "interfaces" option, so I added
  router address into it but still cannot access samba by HOSTNAME from
  outside of the network. I all so sure that the problem doesn't relate to
  one particular windows setup since I can reproduce the problem on all
  windows machines outside local network.

  From samba log files it looks like there is no connection comes when
  \\HOSTNAME is used on windows computers.

  I would appreciate if someone could shed a light upon the problem.
  Thanks in advance.

Best regards,
 Igor                          mailto:sprog at online.ru

More information about the samba mailing list