How to specify IPv6 link-local bind address in smb.conf?

5

Using samba 4.1.17-Debian I have tried the following smb.conf entries to bind samba to the link-local ipv6 addresses

interfaces = fe80::d270:36a5:ac03:37ea%br0 fe80::/10 ::1
bind interfaces only = yes

but checking with netstat only shows smbd listening on ::1

The manual states that besides interface names addresses or address+mask can be specified, so I would expect either approach to work.


Updated config:

# ip addr show dev br0 | grep -c fe80 
1

# smb.conf
bind interfaces only = yes
interfaces = 192.168.0.0/16 ::1 127.0.0.1 fe80::%br0/64

# smbd --version
Version 4.5.12-Debian

# netstat -lnp | grep smb
tcp        0      0 192.168.0.3:139         0.0.0.0:*               LISTEN      17048/smbd          
tcp        0      0 127.0.0.1:139           0.0.0.0:*               LISTEN      17048/smbd          
tcp        0      0 192.168.0.3:445         0.0.0.0:*               LISTEN      17048/smbd          
tcp        0      0 127.0.0.1:445           0.0.0.0:*               LISTEN      17048/smbd          
tcp6       0      0 ::1:139                 :::*                    LISTEN      17048/smbd          
tcp6       0      0 ::1:445                 :::*                    LISTEN      17048/smbd  

the8472

Posted 2016-01-21T05:37:25.197

Reputation: 385

Wouldn't it be enough to specify br0 in that case? Binding to a specific address sounds like it could cause problems. – user1686 – 2016-01-21T06:07:52.880

br0 also has other addresses on which I don't want to provide smb, among them global unicast v6 – the8472 – 2016-01-21T06:21:46.987

Answers

4

After hours of struggling, try, error and reading source code.

Everything works well but you have to specify correctly. When using IPv6 LinkLocal addresses you have to specify the interface with the "%" notation AND the prefix length in the end.

Interfaces = {Full-IPv6-address}%{interface}/{prefix length}

smb.conf (SAMPLE):

interfaces = fe80::114%eth0/64

Martha Gottsumpf

Posted 2016-01-21T05:37:25.197

Reputation: 56

I have tried that, it doesn't work for me. I'll update my question. – the8472 – 2018-03-03T19:29:06.583

"fe80::%br0/64" will not work --> you have to specify the whole link local address. For example: fe80::d270:36a5:ac03:37ea%br0/64 – Martha Gottsumpf – 2018-03-04T22:48:18.567

Isn't the point of netmasks in the configuration that you can specify a mask and it will pick any address falling within that mask? It works for the v4 private addresses at least. But you're right, that works, so I'll accept that answer although I'd have preferred a more generic solution. – the8472 – 2018-03-05T20:25:44.620

1@the8472 Isn't the point of netmasks in the configuration that you can specify a mask and it will pick any address falling within that mask? I'm with you. I tried the same. Maybe we should ask the Samba team. – Martha Gottsumpf – 2018-03-08T09:10:03.780

you must uncomment the line bind interfaces only = yes to take effect – rodvlopes – 2020-01-05T15:54:18.883

1

The best way to deal with IPv6 is not to use link local adresses but unique local instead.

Looks like "bind interfaces only" option makes IPv6 link local address not listened even if correctly written in smb.conf

I've tested successfully the use of IPv6 unique local address on debian linux and windows 10 to exchange files via samba from a linux server to a windows workstation.

In my configuration, the unique local address have been manualy configured in debian and windows so the SLAAC is still working to provide global IPv6 address. No need to use DHCPv6 to use this type of address.

wanou

Posted 2016-01-21T05:37:25.197

Reputation: 11

Thanks, I changed my router (OpenWRT based) to provide a ULA to the whole network, that also simplified my samba setup. – the8472 – 2019-12-07T23:13:10.233