# Samba woes



## amtrakuk (Dec 7, 2014)

Trying to migrate a NAS box back to a Samba box, everything has gone OK except Samba. The first thing I want to fix is its viability on the Windows network. I'm able to mount it by IP but not by hostname. Samba is set to start in rc.conf. My smb.conf file is: 
	
	



```
[global]
netbios name=Leopard
workgroup=WORKGROUP
security=user
load printers=no
log file=/var/log/samba.log
max log size=50
time server=yes
read raw=yes
write raw=yes
socket options=TCP_NODELAY IPTOS_LOWDELAY
domain master = no
local master = yes
preferred master = yes
os level=65
unix extensions = no


[homes]
path = /usr/home/
read only=no
guest ok=no
force group = users
browsable=no


[share]
path=/usr/home/share/
read only=no
guest ok=no
force group = share
security mask = 0660
force security mode = 660
directory security mask = 0770
force directory security mode = 0770
```
 However, I think the problem is a bit more than the smb.conf file. 

The three services running are: 
nmbd is running as PID 5704.
smbd is running as PID 5708.
winbindd is running as PID 5712.

The machine*'*s IP and subnet mask are matching the other machines on the LAN. The gateway is set to the broadband router IP.

Oddly enough pinging results in: 
	
	



```
PING leopard (81.200.64.50) 56(84) bytes of data.
64 bytes from advancedsearch.virginmedia.com (81.200.64.50): icmp_seq=1 ttl=50 time=36.7 ms
64 bytes from advancedsearch.virginmedia.com (81.200.64.50): icmp_seq=2 ttl=50 time=39.4 ms
64 bytes from advancedsearch.virginmedia.com (81.200.64.50): icmp_seq=3 ttl=50 time=24.1 ms
```
It seems there is a DNS name service either screwed up or not running. What else should I be looking for as to why it isn't showing on the network?

Thanks.


----------



## woodsb02 (Dec 7, 2014)

Interesting that your DNS query is resolving that host name. What is the contents of these three files?

/etc/resolv.conf
/etc/hosts
/etc/nsswitch.conf
Note that each of these has a man page if you want to know more about them.


----------



## amtrakuk (Dec 8, 2014)

I've had to go back to the NAS box as Samba was throwing a spanner into the works.

I've got a disk laying around I'll put into the machine and do a build later. A straight build of OS 9.3 > `portsnap update` > `make install cleandistro` Samba 3.4 > edit rc.conf and smb.conf I thought should do it or have I missed something?

Something I caught, someone had concluded a Samba server won't show up on a workgroup until a DHCP IP allocated address had been changed to a static IP. I wouldn't have thought that would cause the problem?

PS. Can't see the logic in getting rid of sysinstall -  just makes things harder!


----------



## woodsb02 (Dec 8, 2014)

Those steps should do it, and a DHCP assigned IP address should work fine.


----------



## Juanitou (Dec 8, 2014)

I’m not sure if it is related, but I always add the fully-qualified domain name of the machine to /etc/hosts and Samba shares work out of the box in Windows.


----------



## amtrakuk (Dec 8, 2014)

I'll have a play with a single disk setup tonight if I get the time and let you know how I got on.

If it*'*s any consolation the Samba box was working fine, untouched for months until I introduced the "ReadyNAS" box onto the LAN.  From that moment on my original Samba box decided to play hide and seek, with no changes what so ever to any of it's configuration.  I've even factory reset the router in case it was a corrupt look-up table.

A thought, I shouldn't need any additional name resolution service running for Samba to advertise itself withing the Workgroup?

Thanks again.


----------



## gqgunhed (Dec 12, 2014)

As far as my understanding goes: The name resolution via DNS, as used by ping, is different from what is used by Samba clients. ping initiates a lookup to the DNS servers defined in /etc/resolv.conf via port 53 UDP whereas tools like smbclient may use the NetBIOS name, talking to the nmbd process.

The other way round: Your ping will only succeed if your DNS name leopard resolves to the IP address of your Samba server. But that is independent from the Netbios name setting in /usr/local/etc/smb.conf as these are resolved via different protocols.

So you should have a DNS resolver within your LAN, e.g. dns/dnsmasq.


Disappearing Samba servers and shares:


> untouched for months until I introduced the "ReadyNAS" box onto the LAN. From that moment on my original Samba box decided to play hide and seek


This may depend on the setting 
	
	



```
domain master = no
preferred master = yes
```
in your smb.conf and the resulting election for being the master browser. That means: Which server runs the WINS resolution for your workgroup.
Try to set 
	
	



```
wins server = [ip address of your FreeNAS box]
```
 in your smb.conf on the FreeBSD host or vice versa and see if that helps with your hide and seek behaviour.
I suggest first getting your DNS resolution fixed, than look into the issue with the two Samba servers running for being the master browser. DNS is different and independent from WINS name resolution. Being able to "see" Samba shares from a Windows client depends on who is the master browser for your workgroup. At least as far as I know.

Hope this helps,
gqgunhed


----------

