sgibbers17 Posted July 9, 2015 Share Posted July 9, 2015 I have a windows 8.1 VM installed and I have already manually changed my network from public to private in the past using the registry editor and it worked for a while. Today my MySQL stopped working and I started to investigate and I found that my network has changed back to and unidentified public network. How do I keep this from happening? Quote Link to comment
archedraft Posted July 10, 2015 Share Posted July 10, 2015 Typically I find this happens to me when I either change my VM network settings or mess with my router / wifi. *I think* there is an option in windows 8 that if it thinks the network is new it will automatically setup as public. Maybe you could change that setting to private? Quote Link to comment
FLK Posted July 11, 2015 Share Posted July 11, 2015 I have a windows 8.1 VM installed and I have already manually changed my network from public to private in the past using the registry editor and it worked for a while. Today my MySQL stopped working and I started to investigate and I found that my network has changed back to and unidentified public network. How do I keep this from happening? How is the "network bridge" configured for your VM ? Quote Link to comment
sgibbers17 Posted July 11, 2015 Author Share Posted July 11, 2015 As a bridge br0, it gets its ip from the router. Quote Link to comment
Slartibartfast Posted March 15, 2017 Share Posted March 15, 2017 I know this is an old thread, but a Google search doesn't turn up any successful fixes for this issue and I figured others will come looking for a solution in the future. The problem is that Public/Private isn't really a setting on Windows 8.x and 10, its a condition. At startup Windows looks at all the networks visible to the system and uses an algorithm to decide if the network should be public or private. This means that even if you previously set the network to Private, Windows might decide it should be Public at the next boot. Reinstalling the NIC drivers will cause Windows to reassess the network type, and sometimes this or other changes or special configurations can fool Windows into constantly changing the network to Public every time it boots. I have an especially unusual configuration on my main PC where I run a pfSense instance in a VM as my main LAN firewall. To implement this I have two gigabit NICs installed. One ONLY has VMware Bridge Protocol enabled and connects to the cable modem, making the NIC visible to the VM (and pfSense) but not to the host. The other has all the usual protocols enabled, plus the VMware Bridge Protocol, making it visible to both the host and the VM. This second NIC has an IP of 192.168.1.1 from the VM and 192.1681.6 from the host and is connected to the LAN and WiFi AP. This configuration means that when the PC is booted, the network connection icon on the task bar doesn't show "Internet access" until the pfSense VM has fully started. This means that Windows can't decide whether the network should be Public or Private when it first starts so it defaults to Public, and doesn't always change back to Private when the firewall finishes starting up. It used to work fine for me but I changed my configuration a couple of weeks ago and ever since it fails every time to make my network connection Private when rebooted. The good news is that there is a way on Windows 8.x and 10 to override Windows Public/Private algorithm and force the network to Private (or Public) after every reboot. The trick is to use Task Scheduler to execute a PowerShell command after system startup. First you need to find out the ID number of the network connection you want to control. To do this... Run "Windows PowerShell" from the start menu, search, or Cortana. In the PowerShell command window type "Get-NetConnectionProfile" and hit <Enter>. Make a note of the value for "InterfaceIndex" in the text returned by step 2. Now that you have the interface index you can tell Task Scheduler to run a PowerShell command after every boot which will set that interface to Private... Run "Task Scheduler" from the start menu, search, or Cortana. If you don't already have one you want to use, right-click on "Task Scheduler Library" at the top-left and create a new folder, something like "Admin Tasks" for tasks requiring Admin rights to execute. In that new (or existing) folder, do a "Create Task..." (not a "Create Basic Task...") On the "General" tab, give the new task a name, something like "Set Network to Private". On the "General" tab, in the "Security options" box choose "Run whether user is logged on or not" and check "Run with the highest privileges". Leave "Do not store password" unchecked. If you would rather run this task as someone other than yourself set this with the "Change User or Group..." button. The user chosen should have Administrator privileges. Move to the "Triggers" tab and choose "New...". Set "Begin the task:" to "At startup" and leave everything else on that tab at the defaults. Click "Ok". Move to the "Actions" tab and choose "New...". Leave "Action:" set to "Start a program" and enter "PowerShell.exe" in the "Program/script:" field. In "Add arguments (optional): " enter "Set-NetConnectionProfile -InterfaceIndex <index> -NetworkCategory Private", replacing <index> with the interface index you made note of earlier. Hit "Ok" twice. After the second "Ok" you will be asked to enter the password of the user this new task will run as. Once you have entered it hit "Ok". The task properties editor will close and you should see your new task in the desired task folder. Reboot. After logging in again you should see that the network connection is Private. Depending on the reason Windows keeps trying to set it to Public it may take up to a minute before the connection shows as Private so don't panic if it shows as Public at first. Hope this is helpful, especially since this issue seems to be even more prevalent on Windows 10. Quote Link to comment
unsainted Posted April 18, 2018 Share Posted April 18, 2018 Just want to thank you for this, fixed the issue i had been having! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.