Pfsense setting up port forwarding

Posted on Sunday, December 16, 2018



I run a few test systems within my house and I want to have my pfsense port forward from my external IP address to my internal machines.

Here is how you do that in pfsense.







Other resources


A great video showing how to set this up properly has been done by Lawrence Systems https://youtu.be/3-DU47zDrQk [1]  I would suggest going and watching it !





My testing setup


I have a local test machine with nginx running on it.  I have the nginx setup to listen on port 8080.

So if I run a simple command like this from the box.



  > curl localhost:8080/


I get a response





Also If I tail the logs I can see when it hit.


  > tail -f /var/log/nginx/access.log






Set up port forwarding


Now to set up




Got to Firewall à  NAT




Click Add to add a Port Forwarding rule.





For my simple case of forwarding port 80 on my WAN to port 8080 on my internal machine I can leave most of the top part with the Defaults.
I do need to set the Destination Port Range to from 80 to 80.




Enter in the IP you want the WAN to redirect to.
Set the Target Port.  Then give it a Description.  Finally Click Save.





Click Apply Changes


Now test it!

I have temporarily set the dns name http_test.whiteboarcoder.com to my External IP address.

I am going to log into an external machine and run a curl while I tail the access logs.




  > curl http_test.whiteboardcoder.com





  > tail -f /var/log/nginx/access.log




There we go we are getting traffic into my network from an external source J



This is just a simple how to.  You can get far more advanced by setting up custom rules to limit who can access this port (for example from a single IP address)



References


[1]        How to Setup Port Forwarding on pfsense 2.4
https://youtu.be/3-DU47zDrQk
Accessed 12/2018





No comments:

Post a Comment