Samba error: bind failed on port 137

Samba error: bind failed on port 137

Problem

Samba will not start and is showing the following errors in the log files.

Feb 6 15:27:02 server nmbd[22392]: [2013/02/06 15:27:02, 0] lib/util_sock.c:open_socket_in(822)
Feb 6 15:27:02 server nmbd[22392]: bind failed on port 137 socket_addr = 172.16.203.142.
Feb 6 15:27:02 server nmbd[22392]: Error = Cannot assign requested address
Feb 6 15:27:02 server nmbd[22392]: [2013/02/06 15:27:02, 0] nmbd/nmbd_subnetdb.c:make_subnet(97)
Feb 6 15:27:02 server nmbd[22392]: nmbd_subnetdb:make_subnet()
Feb 6 15:27:02 server nmbd[22392]: Failed to open nmb socket on interface 172.16.203.142
Feb 6 15:27:02 server nmbd[22392]: for port 137.
Feb 6 15:27:02 server nmbd[22392]: Error was Cannot assign requested address
Feb 6 15:27:02 server nmbd[22392]: [2013/02/06 15:27:02, 0] nmbd/nmbd.c:main(798)
Feb 6 15:27:02 server nmbd[22392]: ERROR: Failed when creating subnet lists. Exiting.
Feb 6 15:27:02 server smbd[22389]: [2013/02/06 15:27:02, 0] lib/util_sock.c:open_socket_in(822)
Feb 6 15:27:02 server smbd[22389]: bind failed on port 445 socket_addr = 172.16.203.142.
Feb 6 15:27:02 server smbd[22389]: Error = Cannot assign requested address

Solution

Check the IP address of the server with ifconfig

edit /etc/samba/smb.conf and make sure the interfaces option corectly matches the interfaces. You could even try removing the interfaces option all together allowing samba to use teh defaults

interfaces = eth0 192.168.100.10/24

Here is more info about the interfaces option:

http://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#INTERFACES