This guide demonstrates a real-world scenario of connecting a Fortigate firewall to a web server. Specifically, we will perform VIP (Virtual IP) port forwarding to redirect traffic from the WAN interface to an internal web server (running on a Raspberry Pi).
In this scenario, we are using a Fortigate 60E firewall. The goal is to configure a Virtual IP with port forwarding to allow external access via WAN1 to an internal web server connected to LAN2.
Before beginning, it is important to ensure the management interface ports do not conflict with the services you intend to forward. In this lab, we have administrative HTTPS access on the WAN port. To prevent conflicts with the web server traffic, ensure the administrative redirect settings do not snag Port 80.
It is generally recommended to change the admin settings to use HTTPS only, or specific custom ports, leaving Port 80 free for the Virtual IP forwarding.
First, we need to determine the IP address assigned to the internal web server. You can do this through the Fortigate dashboard.
Navigate to Network > DHCP or use the DHCP monitor widget on the dashboard. Locate the device (Raspberry Pi 5) and note its IP address.
Server Internal IP: 192.168.1.x (Example used: 192.168.1.10)
The core of port forwarding on a Fortigate is the Virtual IP object. This object defines how traffic hitting the WAN interface is translated to the internal network.
Navigate to Policy & Objects > Virtual IPs and click Create New.
VIP-WAN-to-RP5).WAN1).192.168.1.10).To forward only specific traffic (like HTTP), enable the Port Forwarding toggle.
Note: If you map every protocol without port forwarding while pointing the WAN IP directly to the internal server, you risk losing administrative access to the firewall itself.
A Virtual IP object alone does not allow traffic to pass; you must create a firewall policy to permit the flow.
Navigate to Policy & Objects > Firewall Policy and click Create New.
VIP-WAN-to-RP5all.Once the policy is saved, open a web browser on an external device. Navigate to the WAN IP address (e.g., http://10.60.80.101). If configured correctly, the request will be forwarded to the internal Raspberry Pi, and you will see the web server's welcome page.
If you have multiple public IP addresses available, you may want to map a specific secondary IP directly to an internal server for all ports, allowing services like SSH, HTTPS, and HTTP simultaneously without defining individual ports.
To do this, create a new Virtual IP using a secondary WAN IP address (e.g., ending in .123):
External IP: 10.60.80.123
Mapped IP: 192.168.1.10
Port Forwarding: Disabled (Maps all ports)
By saving this and updating the firewall policy (or creating a new one) to use this new VIP object, you can access the server using the secondary IP address. This effectively makes the internal device appear as if it is directly on the internet with that specific public IP.