I am writing a network load balancer, a question arose about the operation of the network as a whole.
There are two switches, a balancer server, clients and servers (assuming all servers are identical).
This is connected as follows: the clients are connected to the first switch, the balancing server is connected to both the first and the second switch (two network cards), the servers are connected to the second switch.
Having the server load data, the balancing server changes the destination address of the packet from the client, recalculates the checksum, and sends it to the interface that looks towards the servers (second switch).
Initially, I wanted to handle all the traffic going to / through the balancing server, but after the tests I realized that there would not be enough server capacity for such work.
Questions:
- Is it possible: the client accesses the balance server, for example, a normal tcp-client, I change the destination address to a free server, then the client, having received a response from the server, already communicates with the server directly. (I'm not sure that this will work).
- How else can I get a client to communicate directly with the server I need?