For unknown reason, Windows 7 prefers using wireless connection over wired. In order to force Windows 7 to use the wired connection when available, you need to adjust the setting of gateway metric among network adapters. A lot of posts found online recommended to do it via via Network Connection (ncpa.cpl) by unchecking Automatic metric checkbox and manually setting Interface metric on each network adapter. Unfortunately, this only updates interface metric, not gateway metric. Thus, it won't have any effect on Windows 7 and the problem persists.
You can type the following command at the command prompt for the detail of your network adapter settings [see example]:
netsh int ip show config
Or type the following for the settings of the route table. In this command, the metric column is only for gateway metric. [see example]
route print
To change gateway metric, there are two options. First is to use route change command at the command prompt. For example,
route change 0.0.0.0 mask 0.0.0.0 192.168.1.1 metric 20 if 13
where
- 0.0.0.0 is the target network destination (IP address) found in route table.
- mask 0.0.0.0 is the subnet mask associated with the target network destination.
- 192.168.1.1 is the IP address of the gateway, my router.
- metric 20 is setting gateway metric to 20. The network interface with a lower metric takes precedence. In this example, I am assigning 20 to my wired network card, which receives the lowest gateway metric. It enforces Windows 7 to use the wired whenever it is available. Also see KB299540.
- if 13 means to apply the changes only to the network interface index equivalent to 13. In this example, 13 is my Intel(R) 82577LM Gigabit Network Connection that can be found in the Interface List section of route print.
There is no need to log out or reboot. The changes should take effect immediately.
The second option presented in my next post may be the preferable way, especially if you don't want to execute any command. Go and see my next how-to.
References:
The meaning of metric numbers, see
KB299540.
How to use
Route Command.
Example of netsh int ip show config
Configuration for interface "Wireless Network Connection"
DHCP enabled: Yes
IP Address: 192.168.1.2
Subnet Prefix: 192.168.1.0/24 (mask 255.255.255.0)
Default Gateway: 192.168.1.1
Gateway Metric: 25
InterfaceMetric: 50
DNS servers configured through DHCP: 192.168.1.1
192.168.1.1
...
...
Register with which suffix: Primary only
WINS servers configured through DHCP: None
Configuration for interface "Local Area Connection"
DHCP enabled: No
IP Address: 192.168.1.200
Subnet Prefix: 192.168.1.0/24 (mask 255.255.255.0)
Default Gateway: 192.168.1.1
Gateway Metric: 256
InterfaceMetric: 20
Statically Configured DNS Servers: 192.168.1.1
...
Register with which suffix: Primary only
Statically Configured WINS Servers: None
...
Example of route print
The column of Metric in the section of IPv4 Route Table
is gateway metric.
===========================================================================
Interface List
13...5c 26 0a 23 40 d5 ......Intel(R) 82577LM Gigabit Network Connection
14...00 24 d7 6c a6 fc ......Intel(R) Centrino(R) Ultimate-N 6300 AGN
15...00 24 d7 6c a6 fd ......Microsoft Virtual WiFi Miniport Adapter
10...5c ac 4c fd 7b 5e ......Bluetooth Device (Personal Area Network)
16...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1
17...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.200 266
0.0.0.0 0.0.0.0 192.168.1.1 192.168.1.2 50
127.0.0.0 255.0.0.0 On-link 127.0.0.1 306
127.0.0.1 255.255.255.255 On-link 127.0.0.1 306
127.255.255.255 255.255.255.255 On-link 127.0.0.1 306
192.168.1.0 255.255.255.0 On-link 192.168.1.200 266
192.168.1.0 255.255.255.0 On-link 192.168.1.2 281
192.168.1.2 255.255.255.255 On-link 192.168.1.2 281
... ... ... ... ...