p2p with Port Restricted NAT

I tested my game with client and server having port restricted nat. It does not work.
I set NAT flag on server and connected to server using guid. I used default master server.

Then after some time I got an error:
Connection to target UNASSIGNED_SYSTEM_ADDRESS lost
Could not connect to server: NATTargetConnectionLost

Any advice is appreciated. Thanks.

That’s normal. You can’t do Peer2Peer if both server and client are behind a NAT. Because both (server and client who are behind NAT) don’t know where to send this incoming connection, so they simply drop it.

In this case, one of them as to enable a port forwarding, either by adding the port forwarding it manually or via UPnP if the router/NAT Firewall supports it.

This is also the main reason why you need to add incoming ports to P2P programs such as uTorrent, if you don’t forward ports and use it passively, you will get significantly less seeds hence worse download speeds, because you can’t download from other people who are behind NAT too and haven’t set up a forward port.