Description |
This article describes port forwarding using FortiGate Virtual IPs. |
Scope |
FortiGate. |
Solution |
Create Virtual IPs to enable port forwarding:
To forward TCP or UDP ports received by the FortiGate external interface to an internal server, follow two steps:
This example describes how to configure port forwarding to allow RDP access to an internal server on port 3389. To add a virtual IP that forwards RDP packets, follow the steps below.
All that remains is to define a firewall policy that accepts RDP traffic from the Internet and forwards it to the internal server.
To add a firewall policy with a virtual IP:
The port range can be added for port forwarding in virtual IP as below:
Make sure to add this port range as a service in the firewall policy as well.
Note: If the 'External service port' and 'Map to IPv4 port' are different, both ports must be specified in the 'Service' field of the firewall policy (if it is not set to 'any').
config firewall vip edit "Test" set extip 20.20.20.20 next end
Packet Sniffer:
diag sniffer packet any ' host a.a.a.a and port bb ' 4 0 l <----- a.a.a.a is the source IP and port bb is the NAT port.
Debug Flow:
diagnose debug disable
diagnose debug flow trace stop
diagnose debug flow filter clear
diagnose debug reset
diagnose debug flow filter addr x.x.x.x <----- x.x.x.x is the source IP.
diag deb fl sh ip en
diagnose debug flow show function-name enable
diagnose debug console timestamp enable
diagnose debug flow trace start 999
diagnose debug enable
To stop the debug:
diagnose debug disable
Note: There was a change made to behavior of the IP Pool and VIP after upgrading FortiOS to v6.4, v7.0, v7.2, and v7.4. For more information, see Technical Tip: IP pool and virtual IP behavior changes in FortiOS 6.4, 7.0, 7.2, and 7.4. |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.