Transfer files directly between computers over ethernet cable

networking

I often need to transfer files over my home network between computers and have found that WiFi transfers really aren't the best idea. (facepalm) If I have a CAT-5, 5e, or 6 cable lying around, how can I connect one computer directly to the other with it? If a SSH server is running on server and I connect client to server using a CAT-5 cable directly between the two, can I then use SSH to transfer files? What do I need to do in order to set something like this up? Is a router required?

Best Answer

If at least one computer's network card supports auto-crossover, you can connect both with a direct cable. (Auto-crossover, also called "auto-MDIX", is part of the Gigabit Ethernet standard, but is very often supported by 100 Mbps cards too.) Otherwise, you'll need either a cross-over cable, a hub, or a switch.

After setting up the physical connection, configure networking in the OS:

  • If both ends have IPv6, you can just connect using the other computer's link-local address; for example, ssh fe80::4a5d:60ff:fee8:658f%eth0. (On Linux, the string after % is your Ethernet card's name, while Windows uses the numeric interface ID from netsh interface ipv6 show interface.)

    You can also add shorter addresses manually, such as fc00::1 and fc00::2 (from the fc00::/7 network).

  • For IPv4-only hosts, manually assign IP addresses from the same subnet – for example, 10.0.0.1/8 and 10.0.0.2/8.

    Some operating systems will automatically assign link-local IPv4 addresses in the 169.254.0.0/16 range.

Related Question