FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
Anonymous
Not applicable
Article Id 210948
Description This article describes how to configure policy routes with multiple ISPs.
Scope FortiGate.
Solution

Following is a setup where there are two LANs (LAN1 and LAN2) and two WANs (WAN1 and WAN2), The configuration shows how to route all LAN1 traffic towards WAN1 and LAN2 traffic towards WAN2 also needs communication between LAN1 & LAN2 and vice versa.

 

Network diagram:

(LAN1)10.32.5.0/24<->port7<->FortiGate firewall<->(WAN1)Port1.

(LAN2)10.33.5.0/24<->port3<->FortiGate firewall<->(WAN2)Port2.

 

In this scenario:

Create four policy routes as shown below.

 

Route configuration:

Create two policy routes for specific destinations between (LAN1 & LAN2) as shown in steps 1 and 2.

 

Explanation:

From the configured policy routes, the precedence will be taken from top to bottom. If the destined traffic matches the first route, it will not match the following routes.

 

nageentaj_0-1651238044435.png

 

From the above image, it can be explained that traffic going from LAN1 to LAN2 will match the first route, and traffic going from LAN2 to LAN1 will match route 2.

 

Route 3 will forward the traffic via WAN1 if the source traffic is from LAN1 and if the destination is, ex:8.8.8.8 as the traffic will not match the first two routes and it will hit the third route.

 

Route 4 will forward the traffic via WAN2 if the source traffic is from LAN2 and if the destination is example 8.8.8.8 as the traffic will not match the first three routes and it will hit the third route.

 

Step 1: Create a policy route for the incoming interface port7 from LAN1 going to LAN2 via the outgoing interface port3.

 

nageentaj_1-1651238080010.png

 

Step 2: Create another policy route for the incoming interface port3 from LAN2 going to LAN1 via the outgoing interface port7.

 

nageentaj_2-1651238094164.png

 

Step 3: Creating a policy route for routing LAN1 traffic towards WAN1 as shown below.

 

nageentaj_3-1651238107498.png

 

Step 4: Creating a policy route for routing LAN2 traffic towards WAN2 as shown below.

 

nageentaj_4-1651238129616.png

 

Example configuration in the CLI: 

 

config router policy
    edit 1
        set input-device "port7"
        set src "10.32.5.0/255.255.255.0"
        set dst "10.33.5.0/255.255.255.0"
        set output-device "port3"
    next
    edit 2
        set input-device "port3"
        set src "10.33.5.0/255.255.255.0"
        set dst "10.32.5.0/255.255.255.0"
        set output-device "port7"
    next
    edit 3
        set input-device "port7"
        set src "10.32.5.0/255.255.255.0"
        set dst "0.0.0.0/0.0.0.0"
        set gateway 10.5.31.254
        set output-device "port1"
    next
    edit 4
        set input-device "port3"
        set src "10.33.5.0/255.255.255.0"
        set dst "0.0.0.0/0.0.0.0"
        set gateway 10.63.254.0
        set output-device "port2"
    next
end

 

Create a Firewall policy. Two firewall policies are required. The image below shows the same.

 

nageentaj_5-1651238152986.png

 

Explanation:

As per the above image, the first policy is to route the traffic to the specific destination between LAN1 and LAN2.

The second policy explains how to route traffic to any destination via a specific WAN interface coming from a specific source.

 

The images below show the details.

 

nageentaj_6-1651238197851.png

 

Step 1: The policy below explains for communication to happen between LAN1 and LAN2 & vice versa.

 

nageentaj_7-1651238254765.png

 

Step 2: The policy below explains that the LAN1 traffic is to be routed via WAN1, and LAN2 traffic is to be routed via WAN2.

 

nageentaj_9-1651238283316.png

 

Example configuration in the CLI: 

 

config firewall policy
    edit 0
        set name "test1"
        set srcintf "port3" "port7"
        set dstintf "port3" "port7"
        set action accept
        set srcaddr "10.32.5.0/24" "10.33.5.0/24"
        set dstaddr "10.32.5.0/24" "10.33.5.0/24"
        set schedule "always"
        set service "ALL"
    next

    edit 0
        set name "test"
        set srcintf "port3" "port7"
        set dstintf "port1" "port2"
        set action accept
        set srcaddr "10.32.5.0/24" "10.33.5.0/24"
        set dstaddr "all"
        set schedule "always"
        set service "ALL"
        set nat enable
    next
end


Note: 
For Policy Route to work, there should be a matching active route in the routing table 

 

get router info routing-table all   ---> Check using this command.

 

Related articles:

Technical Tip: Using Policy routes to make two or more LAN subnets use different WAN links

Technical Tip: Configuring the Firewall Policy Routes