# The Local Unbound suspends Samba when resolv has localhost adress.



## Sub4sub (Apr 21, 2022)

When /etc/resolv.conf is set to the local address in the host system like follows:


```
nameserver 127.0.0.1
options edns0
```

It's working locally and in the network behind the network gateway.
The problem is that, it crashes net/samba. Unable to connect to a shared drive.
And since samba is bundled with windows, Windows Explorer crashes too.
I'm using /etc/resolv.conf on the host machine only to download packages, so I set up OpenDNS, and the schg phage.
Everything is back to normal.

Why is this happening?


----------



## mark_j (Apr 21, 2022)

I believe you, but, without some actual physical real data it's a guess. You need to post logs of relevant information.
What's your rc.conf? No firewall running? Are you connecting from FreeBSD to Windoze or vice versa?

BTW, Samba isn't bundled with windows, samba emulates this terrible windows protocol. If Windows explorer crashes it's because it's junk like the rest of Windows, not because of your use of unbound.

You really don't need to use unbound, it's not a requirement and is probably a waste of resources for most people. So do you really need it?


----------



## facedebouc (Apr 21, 2022)

If you want to be sure of the network connectivity of your FreeBSD server before it starts services like Samba, you can add these line in your /etc/rc.conf

```
### Network link/usability verification options
netwait_enable="YES"         # Enable rc.d/netwait (or NO)
netwait_ip="192.168.10.1"    # Wait for ping response from any IP in this list.
netwait_timeout="60"         # Total number of seconds to perform pings.
netwait_if="em0"             # Wait for active link on each intf in this list.
netwait_if_timeout="30"      # Total number of seconds to monitor link state.
```
192.168.10.1 is my router IP.
Pay attention to change the name of the network interface.


----------



## Sub4sub (Apr 21, 2022)

When samba on windows10, it is mapped "Map network drive". And I change /etc/resolv.conf to localhost.  Then when I go into "My Computer" the loading bar loads, and explorer crashes. If I change /etc/resolv.conf to a DNS address like opendns,

It works.

I don't know if this has anything to do with each other. I think it is a coincidence.

Also, Putty/Kittty through which I communicate started up noticeably slower.


----------



## mark_j (Apr 21, 2022)

Did you try restarting samba after the resolv.conf change. Is dhclient running?


----------



## SirDice (Apr 21, 2022)

Changing the DNS settings on the Samba server has nothing to do with the issues you're having on your windows _client_. At least not for _existing_ mapped shares. Your explorer should not _crash_ if it cannot resolve the hostname of the mapped drive, it will complain about it but it will not crash. 

You may encounter some resolving issues on the _client_ IF (and only if) you have set the client to use the DNS server that's running on the Samba server.


----------



## Sub4sub (Apr 21, 2022)

> Did you try restarting samba after the resolv.conf change. Is dhclient running?



Yes even after a `#reboot` it doesn't work either.



> Changing the DNS settings on the Samba server has nothing to do with the issues you're having on your windows _client_.



I don't change DNS in smb4.conf only in the host system. Generally there isn't, but there is also no connection to the samba server, Windows looks for it but doesn't find it and finally crashes explorer. It is also strange that the putty takes noticeably longer before it connects to the router. Once it connects it works.

Does this have any effect on security from the outside?


----------



## SirDice (Apr 21, 2022)

Sub4sub said:


> I don't change DNS in smb4.conf only in the host system.


And that's irrelevant from the _client_'s (your windows host with the mapped drive) point of view.



Sub4sub said:


> Windows looks for it but doesn't find it and finally crashes explorer.


Your explorer crashing has nothing to do with the settings on your Samba server. I don't think it's _crashing_, it just opens a window, times out, then closes that window. There is no crash happening here.



Sub4sub said:


> It is also strange that the putty takes noticeably longer before it connects to the router.


This is either a DNS resolving issue or it tries to connect on IPv6 first, fails, then tries IPv4. What DNS server is configured on the windows client?


----------



## VladiBG (Apr 21, 2022)

SirDice said:


> Changing the DNS settings on the Samba server has nothing to do with the issues you're having on your windows _client_


or he discovered a new Windows bug


----------



## tux2bsd (Apr 21, 2022)

Sub4sub it is more than likely your server can't resolve the client and this is causing you problems, this doesn't happen with the external DNS because_ reasons_ (it gets complicated very quickly).

Put /etc/resolv.conf back to 127.0.0.1 and put your windows client IP and hostname in /etc/hosts on the samba server.  Test to see if the behaviour changes.


----------



## Sub4sub (Apr 21, 2022)

Where to paste it?


```
[global]
workgroup = WORKGROUP
server string = Dysk
netbios name = Dysk
interfaces = igb0 10.1.1.0/24
hosts allow = 10.1.1.0/24
map to guest = Bad User
#wins support = Yes
#security = user
#passdb backend = tdbsam

[Dysk]
path = /home/samba/dysk
#valid users = user
writable  = yes
browsable = yes
read only = no
guest ok = yes
public = yes
create mask = 777
```


----------



## SirDice (Apr 21, 2022)

Sub4sub said:


> Where to paste it?


Paste what?


----------



## Sub4sub (Apr 21, 2022)

> IP and hostname in /etc/hosts on the samba server.


Do I have to do it in windows?


----------



## SirDice (Apr 21, 2022)

I suggest you search the Microsoft knowledge base on how to check and/or change the DNS settings in Windows.


----------



## Sub4sub (Apr 21, 2022)

If it doesn't affect safety, it stays as is.


----------

