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.
princes
Staff
Staff
Article Id 420338
Description This article describes the behavior while manipulating the BGP inbound routes based on Local Preference. 
Scope FortiGate.
Solution

During BGP outbound path manipulation, Local Preference can be utilized.

If routing table details are seen, then the local preference value will be the default one (not the updated one).

 

This does not indicate the correct Local preference applied, which is expected. To verify this, check the BGP network info:

 

get router info bgp neighbors 10.20.20.1 received-routes
VRF 0 BGP table version is 1, local router ID is 10.10.10.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal
Origin codes: i - IGP, e - EGP, ? - incomplete

Network Next Hop Metric LocPrf Weight RouteTag Path
*>i10.10.50.1/32 10.20.20.1 100 0 0 i <-/->              ---------------------------------> Local preference not. modified after applying route-map.

 

get router info bgp network 10.10.50.1
VRF 0 BGP routing table entry for 10.10.50.1/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
Original VRF 0
Local
10.20.20.1 from 10.20.20.1 (10.10.10.1)
Origin IGP distance 200 metric 0, localpref 200, valid, internal, best  --------> Local preference updated as per the route-map.

 

The reason why the updated Local Preference is not seen in received-routes because it shows whatever routes are received from a neighbor before applying a route-map.

 

Below is an example to achieve the same:

 

Create a prefix-list:

 

config router prefix-list
    edit "Local_pref"
        config rule
            edit 1
                set prefix 10.10.50.1 255.255.255.255
                unset ge
                unset le
            next

 

Create a route-map and call the prefix-list:

 

config router route-map
    edit "Local-Pref"
        config rule
            edit 1
                set match-ip-address "Local_pref"
                unset set-ip-prefsrc
                set set-local-preference 200
            next
end

 

Attach it to a BGP neighbor:

 

config router bgp
    set as 65000
    set router-id 10.10.10.5
    set recursive-next-hop enable
        config neighbor
            edit "10.20.20.1"
                set capability-graceful-restart enable
                set soft-reconfiguration enable
                set remote-as 65000
                set route-map-in "Local-Pref"
                set update-source "Loopback_BGP"
            next

 

Before applying the route-map:

 

get router info routing-table details 10.10.50.1

Routing table for VRF=0
Routing entry for 10.10.50.1/32
Known via "bgp", distance 200, metric 0, best
Last update 3d01h17m ago
* vrf 0 10.20.20.1 priority 1 (recursive via Spoke1_VPN2 tunnel 10.0.0.1)
(recursive via Spoke1_VPN1 tunnel 10.5.31.165)

 

After applying the route-map:

 

erbium-kvm39 # get router info routing-table details 10.10.50.1

Routing table for VRF=0
Routing entry for 10.10.50.1/32
Known via "bgp", distance 200, metric 0, best
Last update 3d01h20m ago
* vrf 0 10.20.20.1 priority 1 (recursive via Spoke1_VPN2 tunnel 10.0.0.1)

 

get router info bgp network 10.10.50.1
VRF 0 BGP routing table entry for 10.10.50.1/32
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Not advertised to any peer
Original VRF 0
Local
10.20.20.1 from 10.20.20.1 (10.10.10.1)
Origin IGP distance 200 metric 0, localpref 200, valid, internal, best  

 

Additional Note:

  • Soft-reconfiguration inbound must be enabled to view received-routes:


set soft-reconfiguration enable

 

  • For inbound route-maps, Local Preference is applied locally and is not sent back to peers.
  • If local preference is not taking effect: 
    • Ensure the prefix matches the prefix-list.
    • Ensure route-map rules are ordered correctly.

 

Related article: 

Technical Tip: Use case of a Local preference and AS path prepending for route manipulation in BGP