Samba returns random interface IP in response to a windows lookup

Hi,

I have a headless machine that I access via a Windows hosted Remote Desktop connection. All was well until I installed Docker and it created an associated interface with an internal IP address.

When I try and access this machine by name (windows does a name lookup - think it’s NetBios before it tries other methods like DNS). I know that to get a response I have to have the NMB service running and that’s all part of the Samba suit which makes sense.

Problem is that it returns the Docker interface IP address and not the IP of the physical interface - verified by pinging the name of the machine. I have also seen this on windows machines with multiple interfaces and you just any IP that’s attached to the machine!

I don’t want to go for static IPs if I can help it, so is there a way of getting Samba/NMB to return the IP of a specific interface as opposed to a random one?

Apologies if I have some of the names wrong and exactly what does what with Windows/Samba interactions.

Edit;

/etc/samba/smb.conf

And under [Global] add


bind interfaces only = yes 
interfaces = lo eth0

That should, upon restarting both services and removing the faulty DNS entry from Windows server, return the proper name.

Edit:
Naturally adjust interfaces to whatever you are using, and lo.

Many thanks that gets me further forward but I am not quite there yet. The RDP is over a VPN so I need a bit more experimentation.

For others landing here. You should do

PS C:\WINDOWS\system32> NBTStat -R
    Successful purge and preload of the NBT Remote Cache Name Table.

To purge the Netbios cache in Windows too.