Computer network: When an IP packet passes through a general router or NAT, will its source port number and destination port number change? This is another question I posted.
First of all, it should be clear that the port number is something at the transport layer. When the ip passes through the router, it only recognizes the destination address in the ip and throws the ip packet to the appropriate hop, even if the data is routed. Pure nat is also in the network layer, only changing the source ip. But there is a special nat, that is, port-based conversion, which is actually based on transport layer conversion. Our alliance calls it pat, and its function is to map the source ip of ip packets to the external ip+ port, so that multiple different source ip packets can be translated and mapped to the same external IP, and at the same time, it can be distinguished from the port number, thus realizing many-to-one translation PAT.