Accumulated IGP Metric (AIGP)
Carry comparable interior cost across cooperating ASes, instead of choosing an exit using only the cost visible inside one AS.
Six-router cost model
One operator controls AS 65123 with R1–R2–R3 and AS 65456 with R4–R5–R6. Each AS has its own OSPF domain and a full iBGP mesh over loopbacks. R2–R4 and R3–R5 are the external links. R1 and R6 originate their Loopback0 /32s.
| Link | First endpoint | Second endpoint |
|---|---|---|
| R1–R2 | R1 GigabitEthernet1: 192.0.2.1/30 | R2 GigabitEthernet1: 192.0.2.2/30 |
| R1–R3 | R1 GigabitEthernet2: 192.0.2.5/30 | R3 GigabitEthernet1: 192.0.2.6/30 |
| R2–R4 | R2 GigabitEthernet2: 192.0.2.9/30 | R4 GigabitEthernet1: 192.0.2.10/30 |
| R3–R5 | R3 GigabitEthernet2: 192.0.2.13/30 | R5 GigabitEthernet1: 192.0.2.14/30 |
| R4–R6 | R4 GigabitEthernet2: 192.0.2.17/30 | R6 GigabitEthernet1: 192.0.2.18/30 |
| R5–R6 | R5 GigabitEthernet2: 192.0.2.21/30 | R6 GigabitEthernet2: 192.0.2.22/30 |
Complete baseline configurations
R1
hostname R1
ip cef
interface Loopback0
ip ospf cost 10
ip address 10.255.0.1 255.255.255.255
exit
interface GigabitEthernet1
ip ospf cost 10
ip address 192.0.2.1 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip ospf cost 30
ip address 192.0.2.5 255.255.255.252
no shutdown
exit
router ospf 1
router-id 10.255.0.1
network 10.255.0.1 0.0.0.0 area 0
passive-interface Loopback0
ip ospf cost 10
network 192.0.2.1 0.0.0.0 area 0
network 192.0.2.5 0.0.0.0 area 0
exit
router bgp 65123
bgp router-id 10.255.0.1
no bgp default ipv4-unicast
neighbor 10.255.0.2 remote-as 65123
neighbor 10.255.0.2 update-source Loopback0
neighbor 10.255.0.3 remote-as 65123
neighbor 10.255.0.3 update-source Loopback0
address-family ipv4 unicast
no auto-summary
neighbor 10.255.0.2 activate
neighbor 10.255.0.3 activate
network 10.255.0.1 mask 255.255.255.255
exit-address-family
endR2
hostname R2
ip cef
interface Loopback0
ip ospf cost 10
ip address 10.255.0.2 255.255.255.255
exit
interface GigabitEthernet1
ip ospf cost 10
ip address 192.0.2.2 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.9 255.255.255.252
no shutdown
exit
router ospf 1
router-id 10.255.0.2
network 10.255.0.2 0.0.0.0 area 0
passive-interface Loopback0
ip ospf cost 10
network 192.0.2.2 0.0.0.0 area 0
exit
router bgp 65123
bgp router-id 10.255.0.2
no bgp default ipv4-unicast
neighbor 192.0.2.10 remote-as 65456
neighbor 10.255.0.1 remote-as 65123
neighbor 10.255.0.1 update-source Loopback0
neighbor 10.255.0.3 remote-as 65123
neighbor 10.255.0.3 update-source Loopback0
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.10 activate
neighbor 10.255.0.1 activate
neighbor 10.255.0.1 next-hop-self
neighbor 10.255.0.3 activate
neighbor 10.255.0.3 next-hop-self
exit-address-family
endR3
hostname R3
ip cef
interface Loopback0
ip ospf cost 10
ip address 10.255.0.3 255.255.255.255
exit
interface GigabitEthernet1
ip ospf cost 30
ip address 192.0.2.6 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip address 192.0.2.13 255.255.255.252
no shutdown
exit
router ospf 1
router-id 10.255.0.3
network 10.255.0.3 0.0.0.0 area 0
passive-interface Loopback0
ip ospf cost 10
network 192.0.2.6 0.0.0.0 area 0
exit
router bgp 65123
bgp router-id 10.255.0.3
no bgp default ipv4-unicast
neighbor 192.0.2.14 remote-as 65456
neighbor 10.255.0.1 remote-as 65123
neighbor 10.255.0.1 update-source Loopback0
neighbor 10.255.0.2 remote-as 65123
neighbor 10.255.0.2 update-source Loopback0
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.14 activate
neighbor 10.255.0.1 activate
neighbor 10.255.0.1 next-hop-self
neighbor 10.255.0.2 activate
neighbor 10.255.0.2 next-hop-self
exit-address-family
endR4
hostname R4
ip cef
interface Loopback0
ip ospf cost 10
ip address 10.255.0.4 255.255.255.255
exit
interface GigabitEthernet1
ip address 192.0.2.10 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip ospf cost 20
ip address 192.0.2.17 255.255.255.252
no shutdown
exit
router ospf 1
router-id 10.255.0.4
network 10.255.0.4 0.0.0.0 area 0
passive-interface Loopback0
ip ospf cost 10
network 192.0.2.17 0.0.0.0 area 0
exit
router bgp 65456
bgp router-id 10.255.0.4
no bgp default ipv4-unicast
neighbor 192.0.2.9 remote-as 65123
neighbor 10.255.0.5 remote-as 65456
neighbor 10.255.0.5 update-source Loopback0
neighbor 10.255.0.6 remote-as 65456
neighbor 10.255.0.6 update-source Loopback0
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.9 activate
neighbor 10.255.0.5 activate
neighbor 10.255.0.5 next-hop-self
neighbor 10.255.0.6 activate
neighbor 10.255.0.6 next-hop-self
exit-address-family
endR5
hostname R5
ip cef
interface Loopback0
ip ospf cost 10
ip address 10.255.0.5 255.255.255.255
exit
interface GigabitEthernet1
ip address 192.0.2.14 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip ospf cost 10
ip address 192.0.2.21 255.255.255.252
no shutdown
exit
router ospf 1
router-id 10.255.0.5
network 10.255.0.5 0.0.0.0 area 0
passive-interface Loopback0
ip ospf cost 10
network 192.0.2.21 0.0.0.0 area 0
exit
router bgp 65456
bgp router-id 10.255.0.5
no bgp default ipv4-unicast
neighbor 192.0.2.13 remote-as 65123
neighbor 10.255.0.4 remote-as 65456
neighbor 10.255.0.4 update-source Loopback0
neighbor 10.255.0.6 remote-as 65456
neighbor 10.255.0.6 update-source Loopback0
address-family ipv4 unicast
no auto-summary
neighbor 192.0.2.13 activate
neighbor 10.255.0.4 activate
neighbor 10.255.0.4 next-hop-self
neighbor 10.255.0.6 activate
neighbor 10.255.0.6 next-hop-self
exit-address-family
endR6
hostname R6
ip cef
interface Loopback0
ip ospf cost 10
ip address 10.255.0.6 255.255.255.255
exit
interface GigabitEthernet1
ip ospf cost 20
ip address 192.0.2.18 255.255.255.252
no shutdown
exit
interface GigabitEthernet2
ip ospf cost 10
ip address 192.0.2.22 255.255.255.252
no shutdown
exit
router ospf 1
router-id 10.255.0.6
network 10.255.0.6 0.0.0.0 area 0
passive-interface Loopback0
ip ospf cost 10
network 192.0.2.18 0.0.0.0 area 0
network 192.0.2.22 0.0.0.0 area 0
exit
router bgp 65456
bgp router-id 10.255.0.6
no bgp default ipv4-unicast
neighbor 10.255.0.4 remote-as 65456
neighbor 10.255.0.4 update-source Loopback0
neighbor 10.255.0.5 remote-as 65456
neighbor 10.255.0.5 update-source Loopback0
address-family ipv4 unicast
no auto-summary
neighbor 10.255.0.4 activate
neighbor 10.255.0.5 activate
network 10.255.0.6 mask 255.255.255.255
exit-address-family
endThe diagram labels symmetric OSPF interface costs. Each Loopback0 has OSPF cost 10. The external links are not included in either OSPF domain; their route-to-adjacent-next-hop cost is zero in this comparison model. Use an image supporting AIGP and a consistent metric scale across the cooperating domains.
Default BGP in both directions
R1# show ip bgp 10.255.0.6/32
BGP routing table entry for 10.255.0.6/32
Paths: (2 available, best #1)
65456
10.255.0.2 (metric 20) from 10.255.0.2
Origin IGP, metric 0, localpref 100, valid, internal, best
65456
10.255.0.3 (metric 40) from 10.255.0.3
Origin IGP, metric 0, localpref 100, valid, internal
R6# show ip bgp 10.255.0.1/32
BGP routing table entry for 10.255.0.1/32
Paths: (2 available, best #2)
65123
10.255.0.4 (metric 30) from 10.255.0.4
Origin IGP, metric 0, localpref 100, valid, internal
65123
10.255.0.5 (metric 20) from 10.255.0.5
Origin IGP, metric 0, localpref 100, valid, internal, bestThe parenthesized metric is local IGP cost to the BGP next hop; the separate metric 0 is MED. R1 chooses its nearer border R2, while R6 chooses its nearer border R5. Neither decision includes the other AS’s interior cost.
| End-to-end forwarding direction | Upper path | Lower path |
|---|---|---|
| R1 to R6 | 10 + 20 + destination loopback 10 = 40 | 30 + 10 + 10 = 50 |
| R6 to R1 | 20 + 10 + 10 = 40 | 10 + 30 + 10 = 50 |
Default R1 forwarding happens to select the lower total cost; default R6 forwarding does not.
Try MED hints
First try exporting each border’s OSPF cost to the local destination as a fixed MED. Configure the four separate border routers below; all paths compared across each boundary still come from the same neighboring AS.
Four border MED policies
R2
ip prefix-list TARGET seq 5 permit 10.255.0.1/32
route-map MED-HINT permit 10
match ip address prefix-list TARGET
set metric 20
exit
route-map MED-HINT permit 20
exitrouter bgp 65123
address-family ipv4 unicast
neighbor 192.0.2.10 route-map MED-HINT out
exit-address-familyR3
ip prefix-list TARGET seq 5 permit 10.255.0.1/32
route-map MED-HINT permit 10
match ip address prefix-list TARGET
set metric 40
exit
route-map MED-HINT permit 20
exitrouter bgp 65123
address-family ipv4 unicast
neighbor 192.0.2.14 route-map MED-HINT out
exit-address-familyR4
ip prefix-list TARGET seq 5 permit 10.255.0.6/32
route-map MED-HINT permit 10
match ip address prefix-list TARGET
set metric 30
exit
route-map MED-HINT permit 20
exitrouter bgp 65456
address-family ipv4 unicast
neighbor 192.0.2.9 route-map MED-HINT out
exit-address-familyR5
ip prefix-list TARGET seq 5 permit 10.255.0.6/32
route-map MED-HINT permit 10
match ip address prefix-list TARGET
set metric 20
exit
route-map MED-HINT permit 20
exitrouter bgp 65456
address-family ipv4 unicast
neighbor 192.0.2.13 route-map MED-HINT out
exit-address-familyR2# clear ip bgp 192.0.2.10 soft out
R3# clear ip bgp 192.0.2.14 soft out
R4# clear ip bgp 192.0.2.9 soft out
R5# clear ip bgp 192.0.2.13 soft outR1# show ip bgp 10.255.0.6/32
BGP routing table entry for 10.255.0.6/32
Paths: (1 available, best #1)
65456
10.255.0.3 (metric 40) from 10.255.0.3
Origin IGP, metric 20, localpref 100, valid, internal, best
R6# show ip bgp 10.255.0.1/32
BGP routing table entry for 10.255.0.1/32
Paths: (1 available, best #1)
65123
10.255.0.4 (metric 30) from 10.255.0.4
Origin IGP, metric 20, localpref 100, valid, internal, bestAfter outbound policies are re-evaluated, R1 is pulled toward R3’s lower remote MED, even though its local approach is more costly. R6 now chooses R4. A border that prefers an internal alternative stops advertising its former external candidate internally, explaining the single paths shown. MED compares a hint; it does not add remote and local costs.
Enable and originate AIGP
Replace the MED experiment with AIGP. Explicitly enable AIGP for every session within this trusted domain, both internal and external, on both ends. Do not export it indiscriminately to Internet or customer peers.
Enable AIGP on all six routers
R1
router bgp 65123
address-family ipv4 unicast
neighbor 10.255.0.2 aigp
neighbor 10.255.0.3 aigp
exit-address-familyR2
router bgp 65123
address-family ipv4 unicast
neighbor 192.0.2.10 aigp
neighbor 10.255.0.1 aigp
neighbor 10.255.0.3 aigp
exit-address-familyR3
router bgp 65123
address-family ipv4 unicast
neighbor 192.0.2.14 aigp
neighbor 10.255.0.1 aigp
neighbor 10.255.0.2 aigp
exit-address-familyR4
router bgp 65456
address-family ipv4 unicast
neighbor 192.0.2.9 aigp
neighbor 10.255.0.5 aigp
neighbor 10.255.0.6 aigp
exit-address-familyR5
router bgp 65456
address-family ipv4 unicast
neighbor 192.0.2.13 aigp
neighbor 10.255.0.4 aigp
neighbor 10.255.0.6 aigp
exit-address-familyR6
router bgp 65456
address-family ipv4 unicast
neighbor 10.255.0.4 aigp
neighbor 10.255.0.5 aigp
exit-address-familyAt each border, remove MED-HINT and seed only the local destination prefix’s AIGP from its installed OSPF route metric. That prefix resolves to an OSPF route on the border; the network origination remains on R1 or R6.
Replace the four MED policies with AIGP origin policies
R2
ip prefix-list TARGET seq 5 permit 10.255.0.1/32
route-map AIGP-SEED permit 10
match ip address prefix-list TARGET
set aigp-metric igp-metric
exit
route-map AIGP-SEED permit 20
exitrouter bgp 65123
address-family ipv4 unicast
no neighbor 192.0.2.10 route-map MED-HINT out
neighbor 192.0.2.10 route-map AIGP-SEED out
exit-address-familyR3
ip prefix-list TARGET seq 5 permit 10.255.0.1/32
route-map AIGP-SEED permit 10
match ip address prefix-list TARGET
set aigp-metric igp-metric
exit
route-map AIGP-SEED permit 20
exitrouter bgp 65123
address-family ipv4 unicast
no neighbor 192.0.2.14 route-map MED-HINT out
neighbor 192.0.2.14 route-map AIGP-SEED out
exit-address-familyR4
ip prefix-list TARGET seq 5 permit 10.255.0.6/32
route-map AIGP-SEED permit 10
match ip address prefix-list TARGET
set aigp-metric igp-metric
exit
route-map AIGP-SEED permit 20
exitrouter bgp 65456
address-family ipv4 unicast
no neighbor 192.0.2.9 route-map MED-HINT out
neighbor 192.0.2.9 route-map AIGP-SEED out
exit-address-familyR5
ip prefix-list TARGET seq 5 permit 10.255.0.6/32
route-map AIGP-SEED permit 10
match ip address prefix-list TARGET
set aigp-metric igp-metric
exit
route-map AIGP-SEED permit 20
exitrouter bgp 65456
address-family ipv4 unicast
no neighbor 192.0.2.13 route-map MED-HINT out
neighbor 192.0.2.13 route-map AIGP-SEED out
exit-address-familyRe-evaluate the changed outbound advertisements on each external session and wait for internal updates to converge. Existing next-hop-self settings are essential: when a router changes NEXT_HOP, AIGP accumulates the appropriate interior cost to the previous next hop rather than losing that segment.
R2# clear ip bgp 192.0.2.10 soft out
R3# clear ip bgp 192.0.2.14 soft out
R4# clear ip bgp 192.0.2.9 soft out
R5# clear ip bgp 192.0.2.13 soft out
R2# show ip bgp neighbors 192.0.2.10 | include AIGP
AIGP is enabledVerify accumulated cost
R1# show ip bgp 10.255.0.6/32
BGP routing table entry for 10.255.0.6/32
Paths: (2 available, best #1)
65456
10.255.0.2 (metric 20) from 10.255.0.2
Origin IGP, aigp-metric 30, metric 0, localpref 100, valid, internal, best
65456
10.255.0.3 (metric 40) from 10.255.0.3
Origin IGP, aigp-metric 20, metric 0, localpref 100, valid, internal
R6# show ip bgp 10.255.0.1/32
BGP routing table entry for 10.255.0.1/32
Paths: (2 available, best #1)
65123
10.255.0.4 (metric 30) from 10.255.0.4
Origin IGP, aigp-metric 20, metric 0, localpref 100, valid, internal, best
65123
10.255.0.5 (metric 20) from 10.255.0.5
Origin IGP, aigp-metric 40, metric 0, localpref 100, valid, internalCompare the accumulated value plus the local cost to its next hop. R1 compares 30 + 20 = 50 against 20 + 40 = 60; R6 compares 20 + 30 = 50 against 40 + 20 = 60. Both choose the upper path. These BGP comparison totals include resolution to the border loopback, so they differ from the forwarding-path sums above by the same 10-unit loopback cost.
On the supporting command family, eligible AIGP comparisons occur after local origination and before AS-path length. Equal earlier policy is still required. AIGP is optional non-transitive and needs deliberately comparable metric scales; do not mix incompatible cost meanings or assume every vendor has identical missing-attribute behavior.
Change an interior cost
On R1 only, raise the outgoing cost of the R1–R2 link from 10 to 50. The R1–R3 link remains 30.
interface GigabitEthernet1
ip ospf cost 50
exitR1# show ip bgp 10.255.0.6/32
BGP routing table entry for 10.255.0.6/32
Paths: (2 available, best #2)
65456
10.255.0.2 (metric 60) from 10.255.0.2
Origin IGP, aigp-metric 30, metric 0, localpref 100, valid, internal
65456
10.255.0.3 (metric 40) from 10.255.0.3
Origin IGP, aigp-metric 20, metric 0, localpref 100, valid, internal, bestR1 now compares 90 through R2 with 60 through R3. Restore cost 10 on that interface after the experiment. The reverse direction is a separate calculation because this change is directional.
interface GigabitEthernet1
ip ospf cost 10
exitFor a full baseline reset, reload the six starting configurations without the MED or AIGP policies. Before deployment, verify image support, consistent costs, intended AIGP peers, origination filters and both forwarding directions.
Key Takeaways
- AIGP is intended for cooperating ASes inside a controlled administrative domain.
- The metric scales must be comparable; the same IGP with inconsistent cost conventions can still mislead.
- Enable AIGP deliberately on the intended sessions and originate it for selected infrastructure prefixes.
- Compare accumulated cost plus local resolution cost, rather than MED alone.
- Earlier policy still matters; AIGP support and behavior must be verified on the chosen router image.
Protocol and command references
AIGP protocol rules · AIGP configuration and verification · Best-path comparison rules · Router-symbol attribution.