[Samba] Samba behind NAT

Igor sprog at online.ru
Thu Jan 21 16:33:01 MST 2010

Hello Eero,

Friday, January 22, 2010, 1:07:30 AM, you wrote:

I forgot to mention - I used DNS name available all over the
Internet like \\www.whatever.com

It just won't work though I can resolve www.whatever.com using
nslookup on windows machine and I can ping it and traceroute it, all
so server's tcp ports are available (not sure about UDP ones) but
they should be as well. I can access file server's HTTP but still
\\www.whatever.com would produce "Windows could not find

It looks like the problem relates to NAT|samba binding, I had a similar
configuration but the file server had a direct IP address and I could
access it via \\www.whatever.com, the funny thing is that I couldn't
access it via IP address but \\HOSTNAME always worked for it.

EV> 2010/1/21 Igor <sprog at online.ru>:
>> 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:
>>  #samba
>>  $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
>>  #samba
>>  $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
>>  correctly.
>>  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.

EV> try \\fully.qualified.dns.name.of.samba.server

EV> --
EV> Eero

Best regards,
 Igor                            mailto:sprog at online.ru

More information about the samba mailing list