# Port Forwarding

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**](/kb/vpn/tutorials/port-forwarding-1.md) page describes other port forwarding examples including port ranges and forwarding a server port to a different port on the client.

![](/files/TLii6vWBKIcSR3ONDgm2)

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**](https://github.com/pacur/httpserver). 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 `localhost`.

```shell
$ 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.

![](/files/SXSxehjud3UKSJKPoTb1)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pritunl.com/kb/vpn/tutorials/port-forwarding-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
