Port forwarding su Fortinet firewall

Nov 3, 2023 Howto

Piccola ricetta per effettuare un port forward su router Fortinet

Per inoltrare il traffico TCP o UDP ricevuto dall’interfaccia esterna di un FortiGate verso un server interno dobbiamo seguire questi due passi:

  • Aggiungere un Virtual IP
  • Aggiungere una regola sul firewall

In questo esempio configuriamo l’inoltro di una porta

This example describes how to configure port forwarding to allow access to an internal Windows Server PC with the Remote access protocol which uses the default port of 3389.

To add a virtual IP that forwards RDP packets

1) For FortiOS 6.0.x,6.2.x,7.0.x,7.2.x, Navigate to Policy & Objects > Virtual IPs.
1.1) Select Create New.
1.2) Add a name for the virtual IP.
1.3) Select the External Interface. This will typically be the interface that connects the FortiGate to the Internet.
1.4) Set the External IP Address/Range. The following can be used:

  • The FortiGate unit public IP.
  • If there is a cable or DSL connection with a dynamic IP, it is possible to use 0.0.0.0.
  • If the ISP provides a block of IPs that route to the FortiGate external interface, it is possible to add one of these IPs here.
    4) Set the Mapped IP Address to the internal IP address of the Windows Server PC.
    5) Select Port Forwarding.
    6) Set protocol to TCP.
    7) Set External Service Port and Map to Port. For this example, the RDP service uses port 3389. Set both External service port and Map to Port to 3389.
    8) Select OK.

Now all that’s left is to define a firewall policy that accepts RDP traffic from the Internet and forwards it to the internal Windows Server PC.

To add a firewall policy with a virtual IP.

1)In 6.0, Go to Policy & Objects -> IPv4 Policy.
In 6.4.x,7.0.x,7.2.x, Navigate to Policy & Objects => Firewall Policy.
2) Select Create New.
3) Set Source Interface to the WAN/Internet interface.
4) Set Source Addresses to all.
5) Set Destination Interface to internal.
6) Set the Destination Address to the name of the virtual IP.
7) Usually, the remainder of the options in this firewall policy does not need to be changed. For example, the Service can remain ANY, because the virtual IP only forwards packets using port 3389.
8) Select OK.

alessandro

La passione per l'informatica nasce presto, anzi, prestissimo. Un Vic-20, un registratore a cassette e tanta, tanta pazienza. E da li, senza soluzione di continuità, un passaggio da un sistema ad un altro. Oggi, professionista dell'IT, ama i sistemi semplici, affidabili e sicuri.