0

I am trying to send UDP Packets to a public server from a client in symmetric nat. i am able to send packets to the server However i want the server to send packets to the client under symmetric cone nat. How do i solve this? Please help me.

  • the clients can only ever sent to the public ip/port of the opposing side, since those are generally the only routeable IPs you'll have available. – Marc B Aug 11 '14 at 16:54

1 Answers1

0

Make the server send packets to the client's external IP+Port which the server detects on the arrival of first packet from client.

Basically, the router allows any outgoing UDP traffic from the devices connected to it and blocks all incoming UDP traffic. But it maintains a table of source and destination IP+port whenever a UDP packet is sent out. It allows replies from devices external to the router, provided the router must have an entry of external device IP+port.

So, you just need to use this mapping in the table now. Just make your server detect the client's external IP+port from the packet it receives from the client and then let the server send back packets to the client on that external IP+port.

This will punch a hole in the router's firewall i.e., the router firewall will now allow the incoming UDP packets as it already contains an entry in it's table. This process is called HOLE PUNCHING.

You can understand all this NAT traversal process in the various RFC's published.

Kunjan Thadani
  • 1,660
  • 3
  • 18
  • 26
  • Hi, I know it's too late to comment here.. hope you read it.. Do I need to send right back to client when server received udp packet? I mean, can server store client's ip+port information and use it later to send packets? – Tomson Jun 20 '22 at 14:22
  • Server need to respond in order to punch a hole. It can store for later use once the hole punching is complete. – Kunjan Thadani Feb 10 '23 at 12:15