This tutorial will explain forwarding ports from the VPN server to a VPN client. This is useful for development when a port on a local development machine needs to be shared publicly. Similar to services such as ngrok. Port forwarding can be enabled and modified while a user is connected, there is no need to restart a VPN server or reconnect a VPN user when changing port forwarding settings. Port forwarding changes will take effect immediately.
First configure and connect a user to a VPN server. Then open the settings for the user and add the port to the Port Forwarding field. In this example
8000/tcp will be used to forwarding tcp port 8000 from the VPN server to the client. The Port Forwarding page describes other port forwarding examples including port ranges and forwarding a server port to a different port on the client.
After selecting Save the port will be forwarded to the client. Next start a server application such as a web server. Below are commands to run a simple Go HTTP server. When running the application ensure that it is bound to
0.0.0.0 or all network interfaces. Many applications by default will only bind to
$ go get github.com/pacur/httpserver $ httpserver Listening and serving /test on [::]:8000
Then navigate to port 8000 on the Pritunl server public IP. The web servers page should be shown to verify port forwarding is working.
Updated almost 3 years ago