Skip to content
Contents
GuidesOpenWrt

OpenWrt firewall port ranges in LuCI – colon or hyphen?

Enter 19001-19003 in LuCI. On OpenWrt 25.12.6 fw4 also accepted 19001:19003 through UCI. Both endpoints and every port between them count. List separate ports if you only need the endpoints.

Enter 19001-19003 in LuCI. On OpenWrt 25.12.6 fw4 also accepted 19001:19003 through UCI. Both endpoints and every port between them count. List separate ports if you only need the endpoints.

Set the destination port

Back up first. On an isolated LAN open Network → Firewall → Traffic Rules and add RangeTest. Select LAN, IPv4 TCP, this device as destination, the destination ports shown and Reject. Use spare ports away from management services. Save and apply.

LuCI · RangeTest · TCP 19001-19003

If validation fails, use an ASCII hyphen and ascending service ports from 1 to 65535. The screenshot shows the hyphen form. Over SSH match saved, generated and active rules by name.

uci show firewall | grep -E 'name=|dest_port=|proto='
fw4 check
fw4 print | grep -F RangeTest
nft list table inet fw4 | grep -F RangeTest

Test one port outside the range

Record packets from the last command. Run this on another LAN computer with a compatible nc and the actual router address. After each probe reread the counter on the router and press Enter to continue.

for p in 19001 19002 19003 19004; do
  nc -vz -w 2 192.168.1.1 "$p"
  read -r next
done

In an isolated x86/64 VM we set each spelling through UCI and opened one new connection per port. The table shows packet increments. The screenshot shows input_lan after the second run.

TCP               19001   19002   19003   19004
19001:19003    Δ     +1      +1      +1       0
19001-19003    Δ     +1      +1      +1       0

LuCI · input_lan · RangeTest

Read the counter even if the connection fails

Expect increases for the first three only. Retransmissions can add packets. A closed service can also refuse connections. For all zeros check source zone, protocol and earlier matches. If only the generated rule exists, inspect apply errors.

Delete the test rule, apply and confirm it disappeared from the active table. For a real allow rule restrict the source and check the application response. Other LuCI forms may validate differently.

Does LuCI use UTC or local time for scheduled OpenWrt firewall rules?

Explore hardware

Comments