OPNsense Forum

English Forums => General Discussion => Topic started by: rydde on April 28, 2024, 05:21:33 PM

Title: Port forwarding
Post by: rydde on April 28, 2024, 05:21:33 PM
Hi, new to opnsense and trying to replace the router in my home with opnsense. My previous router has a simple setup of the following stuff which I am trying to implement witn opnsense:

* Outbound internet access - Check
* DHCP server for LAN subnet with static IPs for certain MACs - Check

* Port forward incoming TCP on port 2222 to port 22 on server on LAN - FAILURE!!!

Why does the port forwarding not work? When setting up port fwd I go Firewal/NAT/Port forwarding and I use

- Destination: <WAN Address>
- Destination port range: other 2222...2222
- Forwarding to : Single server <IP of LAN server>
- port: 2222

I can see that besides the rule under NAT an automatic rule appears also under firewall/rules.

Still when I go to an external server and do:

> telnet <WAN address> 2222

it does not connect!

I have accepted ICMP request temporarily on WAN side just to prove that WAN address can be reachable and yes I can

ping <WAN address>

from external host successfully.

Do I have to do anything more to get the port fwd to work? Do I have to explicitly add an open TCP 2222 rule as well? Or is it something else that is needed?

Rgds,
John
Title: Re: Port forwarding
Post by: cookiemonster on April 28, 2024, 09:01:02 PM
The filter rule association at the bottom of the NAT rule is what creates that rule. Chose to add an associated/unassociated or pass rule and that will take care of that part. I tend to use "associated" types to be able to see the mapping but I only have very few rules.
Title: Re: Port forwarding
Post by: jp0469 on April 29, 2024, 09:36:10 PM
Quote from: rydde on April 28, 2024, 05:21:33 PM
* Port forward incoming TCP on port 2222 to port 22 on server on LAN - FAILURE!!!

- Forwarding to : Single server <IP of LAN server>
- port: 2222
Based on your requirement, you should change to the following:

- Forwarding to : Single server <IP of LAN server>
- port: 22