Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UDP punch hole for a web-server?

Tags:

People also ask

What is UDP pinhole?

UDP hole punching is one of the most common techniques used to establish UDP connections with systems behind NAT. It is called UDP hole punching because it punches a hole in the firewall of the network which allows a packet from an outside system to successfully reach the desired client on a network using NAT.

How is NAT done in UDP packet?

UDP hole punching is a commonly used technique employed in network address translation (NAT) applications for maintaining User Datagram Protocol (UDP) packet streams that traverse the NAT.

Is TCP hole punching possible?

One of the most effective methods of establishing peer-to-peer communication between hosts on different private networks is known as “hole punching.” This technique is widely used already in UDP-based applications, but essentially the same technique also works for TCP.

What is port punching?

Hole punching (or sometimes punch-through) is a technique in computer networking for establishing a direct connection between two parties in which one or both are behind firewalls or behind routers that use network address translation (NAT).


For my academic project, I am trying to achieve this. A web server node JS application listening on port 3000. So If you curl http://localhost:3000 you will get Hello World!. ( A simple web page.

Now I am running above webserver in my local machine. And my modem is behind NAT. Suppose If I port forward in the modem to myip:3000 then it is open to the world. But here is the biggest thing I am stuck - I don't want to use the modem for port forwarding, instead, I will use third party server for UDP Punch Hole.

Now my requirement is anyone from net should able to access my webserver at curl http://third-party-server-ip:3000.

What I am trying is to write another client - which opens a connection to the third party server. Say it did a hole punching at port 41234. That port is open. The third-party host can send something to that port.

Now anyone in the internet initiate this command curl http://third-party-ip:3000 to the third party host. So the third party returns the myip:udpPunchHolePort i.e., myip:41234.

anyone will again curl to myip:41234 it will be received by the node js UDP punch app, so it will redirect to localhost:3000. Finally, the anyone will receive the response from localhost:3000.

My two questions -

  1. Is there any better way than the one I proposed here?
  2. Is there any well-known node-js lib for this kind of stuff, I see, I can use UDP punch hole. Or I am thinking to write a Lib to do this in general - does this sounds like re-inventing the wheel?

Note - In this academic project, we are trying to learn how to make any local application open to the world without port forwarding in the modem.

We read on skype protocol analysis, that is also our inspiration.

Flow of request