Skip to main content
stroia
Staff
Staff
Aug 19, 2025 5:28 PM UTC

Technical Tip: How to avoid specific traffic matching the wrong SD-WAN rule

Description

This article describes how to prevent traffic from being sent over an undesired SD-WAN member after an undesired SD-WAN rule match.

Scope

FortiGate.

Solution

In the Fortinet SD-WAN implementation, the same type of traffic could be matched by different SD-WAN rules at different times, without configuration changes in the middle.

 

There are two common reasons for this behavior:

  • Interfaces are down.

  • Interface is up, but the Performance SLAs probe is failing.

 

Some types of traffic must be checked only against a specific set of rules; this article explains how to do so.

 

For example, consider an example Fortinet SD-WAN deployment:

  • Spokes with DIA (Direct Internet Access). 

  • VPN IPSec tunnels between Spokes and Hubs with BGP over them, used for Private (Corporate) traffic.

  • HTTP/HTTPS Internet Web traffic sent to an inspection/proxy infrastructure.

  • The rest of the internet traffic is sent with default routes to the ISP's routers.

 

The spokes' SD-WAN rules are as follows:

config system sdwan
    config service
        edit 1
            set name "Traffic_to_Hubs"
            set mode sla
            set dst "RFC1918"
                config sla
                    edit "To_Hub_1"
                        set id 1
                    next
                end
            set priority-zone "Overlay"
        next
        edit 4
            set name "Web_traffic_to_SSE_POPs"
            set mode sla
            set src "all"
            set internet-service enable
            set internet-service-app-ctrl 15893 40568
                config sla
                    edit "TO_SSE_POP_1"
                        set id 1
                    next
                    edit "TO_SSE_POP_2"
                        set id 1
                    next
               end
           set priority-zone "GRE_Zone"
     next
     edit 3
         set name "Traffic_to_Internet_DIA"
         set mode sla
         set dst "all"
         set priority-zone "Underlay"
     next
end

 

If the Performance SLA checks fail over all SD-WAN members of the SD-WAN zone called 'Overlay' (VPN IPsec tunnels) due to Underlay degradation or Hubs unavailability, Private Web traffic could be matched by rule ID 4 and sent to the SSE (Security Service Edge) provider infrastructure.

To avoid this, it is necessary for private traffic not match default routes when there are no better routes available.

Preventing private traffic from matching default routes:

  • Configure blackhole routes using administrative distance 254 for the 3 RFC1918 subnets: 10.0.0.0/8, 172.16.0.0/12, and 192.168.16.0/24, see the article Technical Tip: Use of Black hole route in site to site IPsec VPN scenarios.

  • (Optional) Configure summary static routes with an administrative distance higher than BGP routes and lower than 254 for the VPN tunnel interfaces. This allows private network traffic to be sent over VPN tunnels if there is no better interface, even if the BGP peer is down.

 

In more complicated SD-WAN environments, it is recommended to also avoid use of the 'all' address for public addresses by using RFC1918 subnets as the destination and enabling dst-negate. This is frequently done as a best practice for SD-WAN rules handling internet traffic. However, note that preventing an SD-WAN rule match does not prevent traffic from egressing on an unintended interface if no active SD-WAN rule matches the traffic.

config firewall address
    edit "n-10.0.0.0/8"
        set subnet 10.0.0.0 255.0.0.0
    next
    edit "n-172.16.0.0/12"
        set subnet 172.16.0.0 255.240.0.0
    next
    edit "n-192.168.0.0/16"
        set subnet 192.168.0.0 255.255.0.0
    next
end
 
config firewall addrgrp
    edit "RFC1918"
        set member "n-10.0.0.0/8" "n-172.16.0.0/12" "n-192.168.0.0/16"
    next
end
 
config system sdwan
    config service
        edit 3
            set name "Traffic_to_Internet_DIA"
            set dst "RFC1918"
            set dst-negate enable
            set priority-zone "Underlay"
            set comment "No Corp traffic to Internet"
        next
end

 

Important notes:

Duplicate blackhole or 'backup' static routes are not visible in the routing table until BGP is UP. It is necessary to view the routing database with the following command to see them:

get router info routing-table database

 

After any SD-WAN configuration changes like the one described above, it is still possible to observe traffic matched by the wrong SD-WAN rules, for different reasons such as:

Note: When an interface is added as SD-WAN member, it is flagged. SD-WAN only considers interfaces with an SD-WAN flag(fw_flags) port36 is not an SD-WAN member, it is not flagged as SD-WAN.

diagnose netlink  interface list port36

if=port36 family=00 type=1 index=44 mtu=1500 link=0 master=0
ref=64 state=start present fw_flags=0 flags=up broadcast run multicast 
Qdisc=mq hw_addr=b4:b2:e9:61:e5:9b broadcast_addr=ff:ff:ff:ff:ff:ff
stat: rxp=129814788761 txp=129794764027 rxb=67874488249138 txb=68019989338183 rxe=0 txe=0 rxd=0 txd=0 mc=0 collision=0 @ time=1790685310
re: rxl=0 rxo=0 rxc=0 rxf=0 rxfi=0 rxm=0
te: txa=0 txc=0 txfi=0 txh=0 txw=0
misc rxc=0 txc=0
input_type=0 state=3 arp_entry=0 refcnt=64


port36 is now flagged as SD-WAN (fw_flags=10000000).

diagnose netlink  interface list port36

if=port36 family=00 type=1 index=44 mtu=1500 link=0 master=0
ref=64 state=start present fw_flags=10000000 flags=up broadcast run multicast 
Qdisc=mq hw_addr=b4:b2:e9:61:e5:9b broadcast_addr=ff:ff:ff:ff:ff:ff
stat: rxp=129814788761 txp=129794764027 rxb=67874488249138 txb=68019989338183 rxe=0 txe=0 rxd=0 txd=0 mc=0 collision=0 @ time=1790685310
re: rxl=0 rxo=0 rxc=0 rxf=0 rxfi=0 rxm=0
te: txa=0 txc=0 txfi=0 txh=0 txw=0
misc rxc=0 txc=0
input_type=0 state=3 arp_entry=0 refcnt=64


For an SD-WAN member interface, bit 28 should be 1 if starting from 0. This should result in 1000 0000 or 3000 0000.

If the SD-WAN flags are missing, traffic will not match the configured SD-WAN rules.

    Thought Leadership. Security Summit. Thursday, November 12th, PGA National Resort, Palm Beach Gardens, FL.
    Security Operations Summit: Modernize SecOps. Operate AI-Native.AMER: November 4 | 9:00 AM PST. India and SAARC: November 5 | 10:00 AM IST. EMEA: November 5 | 10:30 AM CET. APAC: November 5 | 11:00 AM SGT