IPFW How to use ipfw_nat to forward ports?

How to use ipfw_nat to forward ports?

FreeBSD 12.2 as a VPS server operating system
FreeBSD network interface is "em0"
FreeBSD IP ADDR is "10.1.1.230"
Need to forward IP ADDR is "10.1.1.254"
The port to be forwarded is "TCP 80"

Code:
cat /etc/rc.conf
firewall_enable="YES"
firewall_type="open"
gateway_enable="YES"

Code:
#!/bin/sh
kldload ipfw_nat
ipfw -q -f flush
ipfw nat 1 config if em0 redirect_port tcp 10.1.1.254:80 80
ipfw -q -add 65535 deny ip from any to any

-----------------
I run service ipfw restart to forward the port successfully
or
I run ipfw -q -add 65534 allow ip from any to any to forward the port successfully

----------------
What rules do I need to forward ports??? Because I need a whitelist to run the firewall.
 
Back
Top