Rowland Penny
2025-Jun-22 11:57 UTC
[Samba] Right-way to use " bind interfaces only = Yes"?
On Sun, 22 Jun 2025 13:01:25 +0200 Gilles via samba <samba at lists.samba.org> wrote:> Hello, > > Is??"bind interfaces only = Yes" a good thing to use, and in that > case, what's the right way to fix it > <https://askubuntu.com/questions/108040/samba-needs-additional-restart-on-reboot/349142#349142> > (on Debian)? > > If I use it, Samba only listens to the loopback interface. > > Thank you. > > ============> root at debian-dell:~# netstat -tunlp > Active Internet connections (only servers) > Proto Recv-Q Send-Q Local Address? ? ? ? ? ?Foreign Address ?State > PID/Program name > tcp? ? ? ? 0? ? ? 0 127.0.0.1:445? ? ? ? ? ?0.0.0.0:* ?LISTEN > 396/smbd ============> root at debian-dell:~# cat /etc/samba/smb.conf > [global] > netbios name = DEBIAN-DELL > server role = standalone server > security = user > disable netbios = yes > smb ports = 445 > > map to guest = Bad User > guest account = www-data > > ;interfaces = lo, enp4s0 > ;interfaces = 192.168.0.19/255.255.255.0 127.0.0.1/255.255.255.255 > interfaces = 192.168.0.19/24 127.0.0.1/32 > bind interfaces only = Yes > ============> vi smb.conf > > [global] > ... > interfaces = 192.168.0.19/24 127.0.0.1/32 > ;bind interfaces only = Yes > ============> systemctl restart smbd > ============> root at debian-dell:/etc/samba# netstat -tunlp > Active Internet connections (only servers) > Proto Recv-Q Send-Q Local Address? ? ? ? ? ?Foreign Address ?State > PID/Program name > tcp? ? ? ? 0? ? ? 0 0.0.0.0:445? ? ? ? ? ? ?0.0.0.0:* ?LISTEN > 515/smbd ============> root at debian-dell:/etc/samba# cat /etc/init/smbd.conf > cat: /etc/init/smbd.conf: No such file or directory > root at debian-dell:/etc/samba# which smbd.conf > root at debian-dell:/etc/samba# > ============From what you posted in your earlier post, this appears to be Samba 4.17.12, so probably Debian 12. In which case, there is no /etc/init directory and there isn't a smbd.conf file, it will be /etc/samba/smb.conf. I do not think that reloading the Samba config will change the interfaces for a running smbd, it binds to the interfaces at startup. Can I suggest you stop using the default Debian Samba and use the version from bookworm-backports, this will get you 4.22.2 at the moment and that is supported by Samba, 4.17.12 is only supported by Debian and as such isn't likely to get fixed if you have hit a bug, which is unlikely. '0.0.0.0' is not the loopback device. 'ifconfig' is deprecated, it has been replaced with 'ip a', what does that show ? Rowland
On 22/06/2025 13:57, Rowland Penny via samba wrote: > From what you posted in your earlier post, this appears to be Samba > 4.17.12, so probably Debian 12. > > In which case, there is no /etc/init directory and there isn't a > smbd.conf file, it will be /etc/samba/smb.conf. > > I do not think that reloading the Samba config will change the > interfaces for a running smbd, it binds to the interfaces at startup. > > Can I suggest you stop using the default Debian Samba and use the > version from bookworm-backports, this will get you 4.22.2 at the moment > and that is supported by Samba, 4.17.12 is only supported by Debian and > as such isn't likely to get fixed if you have hit a bug, which is > unlikely. > > '0.0.0.0' is not the loopback device. > > 'ifconfig' is deprecated, it has been replaced with 'ip a', what does > that show ? Yes, it's Debian 12 and Samba 4.17.12. I prefer installing packages through apt. Is 4.22.2 available as a package? I know 0.0.0.0 isn't the loopback device. Here's what I wrote: > If I use it, Samba only listens to the loopback interface. ============root at debian-dell:~# netstat -tunlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address? ? ? ? ? ?Foreign Address ?State? ? ? ?PID/Program name tcp? ? ? ? 0? ? ? 0 127.0.0.1:445? ? ? ? ? ?0.0.0.0:* ?LISTEN? ? ? 396/smbd root at debian-dell:~# ip a 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 ? ? link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 ? ? inet 127.0.0.1/8 scope host lo ? ? ? ?valid_lft forever preferred_lft forever ? ? inet6 ::1/128 scope host noprefixroute ? ? ? ?valid_lft forever preferred_lft forever 2: enp4s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 ? ? link/ether 00:80:64:fd:7a:c6 brd ff:ff:ff:ff:ff:ff ? ? inet 192.168.0.19/24 brd 192.168.0.255 scope global dynamic enp4s0 ? ? ? ?valid_lft 852956sec preferred_lft 852956sec ? ? inet6 2a01:e0a:590:fd80:280:64ff:fefd:7ac6/64 scope global dynamic mngtmpaddr ? ? ? ?valid_lft 86345sec preferred_lft 86345sec ? ? inet6 fe80::280:64ff:fefd:7ac6/64 scope link ? ? ? ?valid_lft forever preferred_lft forever On 22/06/2025 14:12, ???????? ????????? wrote: > If you are using NetworkManager and systemd you are probably getting samba > service to start before it actually configures your network card so it only > finds the loopback. Try to configure systemd to start smb services after > NetworkManager-wait-online.service It's a thin client, doesn't have much RAM, so I installed Debian without X. Should I edit /usr/lib/systemd/system/smb.service so it loads after Ethernet is up and running (IP assigned by DHCP)? https://serverfault.com/questions/482730/systemd-dependencies-and-boot-order