Port Forwarding to NodeMCU Server

In this article, you will learn how to port forward to an IP and config NodeMCU as a server.

Before doing this make sure you know about public IP and Private IP NAT, PAT. You can learn it here.


  • Check your public IP.
  • Port forward on your gateway (router) to NodeMCU IP
  • Connect pc to other networks and open putty and enter NodeMCU network’s public IP to verify it.

Check your Public IP

Make sure your ISP provided a public IP to your network. You can do this by entering into your router/gateway IP address in your browser (usually or  and login to it and verify internet status/WAN status. If you see a public IP as Shown on Google then your ISP has provided you a public IP. Else it will be a private IP starting with 192. or 172. or 10.

Port Forwarding

Port forwarding is a technique by which we divert all traffic or packets that are with a specific port number to be delivered to a particular IP. This will make the machine receive every packet (request packets also) with that port number and respond for the data in the packet according to the program and algorithms that are written in the machine and send back the reply packet back to the client machine. This makes the machine as a server.

Port Forwarding to NodeMCU

In your router settings go to port forwarding option and give NodeMCU IP address and protocol TCP/IP (or both). In ‘port from’ and ‘port to’ mention the port that has to be forwarded to NodeMCU (Ex: 80 – 80).


Open putty on your PC from another network (try mobile hotspot)  and Enter public IP of the NodeMCU network with the port number. You will see the connection established if you did everything correctly.


Share this post

Share on facebook
Share on twitter
Share on linkedin
Share on email
Share on whatsapp