Redirect traffic between LAN and OPT1
-
In Pfsense, I have two network cards, one connected to a network 192.168.56.2 which is the LAN network and the other one is connected to the network 192.168.58.2 which is the OPT1 network; these are the two IP addresses that each of the cards has in the Pfsense service. I have a server on the network 192.168.56.5 that has a web on port 8080; then I have a client on the network 192.168.58.16; how can I use port forwarding so that when I make a request to the address 192.168.58.2:8080 it redirects me to the address 192.168.56.5:8080?
-
@termal71 It’s uncommon to use the gateway’s IP like that… normally one would use either NAT reflection on the WAN IP so an existing port forward works internally, or use split DNS to connect to the server directly if you’re on the same network.
Have you tried creating a NAT rule on OPT1? (Not sure offhand if it will let you)
-
@steveits It isn't the gateway, there are ip's that i put it manually, for exemple 192.168.56.60, i only use that because they are short and easy to remember. I have 2 different networks and i want to redirect the traffic of the server of one network to another one. I don't want to use wan, because there are 2 different internal's network and i want to connect using a port forwarding
-
@termal71
58.2 is pfSense? A client on 58.x can connect to 58.2, or 56.5 directly. The latter requires a firewall rule since OPT1 will have no rules by default. -
@steveits yes, 192.168.56.2 and 192.168.58.2 are the addresses of the pfsense. I dont know what rules i have to use to do the port forwarding correctly
-
@termal71 I've never had to do it but I'm pretty sure you can create the port forward on the OPT1 network, source of OPT1 Net, destination 192.168.58.2:8080 redirect target IP of 192.168.56.5:8080.
I don't really understand why clients on OPT1 can't attempt to connect directly to 56.5 though? That would just be a firewall rule on OPT1 allowing OPT1 Net to connect to 192.168.56.5 port 8080, and no port forwarding necessary. pfSense will route between the networks. Unless pfSense isn't the router/gateway for those networks, in which case the router would typically do this and a second pfSense router isn't normally necessary.
-
@steveits I tried that yuo say, but isn't wok, i put i screenshot of what i do.
-
@termal71 Ensure any firewall on the 56.5 server allows connections from the 58.x network.
This post talks about and outbound NAT rule https://forum.netgate.com/topic/179251/port-forwarding-on-lan-interface/6 but I think that's just to get around the server only listening on its own network.
Edit: https://docs.netgate.com/pfsense/en/latest/troubleshooting/nat-port-forwards.html