none
TAP driver / identified vs unidentified networks

    Question

  • Hi.  I'm running Win7 build 7000, trying to get both my OpenVPN connection and my coLinux connection (TAP-Win32 v9.0.0.4 and 8.0.0.4 respectively) to be identified as Home networks. 

    Currently they each show as "Unidentified network" / "Local only" (sometimes even as participating in the same unidentified network.)  "Local only" is correct, as I don't want to use them as default routes; and I certainly care that I can't name them, but I would like to figure out how to set things up so that I don't have to mark them as Home/Private networks every boot.

    What makes a network "unidentified"?  Absence of a gateway? dhcpv6?  I tried adding a connection-specific DNS suffix to each :) 

    What makes a network identifiable?

    Thanks in advance for any information,
    Arya

    P.S. Here is what I assume is the relevant part of my ipconfig /all output:

    Ethernet adapter OpenVPN:

       Connection-specific DNS Suffix  . : vpn
       Description . . . . . . . . . . . : TAP-Win32 Adapter V9
       Physical Address. . . . . . . . . : 00-FF-D7-7A-74-AD
       DHCP Enabled. . . . . . . . . . . : Yes
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::d166:3a1e:30b9:b2e1%20(Preferred)
       IPv4 Address. . . . . . . . . . . : 10.18.0.12(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Lease Obtained. . . . . . . . . . : Thursday, April 02, 2009 9:09:56 AM
       Lease Expires . . . . . . . . . . : Friday, April 02, 2010 9:09:56 AM
       Default Gateway . . . . . . . . . :
       DHCP Server . . . . . . . . . . . : 10.18.0.0
       DHCPv6 IAID . . . . . . . . . . . : 520159191
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-11-63-E7-20-00-11-43-63-14-3D

       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled

    Ethernet adapter coLinux:

       Connection-specific DNS Suffix  . : colinux
       Description . . . . . . . . . . . : TAP-Win32 Adapter V8 (coLinux)
       Physical Address. . . . . . . . . : 00-FF-F0-51-BC-E3
       DHCP Enabled. . . . . . . . . . . : No
       Autoconfiguration Enabled . . . . : Yes
       Link-local IPv6 Address . . . . . : fe80::cd23:57d3:f832:e433%18(Preferred)
       IPv4 Address. . . . . . . . . . . : 10.7.0.1(Preferred)
       Subnet Mask . . . . . . . . . . . : 255.255.255.0
       Default Gateway . . . . . . . . . :
       DHCPv6 IAID . . . . . . . . . . . : 453050352
       DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-11-63-E7-20-00-11-43-63-14-3D

       DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                           fec0:0:0:ffff::2%1
                                           fec0:0:0:ffff::3%1
       NetBIOS over Tcpip. . . . . . . . : Enabled
    Thursday, April 2, 2009 1:34 PM

Answers

  •   
    Hi

    Use this powershell script it makes necessary changes in registry i found it on the web looking for solution to the same problem under vmware network adapters and modified it to work with tap open vpn devices.

    # see http://msdn2.microsoft.com/en-us/library/bb201634.aspx  
    #  
    # *NdisDeviceType   
    #  
    # The type of the device. The default value is zero, which indicates a standard  
    # networking device that connects to a network.  
    #  
    # Set *NdisDeviceType to NDIS_DEVICE_TYPE_ENDPOINT (1) if this device is an  
    # endpoint device and is not a true network interface that connects to a network.  
    # For example, you must specify NDIS_DEVICE_TYPE_ENDPOINT for devices such as  
    # smart phones that use a networking infrastructure to communicate to the local  
    # computer system but do not provide connectivity to an external network.   
    #  
    # Usage: run in an elevated shell (vista/longhorn) or as adminstrator (xp/2003).  
    #  
    # PS> .\fix-vmnet-adapters.ps1  
      
    # boilerplate elevation check  
      
    $identity = [Security.Principal.WindowsIdentity]::GetCurrent()  
    $principal = new-object Security.Principal.WindowsPrincipal $identity 
    $elevated = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)  
      
    if (-not $elevated) {  
        $error = "Sorry, you need to run this script" 
        if ([System.Environment]::OSVersion.Version.Major -gt 5) {  
            $error += " in an elevated shell." 
        } else {  
            $error += " as Administrator." 
        }  
        throw $error 
    }  
      
    function confirm {  
      $host.ui.PromptForChoice("Continue", "Process adapter?", [Management.Automation.Host.ChoiceDescription[]]@("&No", "&Yes"), 0) -eq $true}  
      
      # adapters key  
      pushd 'hklm:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}' 
      
      # ignore and continue on error  
      dir -ea 0  | % {  
         $node = $_.pspath  
         $desc = gp $node -name driverdesc  
         if ($desc -like "*TAP-Win*") {  
             write-host ("Found adapter: {0} " -f $desc.driverdesc)  
             if (confirm) {  
                 new-itemproperty $node -name '*NdisDeviceType' -propertytype dword -value 1  
             }  
         }  
      }  
      popd  
      
      # disable/enable network adapters  
      gwmi win32_networkadapter | ? {$_.name -like "*TAP-Win*" } | % {  
            
          # disable  
          write-host -nonew "Disabling $($_.name) ... " 
          $result = $_.Disable()  
          if ($result.ReturnValue -eq -0) { write-host " success." } else { write-host " failed." }  
          
          # enable  
          write-host -nonew "Enabling $($_.name) ... " 
          $result = $_.Enable()  
          if ($result.ReturnValue -eq -0) { write-host " success." } else { write-host " failed." }  
    }   


    Jarek
    Saturday, April 4, 2009 5:50 PM

All replies

  •   
    Hi

    Use this powershell script it makes necessary changes in registry i found it on the web looking for solution to the same problem under vmware network adapters and modified it to work with tap open vpn devices.

    # see http://msdn2.microsoft.com/en-us/library/bb201634.aspx  
    #  
    # *NdisDeviceType   
    #  
    # The type of the device. The default value is zero, which indicates a standard  
    # networking device that connects to a network.  
    #  
    # Set *NdisDeviceType to NDIS_DEVICE_TYPE_ENDPOINT (1) if this device is an  
    # endpoint device and is not a true network interface that connects to a network.  
    # For example, you must specify NDIS_DEVICE_TYPE_ENDPOINT for devices such as  
    # smart phones that use a networking infrastructure to communicate to the local  
    # computer system but do not provide connectivity to an external network.   
    #  
    # Usage: run in an elevated shell (vista/longhorn) or as adminstrator (xp/2003).  
    #  
    # PS> .\fix-vmnet-adapters.ps1  
      
    # boilerplate elevation check  
      
    $identity = [Security.Principal.WindowsIdentity]::GetCurrent()  
    $principal = new-object Security.Principal.WindowsPrincipal $identity 
    $elevated = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)  
      
    if (-not $elevated) {  
        $error = "Sorry, you need to run this script" 
        if ([System.Environment]::OSVersion.Version.Major -gt 5) {  
            $error += " in an elevated shell." 
        } else {  
            $error += " as Administrator." 
        }  
        throw $error 
    }  
      
    function confirm {  
      $host.ui.PromptForChoice("Continue", "Process adapter?", [Management.Automation.Host.ChoiceDescription[]]@("&No", "&Yes"), 0) -eq $true}  
      
      # adapters key  
      pushd 'hklm:\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318}' 
      
      # ignore and continue on error  
      dir -ea 0  | % {  
         $node = $_.pspath  
         $desc = gp $node -name driverdesc  
         if ($desc -like "*TAP-Win*") {  
             write-host ("Found adapter: {0} " -f $desc.driverdesc)  
             if (confirm) {  
                 new-itemproperty $node -name '*NdisDeviceType' -propertytype dword -value 1  
             }  
         }  
      }  
      popd  
      
      # disable/enable network adapters  
      gwmi win32_networkadapter | ? {$_.name -like "*TAP-Win*" } | % {  
            
          # disable  
          write-host -nonew "Disabling $($_.name) ... " 
          $result = $_.Disable()  
          if ($result.ReturnValue -eq -0) { write-host " success." } else { write-host " failed." }  
          
          # enable  
          write-host -nonew "Enabling $($_.name) ... " 
          $result = $_.Enable()  
          if ($result.ReturnValue -eq -0) { write-host " success." } else { write-host " failed." }  
    }   


    Jarek
    Saturday, April 4, 2009 5:50 PM
  • I thought I would offer another option, it is the same fix as the powershell one except it is a one liner for the command prompt, though it may need to be an administrative command prompt.

    FOR /F "USEBACKQ" %A IN (`REG QUERY HKLM\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002BE10318} /K /F "*"`) DO (REG QUERY %A /V DriverDesc | (FIND "TAP-Win" && REG ADD %A /V *NdisDeviceType /T REG_DWORD /D 1 /F))

    You could also execute it directly from the Run window by adding "cmd /c" to the front,

    or make it a batch file by replacing the "%A"s with "%%A"s

    Wednesday, December 29, 2010 4:27 PM
  • This was written to work from a batch file, correct? The reason I ask is I've tried running it in a .cmd file but it behaves really weirdly. I'm unable to troubleshoot what is going on because the script closes too quickly. The damnedest thing is I CAN NOT add a pause statement to the end of the script! I've add 6 pauses after the one liner, but the script still close the command prompt instantly.

    It looks like the FOR loop is somehow causing the script to exist prematurely...any ideas on how to fix this? We're getting killed by this NLA "feature" and need it to go away,

     
    Wednesday, September 10, 2014 7:03 PM
  • I know this is an older thread but I thought I would post what seems to be working for me. At the end of the .ovpn file I just added the following line:

    route 0.0.0.0 0.0.0.0 vpn_gateway 500

    This appears to have done the trick, at least for me. I hope this helps someone.

    Cheers.

    • Proposed as answer by FatBrioche Friday, October 13, 2017 9:02 PM
    Saturday, January 7, 2017 11:21 PM
  • Thanks a lot Mark-Actrack. Three days I'm on it, you freed me !!
    • Edited by FatBrioche Friday, October 13, 2017 9:02 PM
    Friday, October 13, 2017 9:01 PM
  • Thank you so much brother. You fixed my vpn internet connection problem.
    Wednesday, December 26, 2018 10:04 AM