Concept
Computer | IP | Port | Protocol |
---|---|---|---|
Local Private Address | 192.168.1.2 | 1234 | TCP |
Remote Public Address | 203.0.113.24 | 80 | TCP |
Router Public Address | 198.51.100.99 | 5678 | TCP |
Except the remote public address port 80, local and router ports are randomly chosen. |
NAT Traversal
First, the protocol should be based on UDP. You can do NAT traversal with TCP, but it adds another layer of complexity to an already quite complex problem, and may even require kernel customizations depending on how deep you want to go. We’re going to focus on UDP for the rest of this article.