0

hopefully I've phrased the correctly appropriately!

Using windows 7 Pro SP1

On my laptop, I have to use both a wired and wireless connection - some traffic (eg accessing specific systems) I can only access through the wired connection - and others only through the wireless connection.

Both are company on-site connections - they're just not very joined up.

At the moment, I have to switch between them through the day - if I leave both on, it's hit or miss which connection windows will try and use (but usually the wired), so I unplug/disable the one I don't want and then change back when I need it.

Is there a better way of directing specific applications / protocols through to a specific connection?

Or, if this isn't possible, can specific URL's be re-directed instead (this would at least make switching less frequent!)

Edit to add IPCONFIG info - which shows both connections using same Subnet

Wireless LAN adapter Wireless Network Connection:

   Connection-specific DNS Suffix  . :
   Link-local IPv6 Address . . . . . : fe80::f1ff:5ffe:6093:ebf%13
   IPv4 Address. . . . . . . . . . . : 10.240.54.12
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 10.240.54.254

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . : domain.local
   Link-local IPv6 Address . . . . . : fe80::9088:177:1936:10ac%11
   IPv4 Address. . . . . . . . . . . : 172.31.161.83
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 172.31.161.1
4
  • If the two parts are on different subnets (with different network addresses) then you can using IP routing for all traffic to the right subnet. Can you add some more details about the network config?
    – Hennes
    Aug 9, 2016 at 11:32
  • Thanks - have added ipconfig info - is there anything useful I can provide? Shows they're on the same subnet sadly.
    – aldredd
    Aug 9, 2016 at 11:37
  • 1
    That looks like two different subnets. Wireless on 10.240.54/24 and Wire on 172.31.161.0/24. If you are connected to both at the same time (that assumes no clippy style smart assistence programs which turns off wireless when on wired) then you should be able to access both add the same time by adding routes to both. If you combine that with only one default gateway (use the one which is connected to the Internet as gateway and leave the field blank for the other) then you should be able to reach devices on both networks as well as non local networks.
    – Hennes
    Aug 9, 2016 at 11:43
  • Which is a similar situation as in this post , only with windows rather than with OSX. Same questions and information needed for that post also apply here.
    – Hennes
    Aug 9, 2016 at 11:45

1 Answer 1

1

Windows 7 NIC Priority Configuration

All modern windows releases provide the ability to prioritize network interfaces using the somewhat confusingly named Network Interface Metric. For most home / simple networks, this setting makes the final decision on which NIC to use when no other criteria explicitly forces that decision; basically when both NICs look equally viable from a network stack perspective such as when the destination is available on both NICs, both NICs have a valid configured default gateway, both NICs are in same subnet, etc.

Interface Metric

An interface metric setting of '1' is the highest priority (NIC is used first). The automatic settings provided by windows by default are loosely based on connection speed; with the intent of prioritizing higher speed links over lower speed. That is an imperfect way of handling the performance differences between WiFi and wired Ethernet, as throughput can be very good at times on a wifi network, but is nearly always less reliable and consistent.

In other words, as you have noted, the wired LAN connection should be prioritized over the wifi in nearly every scenario and by default (at least in win 7), that is not the case.

Avoid complex configurations, at least initially

You can tweak these settings to setup very fine tuned control over what NIC gets used for what traffic, but I think that's outside the scope of what you are looking for. You would configure things that way, as an example, if a certain server / web site / IP address range should be accessed using the NIC that wouldn't normally be given the priority, and that host / IP range is accessible by both NICs. Make minimal changes, evaluate the results, and make additional, minor changes again if necessary. If, as mentioned above, routes are hard set by interface, you will almost certainly have issues when only one of the two NICs are available.

Related Configuration Settings

Additionally you can tweak a related parameter, "Gateway Metric", which prioritizes which NIC is used when 2 or more NICs have the same gateway. There is some evidence that there are cases where changing the interface metric is insufficient and the gateway metric must also be configured. If you see no change after making the interface metric changes, look at the step 3 below as well as the link at the bottom for details on changing the gateway metric (same command, different parameter).

The Interface Metric is evaluated first, so you shouldn't have to dig into that setting, but it's available if you need to. To clarify on a comment from above - with the approach I am describing you don't need to change / remove gateways from any of the interfaces; which would at best would force you to use a static IP, at worst cause connectivity issues when the wired LAN isn't available.

How to modify the Network Interface Metric Settings

  1. Open an admin command prompt, and enter the following command: netstat -rn or for a bit more detail netsh int ip show config
  2. This will output a list of all NICs in the system. The number in the left most column (netstat) is the NIC interface metric (aka priority).

  3. You want to set the wired NIC to a lower metric than the wireless NIC. Once you have seen what the values are set to, configure the wired NIC to be a very low number (e.g. 2) and the wifi to be high (e.g. 64). The syntax to apply those settings is as follows. I am using the names "Wired" and "Wifi" for the two NICs; use the correct values from your system (step 1's output will contain the correct names".

    set interface "Wired" metric=2
    set interface "Wifi" metric=64

If you find that you do need to modify the gateway metric, the syntax is:

 set interface "Wired" gwmetric=2 
 set interface "Wifi" gwmetric=64 

Note - the metric values I have chosen are arbitrary. If you only have two NICs, there is (theoretically) no difference between having the cards set with metric 2 and 3 vs metric 2 and 64. Normally the loopback interface is set to metric 1; if it is, do not set either of the 'real' NICs to one - In some cases that would result in local traffic being sent to the router (a simple example would be pinging yourself by your LAN IP address - normally that gets routed to the loopback interface - you could inadvertently change that). In the case of a ping it's nearly a don't care, but many applications use local network sockets tied to the LAN IP address, with the intent that that traffic never actually leaves the PC, and for that situation the performance degradation would be non trivial.

More Information:

Here are a couple links on the subject; this one shows how to adjust these settings using the gui, and this one provides anecdotal evidence on the occasional need to modify both the interface and gateway metrics. I haven't had to adjust gateway metric settings before, but I came across the subject enough times in a couple minutes of googling that I wanted to make sure it was covered in this answer.

Evaluating the effectiveness of the setting changes:

  1. An simple method to see which NIC is being used is to use the traceroute command and see which NIC it goes out of (target local LAN hosts as well a variety of internet hosts to ensure the NIC usage distribution is consistent between LAN and WAN).
  2. Depending on how deep you want to dive into this, the ideal way to get a real statistical info on NIC usage is to use a packet capture program such as wireshark.
  3. The easiest method would be to view the packet transmission counts from each network interfaces status, and see the relative rates between the two NICs.

If things are really bad, dynamically adjust the metric settings

In the worst case, if the quality connection really does swing from wired to wireless and back throughout the day, it would not be difficult to put together a small script to adjust the NIC metric values based on current network performance. Briefly, you would write a powershell script or batch file that ran a quick test on your network connectivity, evaluate the results of each NIC, and have the script change the metric value to prioritize the NIC with the currently 'best' performance. I'm not sure how bad the connections get - if it is so bad that you are dropping packets, you could test the NICs with a simple ping test. Otherwise you might need to do a download speed and latency test (e.g. speedtest.net).

Update

I misinterpreted your question a bit.

If you can provide the specifics on what you need to do, I can provide you with details on how to do it.

If you'd like help with it, please try to provide as much detail as possible, as there are a large number of possibilities here and the questions are intended to drill this down to the simplest approach.

If this can be handled at the IP address level - meaning that all traffic to a given IP address should go out a specific interface - then it will be easy to do. If it is protocol / application / port and/or host dependent than it is more complex.

Additional Questions:

  1. Can we filter this on the IP address level or is it application specific?
  2. What is the IP address or range of IP addresses that need to use a specific interface. If the criteria (question 1) isn't IP address, then provide details on the application that needs to use a specific interface.

  3. Is the issue that if the wrong interface gets 'chosen' that the communication fails completely? Meaning that the remote host couldn't actually be reached over that interface? Or does using the wrong interface simply degrade performance?

  4. Please run the following 2 quick tests so we can get a sense of the behind the scenes routing configuration on the lan. Its not clear to me if routes between these networks exist, so this will check that out.

    a. First determine what the default gateway is for the wired ethernet interface (it's not in your example). For consistency, use the IPv4 gateway if you have both an ipv4 and ipv6.

    b. Disconnect the wired ethernet interface (leaving just wifi), and attempt to ping the wired ethernet interfaces default gateway. What happens?

    c. Now reconnect the wired ethernet and disconnect the wifi adapter.

    d. Ping the default gateway of the wifi interface (in your question 10.240.54.254), and let me know what happens.

Resolving this might be as simple as adding a static route (single command), but I'll provide details based on your response.

2
  • Thank you - this was a detailed answer, and I learnt some new info from it. That said, I'm not sure it's going to help me in this case - it's not so much I need to re-prioritise the connections, but direct specific traffic through one or the other.
    – aldredd
    Aug 11, 2016 at 10:35
  • I updated the answer to request more info on this
    – Argonauts
    Aug 11, 2016 at 11:19

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.