I would like to understand how udp hole punching works when two hosts, each of which behind the port limited by the NAT cone, establish a connection.
As I understand it, this happens in several stages and includes three hosts.
Host A and host B are behind a narrow NAT cone.
Host C is a server that can receive packets from hosts A and B.
- A sends the packet to C.
- C receives a packet from A and determines the external address: port
- B sends the packet to C.
- C receives a packet from B and defines B an external address: a pair of ports
- C sends an external address: port B to A
- C sends an external address: port A to B
- A sends packet_1 to B external address
- B sends packet_2 to an external address
Questions:
How does A behind a narrow NAT cone receive a packet from B, which also lies behind a restricted NAT cone?
Limited NAT cone NAT does not allow packets in which a pair of source addresses: the port does not match the destination address: port is a pair of packets sent to it that must be received. Why do other packets sent between A and B come in and B?
Is it because NAT with a limited port treats packet_2 as a response from B?
So package_1 will be lost, but package_2 will reach B. Am I right?
Thanks in advance.
source share