Is it possible to change the connection type in Windows 7? I have a OpenVPN connection which is identified as "unidentified network" and I do not want to apply certain rules to all unidentified networks in the firewall.

How does one conquer this?

link|improve this question

feedback

3 Answers

up vote 4 down vote accepted

Look at "TAP driver / identified vs unidentified networks" or "Vista and Windows Server 2008 - Unidentified network"

link|improve this answer
This did not allow me to set the location. It simply says Enabled instead of Unidentified Network. If you want to set a location type, see this answer. – jnm2 Jan 6 at 1:07
feedback

You have to add default gateway for OpenVPN network interface.

The way I found is adding route to target address 0.0.0.0 via network interface used OpenVPN.

In this example I have a computer with the physical interface with IP addres 10.20.20.20 in network 10.20.20.0/24 and the OpenVPN TAP interface with IP address 10.1.1.10/24 in network 10.1.1.0/24 (IP address of server on VPN network is 10.1.1.1).

1) Find out your network interfaces and information about current route to 0.0.0.0:

C:\>route print -4
===========================================================================
Interface List
 15...00 ff 6c 3f 5b 0c ......TAP-Win32 Adapter V9
 11...00 0e 0c d9 b5 c8 ......Intel(R) PRO/1000 GT Desktop Adapter
===========================================================================

IPv4 Route table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway        Interface Metric
          0.0.0.0          0.0.0.0       10.20.20.1      10.20.20.20     10
       10.20.20.0    255.255.255.0         On-link       10.20.20.20    266
...

At now we know that your OpenVPN network interface number is 15. Another important information is the metric of current route to 0.0.0.0. New route to 0.0.0.0 for OpenVPN network should have higher metric value than current to avoid redirecting whole network traffic to your OpenVPN connection instead of physical network (in case of two routes with the same routes, the route with lower metric will be chosen).

2) Add route to 0.0.0.0 via OpenVPN interface:

route -p add 0.0.0.0 mask 0.0.0.0 10.1.1.1 metric 50 if 15

This command adds route to 0.0.0.0 via interface 15 with metric at least 50 and gateway 10.1.1.1. Replace the gateway with your own (IP address of server on VPN network). And of course, replace the interface number with your own.

The -p argument adds route as permanent so it will be preserved after system reboot.

3) (Re)connect to VPN server and look into route table again:

C:\>route print -4
...
Active Routes:
Network Destination        Netmask          Gateway        Interface Metric
          0.0.0.0          0.0.0.0       10.20.20.1      10.20.20.20     10
          0.0.0.0          0.0.0.0         10.1.1.1        10.1.1.10     80
...

And network is now identified in Network and Sharing Center so the 'Set a location...' window should appear ;-)

link|improve this answer
This is the correct answer. – jnm2 Jan 6 at 1:05
feedback

This works, but it is better if you take it one step further by changing the IP settings for the TAP addapter manual. Use ipconfig to figure out the proper settings and use the gateway for the DNS server.

Update: Ignore this step if you do it your IP address won't be masked. I don't know why that is but i have done everything I can think of to reverse it, but the only way is to undo what I did in this step and reboot the computer.

Update. A problem i have with this is that I configured windows 7 to start the connection when i boot windows and sometimes when i reboot or shutdown the computer, the network would go back to unknown. The route would still be in the table. A work around to this was to modify my configuration file for the VPN client i connect to. The command I added was: Dummy default gateway to work around Windows 'unidentified network'/'unknown network' (put a "#" in front of this) route-metric 30 route 0.0.0.0 0.0.0.0 10.0.0.1. Metric is retrieved by reading the route table that is displayed with the route print -4 command. 10.0.0.1 is the gateway that the vpn connects to.

for example when i'm connected to the vpn, my route table looks something like this:

IPv4 Route Table

Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 192.168.0.1 192.168.0.100 25 0.0.0.0 128.0.0.0 10.0.0.1 10.0.7.102 30 The first entry is the route to my router. The second one is the VPN Connection. Now when i modify the vpn connection file (vpn.ovpn in my case)I use the network destination and make the netmask 0.0.0.0. And use 10.0.0.1 as my gateway. I then note that the metric is set to 30 and set it to 30 in the config file.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.