Static virtual IPs
Usually we use VIP to implement Destination Address Translation. Mapping a specific IP address to another specific IP address is usually referred to as Destination NAT. When the Central NAT Table is not used, FortiOS calls this a Virtual IP Address (VIP). FortiOS uses a DNAT or Virtual IP address to map an external IP address to an IP address. This address does not have to be an individual host, it can also be an address range. This mapping can include all TCP/UDP ports or, if Port Forwarding is enabled, it only refers to the configured ports. Because, the Central NAT table is disabled by default, the term Virtual IP address or VIP is predominantly used.
Virtual IP addresses are typically used to NAT external or public IP addresses to internal or private IP addresses. Using a Virtual IP address between two internal interfaces made up of private IP addresses is possible but there is rarely a reason to do so as the two networks can just use the IP addresses of the networks without the need for any address translation. Using a Virtual IP address for traffic going from the inside to the Internet is even less likely to be a requirement, but it is supported.
To create a virtual IP using the GUI:
- In Policy & Objects > Virtual IPs.
- Click Create New and select Virtual IP.
- Select a VIP Type.
Select the VIP Type depending on the IP version network on the FortiGate's external interface and internal interface.
- If IPv4 is on both sides of the FortiGate unit, select IPv4.
- If IPv6 is on both sides of the FortiGate unit, select IPv6.
- If traffic goes from an IPv4 network to an IPv6 network, select NAT46.
- If traffic goes from an IPv6 network to an IPv4 network, select NAT64.
- Enter a unique name for the virtual IP and fill in the other fields.
To create a virtual IP using the CLI:
config firewall vip edit "Internal_WebServer" set extip 10.1.100.199 set extintf "any" set mappedip "172.16.200.55" next end
To apply a virtual IP to policy using the CLI:
config firewall policy edit 8 set name "Example_Virtual_IP_in_Policy" set srcintf "wan2" set dstintf "wan1" set srcaddr "all" set dstaddr "Internal_WebServer" set action accept set schedule "always" set service "ALL" set nat enable next end