Windows – Using “route add” to tell the computer to use a direct ethernet connection instead of wifi

ethernetnetworkingroutingwindowswireless-networking

2 PCs are involved. Both are connected to the internet via Wifi on the same router. I can ping to/from each other and share folders flawlessly, but I'd like to be able to set a direct Ethernet link between them to speed up file transfers AND keep the Wifi connections (no gateway).

So I plugged my RJ45 cable, and set up the connection. It works, but the PCs are only using this connection if one of them if disconnected from the Wifi.

PC1 local address is 192.168.0.7 on its ethernet interface, and 192.168.1.21 on the wifi one.

PC2 local address is 192.168.0.6 on its ethernet interface, and 192.168.1.22 on the wifi one.

My question is : I'd like to using the route add command to tell PC1 to use the Ethernet interface when it needs to connect with PC2, by specifying "IF 2" at the end of the route add command. How can I do this ? I don't know what to put in the "gateway" parameter of the command, and everything I tried returns "the parameter is incorrect" (i don't know which one).

ipconfig /all on PC1 :

Windows IP Configuration

Host Name . . . . . . . . . . . . : Sam-PC    
Primary Dns Suffix  . . . . . . . :    
Node Type . . . . . . . . . . . . : Hybrid    
IP Routing Enabled. . . . . . . . : No    
WINS Proxy Enabled. . . . . . . . : No

Wireless LAN adapter Wireless Network Connection:

Connection-specific DNS Suffix  . : 
Description . . . . . . . . . . . : NETGEAR WG111v3 54Mbps Wireless USB 2.0 Adapter    
Physical Address. . . . . . . . . : 00-22-3F-DA-51-56    
DHCP Enabled. . . . . . . . . . . : Yes    
Autoconfiguration Enabled . . . . : Yes    
Link-local IPv6 Address . . . . . : fe80::1d33:60b:476c:d396%12(Preferred) 
IPv4 Address. . . . . . . . . . . : 192.168.1.21(Preferred)    
Subnet Mask . . . . . . . . . . . : 255.255.255.0  
Lease Obtained. . . . . . . . . . : vendredi 27 novembre 2009 15:38:48    
Lease Expires . . . . . . . . . . : dimanche 29 novembre 2009 07:33:04    
Default Gateway . . . . . . . . . : 192.168.1.1    
DHCP Server . . . . . . . . . . . : 192.168.1.1    
DHCPv6 IAID . . . . . . . . . . . : 301998655    
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-12-7E-58-EA-00-1A-4D-59-B2-71 
DNS Servers . . . . . . . . . . . : 192.168.1.1    
NetBIOS over Tcpip. . . . . . . . : Enabled

Ethernet adapter Local Area Connection:

Connection-specific DNS Suffix  . : 
Description . . . . . . . . . . . : Realtek PCIe GBE Family Controller    
Physical Address. . . . . . . . . : 00-1A-4D-59-B2-71    
DHCP Enabled. . . . . . . . . . . : No    
Autoconfiguration Enabled . . . . : Yes    
Link-local IPv6 Address . . . . . : fe80::f598:c3a0:df8d:706e%11(Preferred) 
IPv4 Address. . . . . . . . . . . : 192.168.0.7(Preferred)    
Subnet Mask . . . . . . . . . . . : 255.255.255.0  
Default Gateway . . . . . . . . . :    
DHCPv6 IAID . . . . . . . . . . . : 234887757    
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-12-7E-58-EA-00-1A-4D-59-B2-71 
DNS Servers . . . . . . . . . . . : fec0:0:0:ffff::1%1
                                    fec0:0:0:ffff::2%1
                                    fec0:0:0:ffff::3%1    
NetBIOS over Tcpip. . . . . . . . : Enabled

Best Answer

Aha, trick question :), it caught me, too.

The Gateway should be set to your IP.

I played with it; if you do a ROUTE PRINT it will list interface numbers at the top of the output, I'm going to call your ethernet interface <ETH>.

The command would then be as follows for the 192.168.0.7 machine (and similar for .6):

ROUTE ADD 192.168.0.0/24 192.168.0.7 IF <ETH>

or

ROUTE ADD 192.168.0.0 MASK 255.255.255.0 192.168.0.7 IF <ETH>

I hope this works for you :)

Related Question