Configuring port forwarding rules

To configure a Port forwarding rule, specify the following parameters:

Parameter

Description

PASS

OK

Action to create a rule using UPL.

enabled

Enable/disable a rule:

  • enabled(yes) or enabled(true).

  • enabled(no) or enabled(false).

name

Port forwarding rule name.

Example: name("Port forwarding rule example").

desc

A description of the rule.

Example: desc("Port forwarding rule example created via CLI").

port_mapping

Rule type (specified in the rule properties).

snat_target_ip

IP address to replace the source address when NATting packets. Specify the address in "", e.g. snat_target_ip ("1.1.1.1").

rule_log

Log traffic information if the rule is triggered. The available options are:

  • rule_log(no) or rule_log(false): disable logging. If rule_log is not specified, logging is disabled.

  • rule_log(session): log the session start.

src.zone

Traffic source zone.

Example source zone: src.zone = Trusted.

For more details about how to configure zones using CLI, see the Zones section.

src.ip

Add lists of source IP addresses, MAC addresses, and domains.

To specify a list of IP addresses: src.ip = lib.network(). Provide the list name in parentheses. For more details about how to create and configure IP address lists using CLI, see the Configuring IP addresses section.

To specify a source domain list: src.ip = lib.url(). Provide the URL to which the desired domains were added in parentheses. For more details about how to create and configure URL lists using the CLI, see the Configuring URL Lists section.

To specify source MAC addresses, such as 02:00:00:00:00:00, use src.ip= 02:00:00:00:00:00.

src.geoip

Source GeoIP. Specify a country code (for example, src.geoip = AE).

Click here for the list of ISO 3166-1 country codes.

Important! The maximum number of GeoIPs that can be specified is limited to 15.

dst.ip

Add lists of destination IP addresses, MAC addresses, and domains.

To specify a list of IP addresses: dst.ip = lib.network(). Provide the list name in parentheses. For more details about how to create and configure IP address lists using CLI, see the Configuring IP addresses section.

To specify a destination domain list: dst.ip = lib.url(). Provide the URL to which the desired domains were added in parentheses. For more details about how to create and configure URL lists using the CLI, see the Configuring URL Lists section.

To specify destination MAC addresses, such as 02:00:00:00:00:00, use dst.ip= 02:00:00:00:00:00.

port_map

Port overrides for published services.

To override, specify the network protocol (TCP, UDP, SMTP, SMTPS), and the original and the new destination ports. Example: port_map(tcp, 2000, 2100).

Important! The ports listed here may not be used as they are reserved for UserGate's internal services: 2200, 8001, 4369, 9000-9100.

target_ip

DNAT destination address.

To specify a destination address: target_ip("1.1.1.1").

target_snat

Replace the source IP address with the UserGate address:

  • target_snat(yes) or target_snat(true)

  • target_snat(no) or target_snat(false)

Example command to create a port forwarding rule using UPL:

Admin@nodename# create network-policy nat-routing 8 upl-rule OK \ ... src.zone = Untrusted \ ... dst.ip = lib.network(UG_IP) \ ... target_ip("10.10.0.16") \ ... port_map(tcp, 2222, 23) \ ... rule_log(session) \ ... name(port_fw1) \ ... port_mapping \ ... Admin@nodename# show network-policy nat-routing 8 % ----------------- 8 ----------------- OK \ src.zone = Untrusted \ dst.ip = lib.network(UG_IP) \ target_ip("10.10.0.16") \ port_map(tcp, 2222, 23) \ direction(input) \ rule_log(session) \ enabled(true) \ id("1af47c3f-96a3-4e65-90e3-debf169bb745") \ name(port_fw1)\ port_mapping