networking - direct ethernet connect from Windows to Linux machine
2014-04
I have a windows 7 laptop, and a raspberry pi running linux(raspbian). I have configured a wifi dongle on raspberry pi, and it's connecting to a wifi network. But now I want to connect my Windows machine to raspberry pi through a direct ethernet cable using ssh without going through wifi network. I have tried several ways, but none of them worked.
I tried to set a static ip address for my raspberry pi, and then configure windows machine within the same subnetwork. It worked well, but my raspberry pi cannot connect to wifi network . The wifi network is using dhcp, and I guess there is a conflict.
Basically, I am looking for a solution to make the raspberry pi working good with the wifi network, and at the same time my windows machine can ssh to it using a direct ethernet cable. Can anyone help me?
Thanks
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
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 :)
This isn't a routing issue but a name resolution issue. You are most likely connecting to it by name. depending on what IP is resolved will dictate what connection it uses. If you connect via the IP instead of name it WILL use the right connection.
IE if you try to connect to 192.168.0.7 from the other PC it will use the ethernet connection because this network is directly accessible via that interface. So either connected by IP or modify your host file to resolve the PC name to the IP on the ethernet address.