V
V
Vova2017-05-29 08:58:45
Network administration
Vova, 2017-05-29 08:58:45

Why does NAT port swapping work?

Hello!
I read on Wikipedia that in some cases NAT changes not only addresses in packets, but also port numbers ( https://ru.wikipedia.org/wiki/NAT).
And now I don't understand why it even works!
After all, the ports are rigidly nailed to the protocols!
If you take and change, for example, port 80 to something else, then HTTP will turn into something else!
How does it work?
(Maybe there are some examples? A la, such ports can change to such, but in another way!)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
15432, 2017-05-29
@JustMoose

Example:
1) the user's computer creates a TCP socket with outgoing port 27401 and tries to connect to port 80 of the site yandex.ru
2) the request comes from the NAT provider, it replaces the IP and port (27401) of the user with any free one (59017), and remembers everything it's for half an hour.
3) the site responds from port 80 and its own to the NAT IP / port
4) NAT converts the IP and port in the packet back to the user's values ​​​​and sends the packet to him
This is all necessary if the provider does not have enough for all users to receive white IPs. We have the whole house sitting on one IP.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question