Requirement:
This article discusses how to modify the BGP routing process to send the Origin value IGP to a BGP neighbor.
Solution:In the following example, Rack3sw1 is receiving the 1.1.1.1/32 prefix from the neighbors 192.168.13.1 and 192.168.23.2. All BGP route selection items (Metric, AS-Path, Origin, etc.) have the same values for both BGP neighbors. The lowest IP address is being selected.
Rack2sw3# show ip route bgp 1.1.1.1
IP Route Entries to 1.1.1.1
Destination Gateway VLAN Type Sub-Type Metric Dist.
------------------ --------------- ---- --------- ---------- ---------- -----
1.1.1.1/32 192.168.13.1 13 bgp external 0 170
Rack2sw3# show ip bgp 1.1.1.1/255.255.255.255
Local AS : 13 Local Router-id : 192.168.13.3
BGP Table Version : 79
Network : 1.1.1.1/32 Nexthop : 192.168.13.1
Peer : 192.168.13.1 Origin : incomplete
Metric : 0 Local Pref :
Weight : 0 Calc. Local Pref : 100
Valid : Yes Type : external
Stale : No
Best : Yes (Lower Peer IP Address) <=====*****=====
AS-Path : 12
Communities :
Network : 1.1.1.1/32 Nexthop : 192.168.23.2
Peer : 192.168.23.2 Origin : incomplete
Metric : 0 Local Pref :
Weight : 0 Calc. Local Pref : 100
Valid : Yes Type : external
Stale : No
Best : No
AS-Path : 12
Communities :
The Origin selection is being advertised by switches Rack2sw1 and Rack2sw2 with a value of “incomplete” (?) for the prefix 1.1.1.1/32.
Rack2sw1# show ip bgp neighbor 192.168.13.3 advertised-routes
Status codes: * - valid, > - best, i - internal, e - external, s - stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Nexthop Metric LocalPref Weight AsPath
------------------ --------------- ---------- ---------- ------ ---------
*>e 1.1.1.1/32 192.168.13.1 0 0 32768 12 ?
Rack2sw2# show ip bgp neighbor 192.168.23.3 advertised-routes
Status codes: * - valid, > - best, i - internal, e - external, s - stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Nexthop Metric LocalPref Weight AsPath
------------------ --------------- ---------- ---------- ------ ---------
*>e 1.1.1.1/32 192.168.23.2 0 0 0 12 ?
The BGP configuration only contains neighbor statements.
Rack2sw1# show running-config router bgp
Running configuration:
router bgp 12
enable
redistribute connected
neighbor 192.168.12.2 remote-as 12
neighbor 192.168.13.3 remote-as 1
Rack2sw2# show running-config router bgp
Running configuration:
router bgp 12
enable
neighbor 192.168.12.1 remote-as 12
neighbor 192.168.23.3 remote-as 13
The current BGP implementation supports the following route selection sequence:
Prefer the route with the lowest Administrative Distance.
Prefer the route with the larger weight.
Prefer the route with the highest LOCAL_PREF value.
Prefer the path that was locally originated via a network or through redistribution from an IGP.
Configuration:The modified BGP configuration contains an out-going route-map statement. The Route-Map checks for the IP address defined in the IP-Prefix “Loopback-0” and if a match occurs, the origin value is set to igp.
Rack2sw2# show running-config router bgp
Running configuration:
router bgp 12
enable
neighbor 192.168.12.1 remote-as 12
neighbor 192.168.23.3 remote-as 13
neighbor 192.168.23.3 route-map "set-origin" out
Rack2sw2# show ip prefix-list
ip prefix-list Loopback-0: 1 entries
5 permit 1.1.1.1/32 ge 32 le 32
route-map "set-origin" permit seq 10
match ip address prefix-list "Loopback-0"
set origin igp
VerificationRack2sw2# show ip bgp neighbor 192.168.23.3 advertised-routes
Status codes: * - valid, > - best, i - internal, e - external, s - stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Nexthop Metric LocalPref Weight AsPath
------------------ --------------- ---------- ---------- ------ ---------
*>e 1.1.1.1/32 192.168.23.2 0 0 0 12 i
Rack2sw3# show ip route bgp 1.1.1.1
IP Route Entries to 1.1.1.1
Destination Gateway VLAN Type Sub-Type Metric Dist.
------------------ --------------- ---- --------- ---------- ---------- -----
1.1.1.1/32 192.168.23.2 23 bgp external 0 170
Rack2sw3# show ip bgp 1.1.1.1/255.255.255.255
Local AS : 13 Local Router-id : 192.168.13.3
BGP Table Version : 136
Network : 1.1.1.1/32 Nexthop : 192.168.13.1
Peer : 192.168.13.1 Origin : incomplete
Metric : 0 Local Pref :
Weight : 0 Calc. Local Pref : 100
Valid : Yes Type : external
Stale : No
Best : No
AS-Path : 12
Communities :
Network : 1.1.1.1/32 Nexthop : 192.168.23.2
Peer : 192.168.23.2 Origin : igp
Metric : 0 Local Pref :
Weight : 0 Calc. Local Pref : 100
Valid : Yes Type : external
Stale : No
Best : Yes (More Reliable Origin)
AS-Path : 12
Communities :
Rack2sw2# debug ip bgp packet update
0000:03:44:24.11 BGP eRouteCtrl:BGP SEND 192.168.23.2+179 -> 192.168.23.3+58542
0000:03:44:24.19 BGP eRouteCtrl:BGP SEND message type 2 (Update) length 46
0000:03:44:24.27 BGP eRouteCtrl:BGP SEND flags 0x40 code Origin(1): IGP <=====*****=====
0000:03:44:24.35 BGP eRouteCtrl:BGP SEND flags 0x40 code ASPath(2) length 4: 12
0000:03:44:24.43 BGP eRouteCtrl:BGP SEND flags 0x40 code NextHop(3): 192.168.23.2
0000:03:44:24.53 BGP eRouteCtrl:BGP SEND 1.1.1.1/32