My simple understanding of NAT is something like this could happen:
Two client PCs 192.168.1.2 and 192.168.1.3 open up a connection with src port = 12345. The gateway receives these and needs to use NAT, so one of them stays as 12345 and the other stays as 12346 when it goes out on the external IP 1.1.1.1.
192.168.1.2:12345 1.1.1.1:12345 <-> 2.2.2.2:80
-----> 192.168.1.1 ----->
192.168.1.3:12345 1.1.1.1:12346 <-> 3.3.3.3:443
When the packets come back in to 1.1.1.1 it has to map to the correct internal IP and port. This would need some kind of mapping table.
I wonder, how long would that table typically last?
- x Minutes/Hours?
- Until it sees a connection close down?
So for example if I have a protocol that irregularly sends data either way, is there a risk the mapping has gone and the other side sees the connection as closed (gets no Ack)?
In Linux, is there a way to see this table?