Windows File Sharing – Problems With Multiple IP Addresses

This was a bizarre problem that cost me half a day. I was unable to share folders from my Windows 10 PC, and I was near despair when I found the solution.

I tried searching Google for many different phrases before I found the answer. This was the basic symptom: My shared folders were not accessible to other machines on the network. However, when I tried to connect to them from the same machine, it worked fine. Well, except it didn’t. Let me explain.

My machine is named “David-W10”. It has Hyper-V running, so I have a couple of extra virtual network cards with private IP addresses in the 172.20.x.x address space. I have both IPv4 and IPv6 active.

  • If I tried to browse to \\David-W10 from other machines on the net, no luck.
  • If I tried to browse to \\David-W10 from the David-W10 machine itself, it worked fine. It turns out this is because the name resolution was returning my IPv6 address.
  • If I tried to browse my IPv4 address \\192.168.0.22, it did not work.
  • If I browsed to my Hyper-V adapter \\172.22.80.1, it worked fine.


I disabled all the firewalls. No change. I searched and dug, and finally found this article: https://superuser.com/a/1296023

As the author states: “Here’s the solution I discovered. (You might want to grab a beer first…)”

I was missing many registry keys. Why? No freaking idea. I’m on Windows 1803 with Hyper-V and Docker running. This is a fairly new clean install. I don’t much about in the registry or do weird stuff. I followed those directions, added the keys, rebooted, and magic! It all works now. Grr.

 

UPDATE: Have now discovered this problem recurs after every reboot.

No idea why, and I have found many other people online describing this problem also. Turns out the whole registry key nonsense does work, but it’s even easier to go into the adapter properties and just disable then re-enable “File and Printer Sharing for Microsoft Networks”. I wrote a PowerShell script to disable and re-enable the MS_Server service on the affected network adapter and scheduled it to run after every reboot. That seems to have fixed it for me.

Here’s my script, YMMV. Please make a backup first.


# Weird problem - file sharing disabled after every reboot. This script disables and re-enables ms_server which fixes the problem.
# Scheduled to run after every reboot in task scheduler.
#
Get-NetAdapter "vEthernet (Bridged)" | Set-NetAdapterBinding -ComponentID ms_server -Enabled $False
Get-NetAdapter "vEthernet (Bridged)" | Set-NetAdapterBinding -ComponentID ms_server -Enabled $True



 

 

 

Here are some other links:

https://social.technet.microsoft.com/Forums/windows/en-US/671fdb58-7d82-4078-a372-e3b50433faa4/windows-file-sharing-stops-after-every-restart?forum=win10itpronetworking

https://www.tenforums.com/network-sharing/90318-broken-file-printer-sharing-microsoft-networks-2.html

https://www.windowsphoneinfo.com/threads/broken-file-and-printer-sharing-for-microsoft-networks.45448/