Port forwarding to a range of IP?

Hi there, I was trying to do a port forwarding, basic stuff for gaming purpose.
If I set internal ip address to any, it does not work. I have to create a rule with a specific ip then it works.
Can I provide a range like or it is not recommended?

The port forwarding is to redirect a port from a public IP to a computer on the local network.
It works like a mailman with a letter say “John Doe, 12 avenue Something, 99999 Somewhere” and at this address, many mailbox with apartment number.
The mailman should know which name goes to which mailbox.
If you set, John Doe is on mailbox 10 to 50, the mailman is not able to put the mail in the correct box.

So for port forwarding it’s the same, the router have to know which port redirect to which host.
If the host not respond or the port is closed, the router NAK the packet.

If you want a dynamic port forwarding, see the protocol uPNP.

OK makes sense.Understood. Thanks.

I want to specify a list of IP ranges as source IP, i.e. Cloudflare IP addresses:

How do I do that in Turris Luci? I can add a custom entry, but I want to add the above range.
Any idea?

Maybe … this is the right answer for solving your problem:

1 Like

There is a solution on the very bottom of this page (only you have to modify it for src_ip instead of dest_ip):

Only one src_ip is permitted, no list, too bad ;-(:

ipset is the way to go:

uci -q delete firewall.cf_set
uci set firewall.cf_set=“ipset”
uci set firewall.cf_set.name=“cf_set”
uci set firewall.cf_set.storage=“hash”
uci set firewall.cf_set.family=“ipv4”
uci set firewall.cf_set.match=“src_net”
uci set firewall.cf_set.loadfile="/root/cf_set.txt"

uci -q delete firewall.cf_proxy1
uci set firewall.cf_proxy1=“redirect”
uci set firewall.cf_proxy1.name=“Allow-Cloudflare-Nginx-80”
uci set firewall.cf_proxy1.target=“DNAT”
uci set firewall.cf_proxy1.src=“wan”
uci set firewall.cf_proxy1.dest=“lan”
uci set firewall.cf_proxy1.proto=“tcp”
uci set firewall.cf_proxy1.family=“ipv4”
uci set firewall.cf_proxy1.src_dport=“80”
uci set firewall.cf_proxy1.dest_port=“21080”
uci set firewall.cf_proxy1.ipset=“cf_set”
uci set firewall.cf_proxy1.dest_ip=“”

uci -q delete firewall.cf_proxy2
uci set firewall.cf_proxy2=“redirect”
uci set firewall.cf_proxy2.name=“Allow-Cloudflare-Nginx-443”
uci set firewall.cf_proxy2.target=“DNAT”
uci set firewall.cf_proxy2.src=“wan”
uci set firewall.cf_proxy2.dest=“lan”
uci set firewall.cf_proxy2.proto=“tcp”
uci set firewall.cf_proxy2.family=“ipv4”
uci set firewall.cf_proxy2.src_dport=“443”
uci set firewall.cf_proxy2.dest_port=“21443”
uci set firewall.cf_proxy2.ipset=“cf_set”
uci set firewall.cf_proxy2.dest_ip=“”

cat cf_set.txt