Skip to content

create_port_forward

Create a port-forward (DNAT) rule on the WAN.

Side effects:

  • Adds a NAT rule that exposes the internal host fwd:fwd_port to the WAN on dst_port. The service is reachable from the public internet (subject to src restriction).
  • Takes effect immediately on the next inbound packet.
  • Mutates controller state. Use dry_run=True to preview the change without applying.
create_port_forward(name="plex", fwd="10.50.0.10", fwd_port="32400", dst_port="32400", proto="tcp")
Parameter Type Required Default Description
name string yes Display name for the rule.
fwd string yes Internal IP to forward to (e.g. "10.50.0.10").
fwd_port string yes Internal port (string; UniFi accepts ranges like "8000-8010").
dst_port string yes External / WAN port to listen on.
proto string no “tcp” "tcp", "udp", or "tcp_udp".
src string no “any” Source restriction. "any" (default) or a CIDR.
enabled boolean no true True enables the rule immediately.
log boolean no false True logs forwarded packets.
controller string no “default” Name of the UniFi controller to target. Defaults to "default".
dry_run boolean no false Preview the change without applying it. Returns the predicted change set.