How to Test Port Forwarding on Linux

In order to test and ensure that Port Forwarding has been successfully enabled and the desired port is being forwarded, you can conduct the test below for verification on your Linux device.

Written By Fahad Ahmed

Updated at August 15th, 2023

In order to test and ensure that Port Forwarding has been successfully enabled and the desired port is being forwarded, you can conduct the test below for verification on your Linux device. 

  • First make sure VPN is successfully connected (preferably a PPTP or L2TP VPN connection) On the linux device where you want to enable Port Forwarding.

  • Install the ncat packages in order to run the test.

sudo apt-get install ncat

  •  After connecting to the VPN, installing the required packages and selecting the desired port, you will enter this command in the Terminal: 

ncat -l <remote port>

Then press Enter. After hitting enter, there will not be any output, this means the test is ready to go:


  • After this, use a second device not connected to your network.  We recommend using your phone, connected to mobile data.  It is very important that the second device is using a different network, if you use the same, the test will not return any results.  Open a browser on your second device and enter the following URL 

http://<VPN IP>:<Forwarded Port> 

  • Then hit enter. If you get output in the Terminal on the VPN enabled device, then Port Forwarding is working: