Let’s say I have 4 ethernet interfaces getting IP addresses via DHCP. I make a TCP connection to a TCP server via one of the IP addresses on a certain ethernet interface. After the connection is established and communication working, I swap the IP address of this interface with the address of another interface. Since the IP address still exists on which the TCP connection was established, does my TCP connection still remain alive?

  • Did any answer help you? if so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Commented Dec 19, 2020 at 22:29

1 Answer 1


does my TCP connection still remains alive?

Only if both the source and destination IP and TCP addresses remain the same on the packets. Those four addresses define the connection, and if you change even one of them, then it is a different connection that would need to be established.

RFC 793, Transmission Control Protocol (the definition of TCP) explains:


To allow for many processes within a single Host to use TCP communication facilities simultaneously, the TCP provides a set of addresses or ports within each host. Concatenated with the network and host addresses from the internet communication layer, this forms a socket. A pair of sockets uniquely identifies each connection. That is, a socket may be simultaneously used in multiple connections.

The binding of ports to processes is handled independently by each Host. However, it proves useful to attach frequently used processes (e.g., a "logger" or timesharing service) to fixed sockets which are made known to the public. These services can then be accessed through the known addresses. Establishing and learning the port addresses of other processes may involve more dynamic mechanisms.


The reliability and flow control mechanisms described above require that TCPs initialize and maintain certain status information for each data stream. The combination of this information, including sockets, sequence numbers, and window sizes, is called a connection. Each connection is uniquely specified by a pair of sockets identifying its two sides.

When two processes wish to communicate, their TCP's must first establish a connection (initialize the status information on each side). When their communication is complete, the connection is terminated or closed to free the resources for other uses.

Since connections must be established between unreliable hosts and over the unreliable internet communication system, a handshake mechanism with clock-based sequence numbers is used to avoid erroneous initialization of connections.

  • 1
    Whether any communication will continue depends on the host operating system and whether it will drive the interfaces correctly for this. Also whatever is on the same subnet (remote host or local gateway) might have security software which is triggered when the incoming TCP stream changes MAC address.
    – jonathanjo
    Commented Oct 17, 2018 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.