# Samba4 - Failed to bind to XXX.XXX.X.255:137 - NT_STATUS_ADDRESS_NOT_ASSOCIATED



## amygrant (May 28, 2013)

Hello,

Today I installed Samba4 on a fresh 9.1 server via ports. The install went fine but when trying to start Samba I get the following in my log:


```
[2013/05/28 16:49:08,  0] ../source4/smbd/server.c:369(binary_smbd_main)
  samba version 4.0.4 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2012
[2013/05/28 16:49:09,  0] ../source4/smbd/server.c:475(binary_smbd_main)
  samba: using 'standard' process model
[2013/05/28 16:49:09,  0] ../source4/nbt_server/interfaces.c:205(nbtd_add_socket)
  [B]Failed to bind to 192.168.2.255:137 - NT_STATUS_ADDRESS_NOT_ASSOCIATED[/B]
[2013/05/28 16:49:09,  0] ../source4/smbd/service_task.c:35(task_server_terminate)
  task_server_terminate: [nbtd failed to setup interfaces]
[2013/05/28 16:49:09,  0] ../source4/smbd/server.c:210(samba_terminate)
  samba_terminate: nbtd failed to setup interfaces
```

This is the output from my domain provision:


```
root@vpn:/usr/ports/net/samba4 # samba-tool domain provision
Realm [MARS]: MARS.GALAXY
 Domain [MARS]: 
 Server Role (dc, member, standalone) [dc]: dc
 DNS backend (SAMBA_INTERNAL, BIND9_FLATFILE, BIND9_DLZ, NONE) [SAMBA_INTERNAL]: 
 DNS forwarder IP address (write 'none' to disable forwarding) [116.228.111.118]: 
Administrator password: 
Retype password: 
Looking up IPv4 addresses
Looking up IPv6 addresses
No IPv6 address will be assigned
Setting up share.ldb
Setting up secrets.ldb
Setting up the registry
Setting up the privileges database
Setting up idmap db
Setting up SAM db
Setting up sam.ldb partitions and settings
Setting up sam.ldb rootDSE
Pre-loading the Samba 4 and AD schema
Adding DomainDN: DC=mars,DC=galaxy
Adding configuration container
Setting up sam.ldb schema
Setting up sam.ldb configuration data
Setting up display specifiers
Modifying display specifiers
Adding users container
Modifying users container
Adding computers container
Modifying computers container
Setting up sam.ldb data
Setting up well known security principals
Setting up sam.ldb users and groups
Setting up self join
Adding DNS accounts
Creating CN=MicrosoftDNS,CN=System,DC=mars,DC=galaxy
Creating DomainDnsZones and ForestDnsZones partitions
Populating DomainDnsZones and ForestDnsZones partitions
Setting up sam.ldb rootDSE marking as synchronized
Fixing provision GUIDs
A Kerberos configuration suitable for Samba 4 has been generated at /var/db/samba4/private/krb5.conf
Once the above files are installed, your Samba4 server will be ready to use
Server Role:           active directory domain controller
Hostname:              vpn
NetBIOS Domain:        MARS
DNS Domain:            mars.galaxy
DOMAIN SID:            S-1-5-21-1643614572-718938930-437681598
```

My NIC:


```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC>
        ether 82:4d:eb:47:b9:1c
        inet 192.168.2.202 netmask 0xffffff00 broadcast 255.255.255.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (1000baseT <full-duplex>)
        status: active
```


My ISP's DNS is 116.228.111.118 but I am using SAMBA_INTERNAL. The error is:

```
013/05/28 16:49:09,  0] ../source4/nbt_server/interfaces.c:205(nbtd_add_socket)
  [B]Failed to bind to 192.168.2.255:137 - NT_STATUS_ADDRESS_NOT_ASSOCIATED[/B]
```
but I am unable to figure my way out of this. When I run `sockstat` I don't see any process on port 137

After a day of exhausting Google and these forums, I am out of ideas and am hoping someone here may be able to shed some light on this.


----------



## mix_room (May 28, 2013)

You are trying to bind on the IP ending in 255, while you have the one ending in 202 on the card. Try binding to an IP that you are using instead.


----------



## kpa (May 28, 2013)

> ```
> inet 192.168.2.202 netmask 0xffffff00 [U]broadcast 255.255.255.255[/U]
> ```



The broadcast address looks really weird and is probably the source of the problem. How is the interface configured in /etc/rc.conf?


----------



## ShelLuser (May 29, 2013)

The previous posters already hinted at it, but it seems your NIC is misconfigured. From the output of `ifconfig` which you pasted above: `inet 192.168.2.202 netmask 0xffffff00 broadcast 255.255.255.255`, or written differently: 192.168.2.202/24.

It's simple math from here on. The netmask shows us that your network range is: 192.168.2.0 - 192.168.2.255, this range always includes both the so called network address as well as the broadcast address; these are normally directly reachable. In this case the network address would be 192.168.2.0/24 hereas the broadcast address is 192.168.2.255.

As you can see this doesn't match the information you pasted up there. Also note that you cannot use these two IP addresses yourself. This range doesn't have 256 usable addresses (0 - 255), but 254 (1 - 254).

A very nice tool to quickly get an overview of all this is net/subnetcalc.


----------



## von_Gaden (Jul 15, 2013)

Sorry for my late post but I have seen such problem when trying to limit Samba4 to bind to given IPs or interfaces. I never succeeded with the same error but for 127.255.255.255:137. If I remove the limit (bind interfaces only, hosts allow) it suddenly works fine. This is with Samba 4.04 on FreeBSD 9.1 and I haven't tested the newest Samba4 port.


----------



## wblock@ (Jul 15, 2013)

Another instance of the interface not being ready before the startup script runs, maybe.  When the server has a static IP address, use netwait_enable (see rc.conf(5)).  If the server gets an address through DHCP, use SYNCDHCP to make it wait until dhclient(8) finishes.


----------



## von_Gaden (Aug 13, 2013)

The problem occurs not only during system startup but on an already started system too. I observed it with Samba 4.0.4 and I spent some time to test it on Samba 4.0.8 (both from ports)*.*

If I put the following in /usr/local/etc/smb4.conf:

```
interfaces = localhost, em0
       bind interfaces only = yes
```
and start Samba, /var/log/samba4/log.samba reads:

```
Copyright Andrew Tridgell and the Samba Team 1992-2012
[2013/08/11 22:27:51,  0] ../source4/smbd/server.c:475(binary_smbd_main)
  samba: using 'standard' process model
[2013/08/11 22:27:51,  0] ../source4/nbt_server/interfaces.c:205(nbtd_add_socket)
  Failed to bind to 127.255.255.255:137 - NT_STATUS_ADDRESS_NOT_ASSOCIATED
[2013/08/11 22:27:51,  0] ../source4/smbd/service_task.c:35(task_server_terminate)
  task_server_terminate: [nbtd failed to setup interfaces]
[2013/08/11 22:27:51,  0] ../source4/smbd/server.c:210(samba_terminate)
  samba_terminate: nbtd failed to setup interfaces
```
When I put in /usr/local/etc/smb4.conf:

```
hosts allow = 127.0.0.0/8 10.10.0.0/16
```
Samba starts with following errors:

```
Copyright Andrew Tridgell and the Samba Team 1992-2012
[2013/08/13 09:14:27,  0] ../source4/smbd/server.c:475(binary_smbd_main)
  samba: using 'standard' process model
[2013/08/13 09:14:28,  0] ../source4/lib/socket/access.c:356(socket_check_access)
  socket_check_access: Denied connection to 'smbd' from  (LOCAL/unixdom)
[2013/08/13 09:14:28,  0] ../source4/lib/socket/access.c:356(socket_check_access)
  socket_check_access: Denied connection to 'smbd' from  (LOCAL/unixdom)
[2013/08/13 09:14:28,  0] ../source4/lib/socket/access.c:356(socket_check_access)
  socket_check_access: Denied connection to 'smbd' from  (LOCAL/unixdom)
[2013/08/13 09:14:28,  0] ../source4/lib/socket/access.c:356(socket_check_access)
  socket_check_access: Denied connection to 'smbd' from  (LOCAL/unixdom)
[2013/08/13 09:14:28,  0] ../source4/lib/socket/access.c:356(socket_check_access)
  socket_check_access: Denied connection to 'smbd' from  (LOCAL/unixdom)
[2013/08/13 09:14:28,  0] ../source4/lib/socket/access.c:356(socket_check_access)
  socket_check_access: Denied connection to 'smbd' from  (LOCAL/unixdom)
```
In this situation `smbclient -L \\smbtest.test.lan -U administrator` works.

Both examples above are tested on virtual and real machine. I have to mention that I did not observe such problems with Samba 3


----------



## Tjure (May 4, 2022)

Sorry for replying to these old thread, but I have the same issue with FreeBSD 13!

I started with a complete fresh FreeBSD 13 install on a virtual machine, provisioned a domain controller (for testing) with

`samba-tool domain provision --server-role=dc --use-rfc2307 --dns-backend=SAMBA_INTERNAL --realm=SAMDOM.EXAMPLE.COM --domain=SAMDOM --adminpass=Passw0rd --option="interfaces=lo0 vtnet0" --option="bind interfaces only=yes"`

Provisioning works without problems, but starting `service samba_server onestart` fails with (in /var/log/samba4/log.samba):

```
Failed to bind to 127.255.255.255:137 - NT_STATUS_ADDRESS_NOT_ASSOCIATED
```
So the same error as 9 years ago! Apart from using the workaround with 'hosts allow', I did not find any solution in the web.

Does anybody has a solution/suggestion? Is this a samba-error, or something specific to FreeBSD?


----------



## VladiBG (May 5, 2022)

Why you need the service on "lo0" interface ?


----------



## Tjure (May 5, 2022)

At the moment it's mostly for figuring out problems in my running (not the test) DC, but I can imagine that it is also useful, e.g., for local ldap-queries on the DC from other services.

It's anyway puzzling when you set up a new DC and the simplest tests do not work (e.g., those from the Samba Wiki) It's then difficult to know if this is the error of the user or a bug in the software. 

I just tested it on a ARCH-linux system, and there samba has no problem with 
interfaces = lo eth0
bind interfaces only = yes
thus it seems to be FreeBSD-specific.


----------



## Tjure (May 18, 2022)

The only solution currently seems to be to disable NetBIOS completely, i.e., 
`/etc/rc.conf`:

```
samba_server_enable="YES"
nmbd_enable="NO"
```
 
`/usr/local/etc/smb4.conf`:

```
disable netbios = yes
```

(see Thread 76288)


----------

