|
User Reviews/Comments:
rate:
avg:
![]() ![]() ![]() ![]() ![]()
I worked around this challenge by assigning a 172.16.10.0/24 network to the router attached to the internet adapter and 192.168.1.0/24 to the internet router.
I also made sure to assign a static 172 address to the computer with both interfaces and remove the default route: i.e. I left it without a default gateway. Hope this helps!
Unfortunately, VPN connections seem to reset the interface metric each time they connect if it's set by PowerShell.
I connect the VPN, then I set it to 10: Set-NetIPInterface -InterfaceAlias "My-VPN" -InterfaceMetric "10" I verify with Get-NetIPInterface: ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore 35 My-VPN IPv4 1400 10 Disabled Connected ActiveStore I disconnect and reconnect the VPN, and check again with Get-NetIPInterface: ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore 35 My-VPN IPv4 1400 25 Disabled Connected ActiveStore Setting the metric via the GUI seems to keep working, but I need to handle this programmatically. My users aren't going to want to run a script after they connect each time. Any suggestions? Is there a registry key I can set for the same setting to be persistent? BTW, using InterfaceAlias works just as well as the ifIndex, and it doesn't require that you know the index that can vary between computers. With a VPN, I set exactly what it will be called, so that's easier for me to use. |