In fact, the problem can be achieved by modifying the computer's routing settings.
Typically, a computer has only one default gateway, and network connections will default through this gateway. We can enter cmd through "Run", Bring up Command window, enter "route print"
That is, you can see the default gateway.
or enter "Ipconfig/all" to see the default gateway as well.
The idea of implementing the functionality described in "problem description" is to manually add "exceptions" to the computer's routing table so that these "exceptions" connect to the network through the routes we add.
Solution:
In the case of two network cards are connected, the computer will automatically set the gateway of wired connection as the default gateway. If most of the networks we visit are wired, then manually add the wireless connection "exception", and instead, set the wireless connection gateway as the default gateway and manually add the wired connection "exception".
The way to set the gateway for a wireless connection as the default gateway is:
In the network connection, locate the wireless network card, the right key attribute--TCP/IP attribute--advanced; Locate the default gateway and set the number of hops for the default gateway to 1.
The Win7 and WIN8 settings are as follows:
When you run "Route;print", you can see that the default gateway (Default;gateway) is already wireless connected.
The following is an example of adding a wired connection "exception". Assuming that the IP of the wired network card is 10.99.39.22, the gateway is 10.99.39.2, and it needs to be connected via a wired NIC when accessing the 10.99.*.* of the network segment.
Under the Console interface ("Run" enter "CMD" open) run the following command to add a route:; route;add;10.99.0.0;mask;255.255.0.0;10.99.39.2
; ; ;;
In this way, you set the network segment 10.99.*.* connection through the wired network card.
The Route;add command is to add a temporary route, and the settings will be lost after the computer restarts. If you need to keep it, use the following command: route;-p;add;10.99.0.0;mask;255.255.0.0;10.99.39.2;
To delete a route, you can use the following command: route;delete;10.99.0.0