Windows 10 – Select Primary network interface

When running Windows 10, sometimes you have more than one network connection, and you want to select which NIC is the primary.

In my case, I wanted to segment my network away from the network in house. I am connected wireless to house router, including my own router, which is performing as with multiple services like firewall, pxe/tftpboot server, dns and timeserver. The home router only has 54G wireless connection, and have a downlink speed to house router at around 30MBit, I prefer to set my desktop and desktop to connect directly to house router(AC standard)  for internet, and use local ressources from own router.

To list my NICs start a powershell and enter:

Get-NetIPInterface

my output is:

PS C:\Windows\system32> Get-NetIPInterface

ifIndex InterfaceAlias AddressFamily NlMtu(Bytes) InterfaceMetric Dhcp ConnectionState PolicyStore
------- -------------- ------------- ------------ --------------- ---- --------------- -----------
11 Bluetooth Network Connection IPv6 1500 65 Disabled Disconnected ActiveStore
9 Local Area Connection* 11 IPv6 1500 25 Disabled Disconnected ActiveStore
20 Local Area Connection* 10 IPv6 1500 25 Disabled Disconnected ActiveStore
18 Wi-Fi 2 IPv6 1500 45 Enabled Connected ActiveStore
21 Ethernet IPv6 1500 25 Enabled Connected ActiveStore
1 Loopback Pseudo-Interface 1 IPv6 4294967295 75 Disabled Connected ActiveStore
11 Bluetooth Network Connection IPv4 1500 65 Enabled Disconnected ActiveStore
9 Local Area Connection* 11 IPv4 1500 25 Enabled Disconnected ActiveStore
20 Local Area Connection* 10 IPv4 1500 25 Enabled Disconnected ActiveStore
18 Wi-Fi 2 IPv4 1500 45 Enabled Connected ActiveStore
21 Ethernet IPv4 1500 25 Enabled Connected ActiveStore
1 Loopback Pseudo-Interface 1 IPv4 4294967295 75 Disabled Connected ActiveStore

My networks of interest are:

18 Wi-Fi 2 with priority of 45
21 Ethernet with priority of 25
11 Bluetooth with priority of 65

To set priority to Wifi, I need to set priority if Wifi to be a lower number than my ethernet. I do this by entering the following command:

Set-NetIPInterface -InterfaceIndex 18 -InterfaceMetric 5
Set-NetIPInterface -InterfaceIndex 21 -InterfaceMetric 60
Set-NetIPInterface -InterfaceIndex 11 -InterfaceMetric 70

After entering the new metrics, take a restart and enjoy.