0

I have two routers, each connected to a different internet provider, with each having their own subnet. Both are accessible over the same LAN cabling (i.e. all devices are on the same Ethernet switch).

I also use Macs, where I can easily set up separate "Locations", which define a logical set of network interfaces. For each Location, I can then define the ethernet interface to use either the one or the other router (not using DHCP, of course).

How do I achieve a similar effect in Windows 10?

I'd like to set up different IPv4 interfaces, each talking to one of the routers, and then I'd have some easy-to-use control that lets me choose which one I want to use now.

1
  • What do you mean "over the same LAN cable"... Are you using two distinct subnets within the same broadcast domain? That is just a really bad way to do this. You should use VLANs or two distinct NICs. This is like putting both gasoline and diesel in your cars gas tank and thinking you can just flip a switch to use one or the other. Essentially you need to swap out your entire network settings (IP address, subnet mask, gateway, etc) all within a batch file using the netsh command, basically lan1.bat and lan2.bat, and within each the appropriate netsh script. – acejavelin Mar 6 at 18:17
1

You may create batch files (.bat) to disable one network adapter and enable another. You may create on the desktop shortcuts to these files, define them to be run as Administrator, and even assign them a hotkey.

To prepare, run the Command Prompt as administrator and list all the network interfaces using the following command:

netsh interface show interface

the exact adapter name is to be found under the column "Interface Name".

Once you know the name, the netsh command can disable or enable any adapter. A model for such a batch file is:

netsh interface set interface "FIRST-ADAPTER-NAME" disable
netsh interface set interface "SECOND-ADAPTER-NAME" enable

It will take a few seconds for Windows to discover that internet is now available on the enabled adapter.


If you just want to change the network configuration on one adapter, you need the Netsh command.

The syntax of the sub-command to use is (all parameters are optional except "name"):

netsh interface ipv4 set address name="YOUR INTERFACE NAME" static IP_ADDRESS SUBNET_MASK GATEWAY

You may find the exact name of the adapter by using the command:

netsh interface ipv4 show config

For more information see the article
How to Change Your Computer’s IP Address From the Command Prompt.

3
  • You seem to assume that I have two network adapters. So far, I only have one (both physical and logical – I thought I had made that clear). If I had two, turning one off would be easy. How do I even add a second logical adapter in Win10? The Settings and Control Panels do not seem to offer any way to create a second adapter/interface. – SuperTempel Feb 27 at 19:34
  • No, "locations" do not exist on Windows. I added to my answer the nearest possibility if you wish to switch the computer's network parameters. You may also place the commands in .bat files for easy call. – harrymc Feb 27 at 20:47
  • 1
    @SuperTempel , you may have missed the second half of this answer that starts with: "If you just want to change the network configuration on one adapter". I think that may suit your needs better. – Slartibartfast Mar 6 at 16:40
0

The best solution I've found so far is TCP/IP Manager

The app hasn't been updated since 2015 but still works perfectly on Windows 10 as far as I can tell.

It lets you create configurations, e.g. by loading your current IP settings into the program, and then give it a name.

To switch to another config, one has to choose it from a popup menu, then click Apply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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