Do changes in the routing table affect existing TCP/IP connections?

4

4

If the question isn't clear enough, consider this situation:

  1. Establish a TCP/IP connection from computer C to server X
  2. Change the default gateway (of computer C) from gateway A to gateway B (both gateways can reach server X)

Now, which gateway will the packets go through? If it depends on the OS, please tell me the behavior of Windows and Linux.

netvope

Posted 2010-03-08T03:13:24.380

Reputation: 4 505

1Wouldn't that depend on the opsys? Some will begin to use the new gateway as soon as you save your changes; others will require a reboot first. Or are you making these changes on a router rather than a workstation? – goblinbox – 2010-03-08T03:20:22.587

If you have a workstation on a subnet that has two gateways available that route to the same place, don't you have one too many gateway? :) – MDMarra – 2010-03-08T04:13:49.763

Answers

7

Assuming that the OS network stack applied the change immediately, then the packets will go through the current gateway.

The default route, and routing in general, is IP only and IP is stateless. It is just a packet mover. That is it gets a packet from IP A to IP B. There is no state stored between packets, that's for TCP.

TCP doesn't care what route it takes, the TCP state is based on the source IP/Port and destination IP/Port so your TCP connections should not be interrupted. That is unless your gateway is a NAT and changing gateways makes the IP packet go through another NAT.

The true test of this question would be to setup the set up the scenario and see what happens, but I assume you are asking out of curiosity.

shf301

Posted 2010-03-08T03:13:24.380

Reputation: 7 582