How to connect and use two different networks simultaneously on Windows

At the time of writing this, I am getting ready to give a live talk at a Python meetup. The talk will feature a live demo of my PyPi in a Box project. To do the demo, I’ll need to be connected to the Internet in order to stream my talk and also be able to SSH into the PyPi server which is not accessible via the internet and is on it’s own network.

The PyPi server is a raspberry pi that creates a stand alone wifi network. When I connect to it, my computer is assigned an IP address. I also tether my phone using a USB cable to my computer to access the phone’s 4G network. The phone also assigns my computer an IP address. Connecting to these two networks makes it difficult to use them simultaneously because Windows will always prefer one over the other. In this post I’ll show you what I did to enable me to use both connections at the same time.

In Windows, each network interface receives a priority value automatically based on its network metric. This works well in most cases, for example if you connect to an Ethernet network and a WiFi network at the same time, Windows will almost always prefer the Ethernet network as it is likely to perform better than the WiFi connection.

In my case, the automatic metric isn’t something I wanted so I set the priority of the adapters manually in the Control Panel. Here’s how to do it:

  1. Open Settings
  2. Click on Network & Internet
  3. Click on Status
  4. Click “Change Adapter options
  5. Right click the network adapter you want to change priority for and select its Properties:

6. Select Internet Protocol Version 4 (TCP/IPv4)

ipv4 settings

7. Click on the Properties button.

8. Click Advanced. In this section, uncheck the box that says Automatic metric and enter a number in the Interface metric box.

The number you enter here is the priority of the network interface, the lower the number, the higher the priority. A high number means low priority.

9. Click OK to save this dialog and the one that comes after it. Repeat the steps above for any other network adapters you need to configure. In my case, I gave the WiFi adapter a higher priority than the adapter used for Internet. This means that Windows will attempt to use that connection first to reach hosts and if it fails, it switches over to the second connection.


Conclusion

This method of configuring your network adapters is the easiest I found and it doesn’t involve using the command prompt or setting up routes for each adapter. It is pretty easy to undo as well as all you have to do to undo is to check the Automatic metric box in Advanced TCP/IP settings again.

0 comments on “How to connect and use two different networks simultaneously on WindowsAdd yours →

Leave a Reply