To Configure the Port Forwarding in FortiGate Firewall Using Virtual IP’s

Created by Boopathi Alagesan, Modified on Fri, 11 Apr at 3:55 PM by Boopathi Alagesan

Description

 
 This configuration allows users on the Internet to connect to the server protected behind a firewall, without knowing the server’s internal IP address and only through chosen ports.


 
Solution


 Sample 
Diagram:

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_1.png

 

  1. Creating three VIPs. Go to Policy & Objects -> Virtual IPs -> Create New -> Virtual IP. Enter the External IP Address/Range, and enter the mapped IP Address/Range. enable Port Forwarding and add a VIP for TCP port 80, webserver-http.

While this example maps port 80 to port 80, any valid external service port can be mapped to any listening port on the destination.

Reference Screenshot:

https://community.fortinet.com/legacyfs/online/images/kb_17986_2.png

 

  

Create a second VIP for TCP port 21, webserver-ftp.

Reference Screenshot:

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_3.png

 

Create a third VIP for TCP port 22, webserver-ssh.

Reference Screenshot:

https://community.fortinet.com/legacyfs/online/images/kb_17986_4.png

 


  1. Adding VIPs to a VIP group. Go to Policy & Objects -> Virtual IPs -> Create New -> Virtual IP Group and create a VIP group, in this example, a webserver group.

 

Under Members, include all three VIPs previously created.

 

Reference Screenshot:

 

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_5.png

 

  1. Creating a security policy. Go to Policy & Objects -> IPv4 Policy and create a security policy allowing access to a server behind the firewall.
     Set the Incoming interface to the Internet-facing interface, the outgoing interface to the interface connected to the server, and the destination address to the VIP group (webserver group).

 

NAT is disabled for this policy so that the server sees the source addresses of the packets it receives. This is the preferred setting for several reasons.


For example, the server logs will be more meaningful if they record the actual source addresses of users. Use the appropriate security profiles to protect the servers.

Reference Screenshot:

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_6.png

 

 

Note:
 In case the VIP is not shown to be chosen as the destination in policy, it is because the incoming interface of the policy is different than the interface binding configured from the VIP. Make sure the binding interface is as same as the incoming interface on the policy or use '
any' instead when configuring VIP.
 

 

 

Result:


To ensure that TCP port 80 is open, connect to the web server from a remote connection on the other side of the firewall.

Reference Screenshot:

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_7.png

 

Ensure that TCP port 21 is open by using an FTP client to connect to the FTP server from a remote connection on the other side of the firewall.

Reference Screenshot:

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_8.png

 

Finally, ensure that TCP port 22 is open by connecting to the SSH server from a remote connection on the other side of the firewall.

Reference Screenshot:

 

https://community.fortinet.com/legacyfs/online/images/kb_17986_9.png


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article