If there is no router between the agent and the server, you must add entries to the routing table of the server. If the generated IP addresses of the client begin with the same two numbers (for example 192.200.), you only need to add one entry to the routing table (route add 192.200.0.0 mask 255.255.0.0<your normal IP address>). The server will consider the client as the appropriate router for all addresses beginning with 192.200.
In the example below, server 1 receives a packet from agent 1 and attempts to send its answer from 192.168.20.50 to 192.200.2.1. If you do not modify the server configuration (which means the server does not know that agent 1 is multi-homed), server 1 will send the packet to the default gateway, because there is only one matching entry in the routing table.
Network destination | Netmask | Gateway | Interface | Metric |
---|---|---|---|---|
0.0.0.0 | 0.0.0.0 | 192.168.20.18 | 192.168.20.126 | 1 |
If you call (at server 1) route add 192.200.0.0 mask 255.255.0.0 192.168.20.21, a new entry will be added. The entry resembles the following:
Network destination | Netmask | Gateway | Interface | Metric |
---|---|---|---|---|
192.0.0.0 | 255.255.0.0 | 192.168.20.21 | 192.168.20.50 | 1 |
As this entry has a higher priority than the entry of the default gateway, server 1 will send all packets with a destination address type of 192.200.x.x to agent 1 (believing this to be the correct gateway).
A router or load-balancer is positioned between the server and the agent. In such a case, you must alter the routing table of the router. If agent 1 sends a packet to server 1 (from 192.200.2.1 to 192.168.10.50) and agent 1 is configured correctly, that means it has a routing table entry that resembles the following:
Network destination | Netmask | Gateway | Interface | Metric |
---|---|---|---|---|
192.168.1.0 | 255.255.0. | 192.168.20.70 | 192.168.20.21 | 1 |
Agent 1 will send the packet to the router, which will in turn forward the packet to server 1. Now server 1 wants to send a response to the request of agent 1 (from 192.168.10.50 to 192.200.2.1). Because of its default entry in the routing table, server 1 sends the packet to the router. However, now problems arise because the router knows nothing of the new IP addresses of agent 1 and will use its default route (shown below) and send the packet to the gateway.
Network destination | Netmask | Gateway | Interface | Metric |
---|---|---|---|---|
0.0.0.0 | 0.0.0.0 | 192.168.20.18 | 192.168.20.70 | 1 |
If you call (at the router) route add 192.200.0.0 mask 255.255.0.0 192.168.20.21, a new entry will be added, the resembles the following:
Network destination | Netmask | Gateway | Interface | Metric |
---|---|---|---|---|
192.200.0.0 | 255.255.0.0 | 192.168.20.21 | 192.168.20.70 | 1 |