Friday, October 15, 2021

Does NAT affect TCP seq/ack numbers?

For some context, I am tasked with implementing a device that is attached between 2 different subnets, that are connected by a gateway. The device has to identify packets going through the gateway and match them with the output on the other side when it undergoes NAT. I am using a hashmap and the key is a hash of parts of the tcp header with the rest of the packet. However, my design right now assumes the seq/ack numbers will not change so that they can be reduced to the same hash. I use the seq/ack numbers because I don't want collisions due to TCP retransmissions.

Alternative solutions to matching the packets are welcome, but I am more interested to know whether it is a safe assumption that TCP seq/ack numbers will not change for a generic gateway device.



No comments:

Post a Comment