My following question is on a very beginners level and I might lack significant knowledge about network basics. Although the question is somehow related to server/client concepts, the main issue behind is definitely not programming. So I try here and hope not to be completely off-topic. I don't know where the question would have been better placed...Please don't close the question without giving a hint about what's wrong.
Given a single machine (in my case a PC), it could have more than one network card installed, providing, lets say, two physical interfaces A
, B
. According to a previous question those two interfaces (Layer-1) can be assigned to two different IP adresses (Layer-3):
The layer-3 module registered with the layer-2 module for an interface will be assigned the layer-3 address for that interface.
For example, IP(A)
= 192.168.1.10 and IP(B)
= 192.168.2.10; both assigned by the properties of TCP/IP for the particular interface card.
The question:
Lets say, a server process, running on the same machine is started by registering itself to IP(B) and some port before it starts listening for incoming connections. So it is listening for any incoming requests arriving over interface B.
Now, I have a TCP client on the same machine, and I want to open a TCP connection to the server on IP(B). So I naively connect A and B with an external loopback cable and expect the traffic to go over that cable when a connection to B is requested. But there is no way to tell the client, Which interface X
it shall use... Will it use A
or B
? I even guess, that it would utilize B
, because A
and B
are different networks according to the chosen subnet mask and therefore a request to an end address in B
will be issued over interface B
? As a side question: What is the way of packages now, because the cable is not needed. Is there an internal loopback?
But what if I want to force the traffic over the loopback cable (for whatever reason)? Is that possible at all? How can I acchieve, that a client is using A as outgoing interface when adressing IP(B)
. To come to an end: I just want to ensure, that all sent packets between client and server are transported over the cable.
When A
and B
and also server and client would be on different machines each having a single network interface I would have no problem to understand. But here?
Why do I need that?
In reality, as a next step I want to replace the cable between A
and B
with an experimental setup, where bit error rates can be changed by intentionally adding some kinds of noise and statistical errors to simulate/emulate a very bad channel. I could put each side on a different machine, but would prefer to have both on the same.