What is Port Forwarding ?
Suppose you have a server running on a Local Network, and one fine day, you decided that you should be able to access this server from outside the Local Network, then Port Forwarding is the key concept that comes into place. Every server has to have a Local IP address and a Local Port, using this IP:port combination, this server is accessible within the Local Network.
In order to access the same server from outside the network, you need to have another set of IP:port combination, however, this IP would be the public IP of your same server and port is the external port that you have opened in your firewall to allow someone to access your server from outside.
Steps to turn on Port Forwarding for HTTP port
- Login to pfSense as an administrator
- Navigate to Firewall > NAT
- Click on Add (Green color button)
- Following page will be opened up:
Fill the settings as follows:
Interface: The interface on which the inlet of Internet from ISP is connected and is referred to as WAN.
Protocol: TCP
Destination: WAN address
Destination Port Range:
– From port: Other
– Custom: 9999
– To port: Other
– Custom: 9999
The destination is the Server. It means that the port 9999 will serve as the external access port to the server. (You can use any port number of your choice provided, that the port number is not in use by any other server or process or firewall rule, in this case we are using 9999)
Redirect target IP: This is the Local IP address of the server.
Redirect target port: This is the Local Port on which the server is running. (HTTP refers to port 80 in the picture by default)
Description: A human-readable string to understand which server is it.
Leave the rest of the values untouched
Click the Save button and voila !! You can now access your server from outside the Network.
How to access the Network once Port Forwarding is completed ?
You need to know the Public IP address of your server. The easiest way to find this out is by using this website WhatIsMyIp.com
The public IP is the IP Address of your server on the Internet (World Wide Web).
Once you know the Public IP of your server, you can then access your server from outside in the following fashion:
http://your_server_public_ip:9999
Since we have considered the example above using port 9999, the above sample url contains port 9999.
Note: The public ip of your Local Network keeps on changing frequently, if you have not specifically subscribed for a Static IP from your ISP. So, if you are unable to access your server from outside, it is highly likely that your public IP has changed. You need to find out your public IP again using the website whatismyip.