1

I know that there are many similar questions on this.

I have a UPC router / gateway at home. If I am transferring files via SCP or FTP from one pc to another just on my local network, does this data need to go through my router? or can it not be simply transferred from pc to pc?

The terms gateway and router can be misunderstood, as they involve connecting different networks together.

When transferring data from one computer to another on the same LAN and subnet, my guess is this data must go to the router first, then the router identifies that the IP address is local, gets the MAC address and sends it to the other local pc.

If i'm right on the last point, is there no way to do a direct pc to pc transfer instead of this?

4 Answers4

2

Assuming you have the computers connected to a switch, and that switch connects to a router -

In order for the PCs to be able to talk to anything they need IPs in the same subnet. These can be manually configured or use fallback IPs, but typically these will be assigned by the router. This, of-course involves sending traffic to the router. Depending on how the transfer is initiated the router may also be used in helping the machines find each other by name (but not usually).

To actually transfer the data between devices, data will go through the switch but not to the router. The systems will find each other because they are both in the same IP range as defined by the IP address and subnet. (That's why subnets exist). At a low level this is done by the computer broadcasting "an ARP reques for an IP" which is picked up by all devices on the LAN, and the system with the appropriate IP address responds with its MAC address - after this the 2 systems know his to find each other.

As mentioned, it may be possible to simply connect 2 PCs together using a regular cable (for gigabit connections) or a crossover cable will work, assuming you solve the IP addressing problem and the name resolution question.

davidgo
  • 73,366
0

A router is a box with two network adapters, one connecting inward and the other usually connecting out to the internet (or to some other router).

When all computers are connected to the router as their only common point, then local LAN messages will pass only through the one inner interface, so the router will function more efficiently than if the communication was with the internet and needed to pass from the inner interface to the outer.

For direct connection, you will need to connect an Ethernet cable between the computers, or in the case of WiFi create a Access Point on one of the computers.

Both solutions, if you wish to keep the connection to the router and the internet at the same time as connecting directly the two computers, will require two network adapters on each computer, which is a bit heavy. You may also need to attribute static IP to the two adapters, if one of the participating computers doesn't have a DHCP server (which is the likeliest situation). It is also unclear what the performance gain will be (if any).

Last remark: For direct Ethernet connection you will need what is called a cross-over cable which avoids the need for a router. Modern good-quality cables/NICs adapt automatically and can serve for both purposes.

harrymc
  • 498,455
0

Can it not be simply transferred from PC to PC?

The answer is simple: yes!

Direct PC-to-PC data transfer via a single Ethernet cable is 100% fine.

If i'm right on the last point, is there no way to do a direct pc to pc transfer instead of this?

This is easy to do and requires no special configuration or hardware.

You (almost) certainly won't need a crossover cable, you definitely don't need a wireless router and you don't need to manually assign static IP addresses either.

APIPA automatically handles IP address assignments in the absence of a DHCP server, while auto MDI-X automatically handles the lack of a crossover cable.

All Gigabit Ethernet NICs have auto MDI-X support!

Let's get started:

  1. Connect your two computers directly together using a regular network cable.
  2. Run ipconfig in Command Prompt on each PC, to see what APIPA (Automatic Private IP Addressing) address they each automatically assign themselves. If this step fails, then you need a crossover cable, but it's unlikely. APIPA addresses are easily recognized as they are always in the format: 169.254.x.x.
  3. You can now access your network shares directly, either by IP address or hostname, just as if the PCs were connected conventionally using a switch or router.

enter image description here

Mr Ethernet
  • 4,459
-1

Yes and no, but mostly no. They will go through switches (because how else will the signals travel from device to device?) but they will not go through any router (because they're in the same subnet).

Usually, "same subnet" by definition means that the other host is accessible directly through the local ethernet, without going through any router/gateway system.

In other words, PC1 can directly query ARP for PC2's MAC address, and the packets can be directly addressed from the source device to the target device's MAC.

Both hosts can determine whether their peer is local simply by using the "subnet mask" configured in them. (Depending on the router to identify this would kinda defeat the point...)

The terms gateway and router can be misunderstood, as they involve connecting different networks together.

The packets may go through the built-in switch that a home router most likely has (depending on whether that is the shortest path), but as they're sent directly to the target device's MAC and not to the router's MAC, they won't actually be seen by the router's main OS at all.

grawity
  • 501,077