# Samba on jail behind NAT



## breefsd (Mar 15, 2013)

Hello,

I 'd like to install Samba on a FreeBSD jail.
I read some people had trouble with using (or trying to use) Samba behind NAT rather than bridge mode in a FreeBSD jail.
Are there restrictions on using NAT in the Samba case? Are there special settings to take care of within FreeBSD or/and Samba?

thanks


----------



## kpa (Mar 15, 2013)

SMB uses UDP broadcasts that do not traverse NAT. That's why it's not possible to see an SMB service that is behind a NAT directly in the network neighbourhood in windows. The SMB service itself is usable if used with a direct IP address/hostname.


----------



## breefsd (Mar 22, 2013)

*From http://www.samba.org documentation*:

_Broadcast versus NBNS name registration

As mentioned earlier, there must be a way to resolve a NetBIOS name to a specific IP address; this is known as name resolution. There are two different approaches with NBT here as well:

â€¢ Have each computer report back its IP address when it "hears" a broadcast request for its NetBIOS name.

â€¢ Use an NBNS to help resolve NetBIOS names to IP addresses._

*And*:

_Normally, only unicast UDP messaging can be forwarded by routers. The remote announce parameter to smb.conf helps to project browse announcements to remote network segments via unicast UDP. Similarly, the remote browse sync parameter of smb.conf implements browse list collation using unicast UDP. 

The methods used by MS Windows to perform name lookup requests [...] the NetBIOS node-type. There are four basic NetBIOS node types: 

â€¢b-node (type 0x01): The Windows client will use only NetBIOS broadcast requests using UDP broadcast.

â€¢p-node (type 0x02): The Windows client will use point-to-point (NetBIOS unicast) requests using UDP unicast directed to a WINS server.

â€¢m-node (type 0x04): [...]

â€¢h-node (type 0x08): The Windows client will use (NetBIOS unicast) requests using UDP unicast directed to a WINS server, then it will use NetBIOS broadcast requests using UDP broadcast._

*I*s it not possible to use unicast only if have not a large network?


----------

