PG1X WIKI

My Knowledge Base

User Tools

Site Tools


tech:network:cisco:bgp:bgp:med:med

BGP: MED

Topology Overview

  1. IGP: OSPF
  2. BGP: peering policy: do not advertise EBGP link inter public AS.

without route redistribution

Project name: ccna-bgp12-med

Base Configuration

  • R1
en
conf t
!
hostname R1
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 1.1.1.1 255.255.255.255
no shut
exit
int gig0/0
ip address 10.16.0.1 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.1 255.255.255.0
no shut
exit
!
ip route 3.3.3.3 255.255.255.255 11.1.3.3
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
network 10.16.0.1 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 3.3.3.3 remote-as 9598
neighbor 3.3.3.3 update-source Lo1
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 2.2.2.2 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
exit
!
end
wr
  • R2
en
conf t
!
hostname R2
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 2.2.2.2 255.255.255.255
no shut
exit
int gig0/0
ip address 10.26.0.2 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.2 255.255.255.0
no shut
exit
!
ip route 4.4.4.4 255.255.255.255 11.2.4.4
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 10.26.0.2 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 4.4.4.4 remote-as 9598
neighbor 4.4.4.4 update-source Lo1
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
exit
!
end
wr
  • R3
en
conf t
!
hostname R3
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 3.3.3.3 255.255.255.255
no shut
exit
int gig0/0
ip address 10.34.0.3 255.255.255.0
no shut
exit
int gig0/1
ip address 10.35.0.3 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.3 255.255.255.0
no shut
exit
!
ip route 1.1.1.1 255.255.255.255 11.1.3.1
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 10.34.0.3 0.0.0.0 area 0
network 10.35.0.3 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Lo1
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 4.4.4.4 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R4
en
conf t
!
hostname R4
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 4.4.4.4 255.255.255.255
no shut
exit
int gig0/0
ip address 10.45.0.4 255.255.255.0
no shut
exit
int gig0/1
ip address 10.34.0.4 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.4 255.255.255.0
no shut
exit
!
ip route 2.2.2.2 255.255.255.255 11.2.4.2
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 10.45.0.4 0.0.0.0 area 0
network 10.34.0.4 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Lo1
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R5
en
conf t
!
hostname R5
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 5.5.5.5 255.255.255.255
no shut
exit
int Lo2
ip address 12.1.0.5 255.255.0.0
no shut
exit
int Lo3
ip address 12.2.0.5 255.255.0.0
no shut
exit
int gig0/0
ip address 10.35.0.5 255.255.255.0
no shut
exit
int gig0/1
ip address 10.45.0.5 255.255.255.0
no shut
exit
!
router ospf 1
network 5.5.5.5 0.0.0.0 area 0
network 10.35.0.5 0.0.0.0 area 0
network 10.45.0.5 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 4.4.4.4 peer-group IBGP-POL1
network 12.1.0.0 mask 255.255.0.0
network 12.2.0.0 mask 255.255.0.0
exit
!
end
wr
  • R6
en
conf t
!
hostname R6
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 6.6.6.6 255.255.255.255
no shut
exit
int Lo2
ip address 10.1.0.6 255.255.0.0
no shut
exit
int Lo3
ip address 10.2.0.6 255.255.0.0
no shut
exit
int Lo4
ip address 10.3.0.6 255.255.0.0
no shut
exit
int gig0/0
ip address 10.16.0.6 255.255.255.0
no shut
exit
int gig0/1
ip address 10.26.0.6 255.255.255.0
no shut
exit
!
router ospf 1
network 6.6.6.6 0.0.0.0 area 0
network 10.16.0.6 0.0.0.0 area 0
network 10.26.0.6 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 2.2.2.2 peer-group IBGP-POL1
network 10.1.0.0 mask 255.255.0.0
network 10.2.0.0 mask 255.255.0.0
network 10.3.0.0 mask 255.255.0.0
exit
!
end
wr

Basic Configuration Veficication

R5#sh ip bgp
BGP table version is 9, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 * i 10.2.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 * i 10.3.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#ping 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/7 ms
R5#ping 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/6/9 ms
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [200/0] via 3.3.3.3, 01:05:11
B        10.2.0.0/16 [200/0] via 3.3.3.3, 01:05:11
B        10.3.0.0/16 [200/0] via 3.3.3.3, 01:05:11
R6#sh ip bgp
BGP table version is 8, local router ID is 10.3.0.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.1.0.0/16      0.0.0.0                  0         32768 i
 *>  10.2.0.0/16      0.0.0.0                  0         32768 i
 *>  10.3.0.0/16      0.0.0.0                  0         32768 i
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>i                  1.1.1.1                  0    100      0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>i                  1.1.1.1                  0    100      0 9598 i
R6#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 1.1.1.1, 01:06:22
B        12.2.0.0 [200/0] via 1.1.1.1, 01:06:22
R6#ping 12.1.0.5 source 10.3.0.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.0.5, timeout is 2 seconds:
Packet sent with a source address of 10.3.0.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/6/8 ms
R1#sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/3] via 10.16.0.6, 01:50:09, GigabitEthernet0/0
      6.0.0.0/32 is subnetted, 1 subnets
O        6.6.6.6 [110/2] via 10.16.0.6, 01:50:19, GigabitEthernet0/0
      10.0.0.0/8 is variably subnetted, 6 subnets, 3 masks
O        10.26.0.0/24 [110/2] via 10.16.0.6, 01:50:09, GigabitEthernet0/0
R1#ping 6.6.6.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 6.6.6.6, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/3/5 ms
R1#ping 2.2.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/4/5 ms
R1#ping 10.26.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.26.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/6 ms
R1#

MED w/ route-map

Before

R5#sh ip bgp
BGP table version is 9, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 * i 10.2.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 * i 10.3.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [200/0] via 3.3.3.3, 02:09:34
B        10.2.0.0/16 [200/0] via 3.3.3.3, 02:09:34
B        10.3.0.0/16 [200/0] via 3.3.3.3, 02:09:34

Configure route-map

  • R1
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 2 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 10
exit
route-map R-MED permit 20
match ip address 2
set metric 20
exit
route-map R-MED permit 30
exit
!
router bgp 65001
neighbor 3.3.3.3 route-map R-MED out
exit
!
end
  • R2
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 2 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 20
exit
route-map R-MED permit 20
match ip address 2
set metric 10
exit
route-map R-MED permit 30
exit
!
router bgp 65001
neighbor 4.4.4.4 route-map R-MED out
exit
!
end
  • R1,2
clear ip ospf process
yes
clear ip bgp *

After

R1#sh ip bgp
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.0/16      6.6.6.6                  0    100      0 i
 *>i 10.2.0.0/16      6.6.6.6                  0    100      0 i
 *>i 10.3.0.0/16      6.6.6.6                  0    100      0 i
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
R2#sh ip bgp
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.0/16      6.6.6.6                  0    100      0 i
 *>i 10.2.0.0/16      6.6.6.6                  0    100      0 i
 *>i 10.3.0.0/16      6.6.6.6                  0    100      0 i
 * i 12.1.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
 * i 12.2.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
R3#sh ip bgp
BGP table version is 32, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.1.0.0/16      1.1.1.1                 10             0 65001 i
 *>i 10.2.0.0/16      4.4.4.4                 10    100      0 65001 i
 *                    1.1.1.1                 20             0 65001 i
 * i 10.3.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>                   1.1.1.1                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R3#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [20/10] via 1.1.1.1, 00:39:42
B        10.2.0.0/16 [200/10] via 4.4.4.4, 00:39:42
B        10.3.0.0/16 [20/0] via 1.1.1.1, 00:39:42
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 5.5.5.5, 01:05:08
B        12.2.0.0 [200/0] via 5.5.5.5, 01:05:08
R4#sh ip bgp
BGP table version is 29, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *   10.1.0.0/16      2.2.2.2                 20             0 65001 i
 *>i                  3.3.3.3                 10    100      0 65001 i
 *>  10.2.0.0/16      2.2.2.2                 10             0 65001 i
 *>  10.3.0.0/16      2.2.2.2                                0 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R4#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [200/10] via 3.3.3.3, 00:39:52
B        10.2.0.0/16 [20/10] via 2.2.2.2, 00:39:52
B        10.3.0.0/16 [20/0] via 2.2.2.2, 00:39:52
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 5.5.5.5, 01:05:18
B        12.2.0.0 [200/0] via 5.5.5.5, 01:05:18
R5#sh ip bgp
BGP table version is 30, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.0/16      3.3.3.3                 10    100      0 65001 i
 *>i 10.2.0.0/16      4.4.4.4                 10    100      0 65001 i
 * i 10.3.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [200/10] via 3.3.3.3, 00:46:59
B        10.2.0.0/16 [200/10] via 4.4.4.4, 00:46:59
B        10.3.0.0/16 [200/0] via 3.3.3.3, 00:46:59
R5#ping 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/6/7 ms
R5#ping 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/5/9 ms
R5#ping 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/7/11 ms
R5#traceroute 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.1.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.35.0.3 4 msec 5 msec 3 msec
  2 11.1.3.1 4 msec 6 msec 4 msec
  3 10.16.0.6 7 msec 8 msec 6 msec
R5#traceroute 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.2.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.45.0.4 4 msec 7 msec 4 msec
  2 11.2.4.2 4 msec 5 msec 5 msec
  3 10.26.0.6 6 msec 6 msec 6 msec
R5#traceroute 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.3.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.35.0.3 4 msec 4 msec 3 msec
  2 11.1.3.1 5 msec 6 msec 5 msec
  3 10.16.0.6 9 msec 13 msec 8 msec
R6#sh ip bgp
BGP table version is 26, local router ID is 10.3.0.6
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.1.0.0/16      0.0.0.0                  0         32768 i
 *>  10.2.0.0/16      0.0.0.0                  0         32768 i
 *>  10.3.0.0/16      0.0.0.0                  0         32768 i
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>i                  1.1.1.1                  0    100      0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>i                  1.1.1.1                  0    100      0 9598 i
R6#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 1.1.1.1, 00:47:25
B        12.2.0.0 [200/0] via 1.1.1.1, 00:47:25

Base Configuration with route redistribution

Project name: ccna-bgp13-med-redistribute

Base Configuration

  • R1
en
conf t
!
hostname R1
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 1.1.1.1 255.255.255.255
no shut
exit
int gig0/0
ip address 10.16.0.1 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.1 255.255.255.0
no shut
exit
!
access-list 10 permit 10.1.0.0 0.0.255.255
access-list 10 permit 10.2.0.0 0.0.255.255
access-list 10 permit 10.3.0.0 0.0.255.255
!
ip route 3.3.3.3 255.255.255.255 11.1.3.3
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
network 10.16.0.1 0.0.0.0 area 0
redistribute bgp 65001
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 3.3.3.3 remote-as 9598
neighbor 3.3.3.3 update-source Lo1
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 2.2.2.2 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
network 10.1.0.0 mask 255.255.0.0
network 10.2.0.0 mask 255.255.0.0
network 10.3.0.0 mask 255.255.0.0
redistribute ospf 1
distribute-list 10 out ospf 1
exit
!
end
wr
  • R2
en
conf t
!
hostname R2
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 2.2.2.2 255.255.255.255
no shut
exit
int gig0/0
ip address 10.26.0.2 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.2 255.255.255.0
no shut
exit
!
access-list 10 permit 10.1.0.0 0.0.255.255
access-list 10 permit 10.2.0.0 0.0.255.255
access-list 10 permit 10.3.0.0 0.0.255.255
!
ip route 4.4.4.4 255.255.255.255 11.2.4.4
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 10.26.0.2 0.0.0.0 area 0
redistribute bgp 65001
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 4.4.4.4 remote-as 9598
neighbor 4.4.4.4 update-source Lo1
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
network 10.1.0.0 mask 255.255.0.0
network 10.2.0.0 mask 255.255.0.0
network 10.3.0.0 mask 255.255.0.0
redistribute ospf 1
distribute-list 10 out ospf 1
exit
!
end
wr
  • R3
en
conf t
!
hostname R3
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 3.3.3.3 255.255.255.255
no shut
exit
int gig0/0
ip address 10.34.0.3 255.255.255.0
no shut
exit
int gig0/1
ip address 10.35.0.3 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.3 255.255.255.0
no shut
exit
!
ip route 1.1.1.1 255.255.255.255 11.1.3.1
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 10.34.0.3 0.0.0.0 area 0
network 10.35.0.3 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Lo1
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 4.4.4.4 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R4
en
conf t
!
hostname R4
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 4.4.4.4 255.255.255.255
no shut
exit
int gig0/0
ip address 10.45.0.4 255.255.255.0
no shut
exit
int gig0/1
ip address 10.34.0.4 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.4 255.255.255.0
no shut
exit
!
ip route 2.2.2.2 255.255.255.255 11.2.4.2
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 10.45.0.4 0.0.0.0 area 0
network 10.34.0.4 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Lo1
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R5
en
conf t
!
hostname R5
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 5.5.5.5 255.255.255.255
no shut
exit
int Lo2
ip address 12.1.0.5 255.255.0.0
no shut
exit
int Lo3
ip address 12.2.0.5 255.255.0.0
no shut
exit
int gig0/0
ip address 10.35.0.5 255.255.255.0
no shut
exit
int gig0/1
ip address 10.45.0.5 255.255.255.0
no shut
exit
!
router ospf 1
network 5.5.5.5 0.0.0.0 area 0
network 10.35.0.5 0.0.0.0 area 0
network 10.45.0.5 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 4.4.4.4 peer-group IBGP-POL1
network 12.1.0.0 mask 255.255.0.0
network 12.2.0.0 mask 255.255.0.0
exit
!
end
wr
  • R6
en
conf t
!
hostname R6
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 6.6.6.6 255.255.255.255
no shut
exit
int Lo2
ip address 10.1.0.6 255.255.0.0
no shut
exit
int Lo3
ip address 10.2.0.6 255.255.0.0
no shut
exit
int Lo4
ip address 10.3.0.6 255.255.0.0
no shut
exit
int gig0/0
ip address 10.16.0.6 255.255.255.0
no shut
exit
int gig0/1
ip address 10.26.0.6 255.255.255.0
no shut
exit
!
router ospf 1
network 6.6.6.6 0.0.0.0 area 0
network 10.16.0.6 0.0.0.0 area 0
network 10.26.0.6 0.0.0.0 area 0
network 10.1.0.6 0.0.0.0 area 0
network 10.2.0.6 0.0.0.0 area 0
network 10.3.0.6 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 2.2.2.2 peer-group IBGP-POL1
exit
!
end
wr

Base Configuration Verification

R5#sh ip bgp
BGP table version is 6, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 * i 10.2.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 * i 10.3.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
B        10.1.0.6/32 [200/2] via 3.3.3.3, 00:01:46
B        10.2.0.6/32 [200/2] via 3.3.3.3, 00:01:46
B        10.3.0.6/32 [200/2] via 3.3.3.3, 00:01:46
R5#ping 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/7/11 ms
R5#ping 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/7/8 ms
R5#
R6#sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/2] via 10.16.0.1, 00:01:13, GigabitEthernet0/0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.26.0.2, 00:01:23, GigabitEthernet0/1
      12.0.0.0/16 is subnetted, 2 subnets
O E2     12.1.0.0 [110/1] via 10.26.0.2, 00:00:24, GigabitEthernet0/1
                  [110/1] via 10.16.0.1, 00:00:26, GigabitEthernet0/0
O E2     12.2.0.0 [110/1] via 10.26.0.2, 00:00:24, GigabitEthernet0/1
                  [110/1] via 10.16.0.1, 00:00:26, GigabitEthernet0/0
R6#sh ip bgp
% BGP not active

R6#sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/2] via 10.16.0.1, 00:02:16, GigabitEthernet0/0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.26.0.2, 00:02:26, GigabitEthernet0/1
      12.0.0.0/16 is subnetted, 2 subnets
O E2     12.1.0.0 [110/1] via 10.26.0.2, 00:01:27, GigabitEthernet0/1
                  [110/1] via 10.16.0.1, 00:01:29, GigabitEthernet0/0
O E2     12.2.0.0 [110/1] via 10.26.0.2, 00:01:27, GigabitEthernet0/1
                  [110/1] via 10.16.0.1, 00:01:29, GigabitEthernet0/0
R6#ping 12.1.0.5 source 10.3.0.6
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.0.5, timeout is 2 seconds:
Packet sent with a source address of 10.3.0.6
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/8 ms
R6#
R1#sh ip bgp
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 10.2.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 10.3.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
R1#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 3.3.3.3, 00:04:22
B        12.2.0.0 [20/0] via 3.3.3.3, 00:04:22
R1#sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/3] via 10.16.0.6, 00:05:29, GigabitEthernet0/0
      6.0.0.0/32 is subnetted, 1 subnets
O        6.6.6.6 [110/2] via 10.16.0.6, 00:05:29, GigabitEthernet0/0
      10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O        10.1.0.6/32 [110/2] via 10.16.0.6, 00:05:29, GigabitEthernet0/0
O        10.2.0.6/32 [110/2] via 10.16.0.6, 00:05:29, GigabitEthernet0/0
O        10.3.0.6/32 [110/2] via 10.16.0.6, 00:05:29, GigabitEthernet0/0
O        10.26.0.0/24 [110/2] via 10.16.0.6, 00:05:29, GigabitEthernet0/0
R1#
R2#sh ip bgp
BGP table version is 10, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 10.2.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 10.3.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 *>  12.1.0.0/16      4.4.4.4                                0 9598 i
 * i                  1.1.1.1                  0    100      0 9598 i
 *>  12.2.0.0/16      4.4.4.4                                0 9598 i
 * i                  1.1.1.1                  0    100      0 9598 i
R2#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:05:27
B        12.2.0.0 [20/0] via 4.4.4.4, 00:05:27
R2#sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/3] via 10.26.0.6, 00:06:19, GigabitEthernet0/0
      6.0.0.0/32 is subnetted, 1 subnets
O        6.6.6.6 [110/2] via 10.26.0.6, 00:06:29, GigabitEthernet0/0
      10.0.0.0/8 is variably subnetted, 6 subnets, 2 masks
O        10.1.0.6/32 [110/2] via 10.26.0.6, 00:06:29, GigabitEthernet0/0
O        10.2.0.6/32 [110/2] via 10.26.0.6, 00:06:29, GigabitEthernet0/0
O        10.3.0.6/32 [110/2] via 10.26.0.6, 00:06:29, GigabitEthernet0/0
O        10.16.0.0/24 [110/2] via 10.26.0.6, 00:06:29, GigabitEthernet0/0
R2#

MED w/ route-map

Before

R1#sh ip bgp
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 10.2.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 10.3.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
R2#sh ip bgp
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 10.2.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 10.3.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 12.1.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
 * i 12.2.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
R2#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 01:16:53
B        12.2.0.0 [20/0] via 4.4.4.4, 01:16:53
R5#sh ip bgp
BGP table version is 12, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 * i 10.2.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 * i 10.3.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
B        10.1.0.6/32 [200/2] via 3.3.3.3, 01:13:10
B        10.2.0.6/32 [200/2] via 3.3.3.3, 01:13:10
B        10.3.0.6/32 [200/2] via 3.3.3.3, 01:13:10
R5#
R6#sh ip bgp
% BGP not active

R6#sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/2] via 10.16.0.1, 01:14:37, GigabitEthernet0/0
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 10.26.0.2, 01:14:27, GigabitEthernet0/1
      12.0.0.0/16 is subnetted, 2 subnets
O E2     12.1.0.0 [110/1] via 10.26.0.2, 01:14:00, GigabitEthernet0/1
                  [110/1] via 10.16.0.1, 01:14:00, GigabitEthernet0/0
O E2     12.2.0.0 [110/1] via 10.26.0.2, 01:14:00, GigabitEthernet0/1
                  [110/1] via 10.16.0.1, 01:14:00, GigabitEthernet0/0
R6#

Configure route-map

  • R1
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 2 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 10
exit
route-map R-MED permit 20
match ip address 2
set metric 20
exit
route-map R-MED permit 30
exit
!
router bgp 65001
neighbor 3.3.3.3 route-map R-MED out
exit
!
end
  • R2
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 2 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 20
exit
route-map R-MED permit 20
match ip address 2
set metric 10
exit
route-map R-MED permit 30
exit
!
router bgp 65001
neighbor 4.4.4.4 route-map R-MED out
exit
!
end

After

R1#sh ip bgp
BGP table version is 6, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 10.2.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 10.3.0.6/32      2.2.2.2                  2    100      0 ?
 *>                   10.16.0.6                2         32768 ?
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
R1#
R2#sh ip bgp
BGP table version is 6, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 10.2.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 10.3.0.6/32      1.1.1.1                  2    100      0 ?
 *>                   10.26.0.6                2         32768 ?
 * i 12.1.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
 * i 12.2.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
R2#
R3#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
B        10.1.0.6/32 [20/10] via 1.1.1.1, 00:36:02
B        10.2.0.6/32 [200/10] via 4.4.4.4, 00:36:02
B        10.3.0.6/32 [20/2] via 1.1.1.1, 01:57:41
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 5.5.5.5, 01:57:37
B        12.2.0.0 [200/0] via 5.5.5.5, 01:57:37
R4#sh ip bgp
BGP table version is 14, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.6/32      3.3.3.3                 10    100      0 65001 ?
 *                    2.2.2.2                 20             0 65001 ?
 *>  10.2.0.6/32      2.2.2.2                 10             0 65001 ?
 *>  10.3.0.6/32      2.2.2.2                  2             0 65001 ?
 * i                  3.3.3.3                  2    100      0 65001 ?
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R4#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
B        10.1.0.6/32 [200/10] via 3.3.3.3, 00:00:51
B        10.2.0.6/32 [20/10] via 2.2.2.2, 00:00:51
B        10.3.0.6/32 [20/2] via 2.2.2.2, 01:22:29
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 5.5.5.5, 01:22:24
B        12.2.0.0 [200/0] via 5.5.5.5, 01:22:24
R5#sh ip bgp
BGP table version is 17, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.6/32      3.3.3.3                 10    100      0 65001 ?
 *>i 10.2.0.6/32      4.4.4.4                 10    100      0 65001 ?
 * i 10.3.0.6/32      4.4.4.4                  2    100      0 65001 ?
 *>i                  3.3.3.3                  2    100      0 65001 ?
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
B        10.1.0.6/32 [200/10] via 3.3.3.3, 00:01:06
B        10.2.0.6/32 [200/10] via 4.4.4.4, 00:01:06
B        10.3.0.6/32 [200/2] via 3.3.3.3, 01:22:38
R5#ping 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/6/12 ms
R5#ping 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/9 ms
R5#ping 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/7 ms
R5#traceroute 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.1.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.35.0.3 7 msec 3 msec 2 msec
  2 11.1.3.1 5 msec 5 msec 3 msec
  3 10.16.0.6 9 msec 5 msec 5 msec
R5#traceroute 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.2.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.45.0.4 2 msec 3 msec 3 msec
  2 11.2.4.2 2 msec 5 msec 4 msec
  3 10.26.0.6 7 msec 7 msec 5 msec
R5#traceroute 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.3.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.35.0.3 11 msec 4 msec 4 msec
  2 11.1.3.1 5 msec 5 msec 4 msec
  3 10.16.0.6 9 msec 4 msec 6 msec

Change redistribute route MED value

  • R1
conf t
!
router bgp 65001
default-metric 40
exit
!
end
conf t
!
router bgp 65001
default-metric 30
exit
!
end

Verification

R1#sh ip bgp
BGP table version is 9, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      2.2.2.2                 30    100      0 ?
 *>                   10.16.0.6               40         32768 ?
 * i 10.2.0.6/32      2.2.2.2                 30    100      0 ?
 *>                   10.16.0.6               40         32768 ?
 * i 10.3.0.6/32      2.2.2.2                 30    100      0 ?
 *>                   10.16.0.6               40         32768 ?
 * i 12.1.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
 * i 12.2.0.0/16      2.2.2.2                  0    100      0 9598 i
 *>                   3.3.3.3                                0 9598 i
R1#
R2#sh ip bgp
BGP table version is 9, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.6/32      1.1.1.1                 40    100      0 ?
 *>                   10.26.0.6               30         32768 ?
 * i 10.2.0.6/32      1.1.1.1                 40    100      0 ?
 *>                   10.26.0.6               30         32768 ?
 * i 10.3.0.6/32      1.1.1.1                 40    100      0 ?
 *>                   10.26.0.6               30         32768 ?
 * i 12.1.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
 * i 12.2.0.0/16      1.1.1.1                  0    100      0 9598 i
 *>                   4.4.4.4                                0 9598 i
R2#
R3#sh ip bgp
BGP table version is 14, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.1.0.6/32      1.1.1.1                 10             0 65001 ?
 *>i 10.2.0.6/32      4.4.4.4                 10    100      0 65001 ?
 *                    1.1.1.1                 20             0 65001 ?
 *>i 10.3.0.6/32      4.4.4.4                 30    100      0 65001 ?
 *                    1.1.1.1                 40             0 65001 ?
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R3#
R4#sh ip bgp
BGP table version is 15, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.6/32      3.3.3.3                 10    100      0 65001 ?
 *                    2.2.2.2                 20             0 65001 ?
 *>  10.2.0.6/32      2.2.2.2                 10             0 65001 ?
 *>  10.3.0.6/32      2.2.2.2                 30             0 65001 ?
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R4#
R5#sh ip bgp
BGP table version is 19, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.6/32      3.3.3.3                 10    100      0 65001 ?
 *>i 10.2.0.6/32      4.4.4.4                 10    100      0 65001 ?
 *>i 10.3.0.6/32      4.4.4.4                 30    100      0 65001 ?
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 2 masks
B        10.1.0.6/32 [200/10] via 3.3.3.3, 00:46:28
B        10.2.0.6/32 [200/10] via 4.4.4.4, 00:46:28
B        10.3.0.6/32 [200/30] via 4.4.4.4, 00:05:29
R5#ping 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/6/8 ms
R5#ping 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/5/8 ms
R5#ping 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/5/6 ms
R5#traceroute 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.1.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.35.0.3 3 msec 3 msec 3 msec
  2 11.1.3.1 4 msec 5 msec 4 msec
  3 10.16.0.6 7 msec 5 msec 6 msec
R5#traceroute 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.2.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.45.0.4 3 msec 3 msec 4 msec
  2 11.2.4.2 4 msec 4 msec 3 msec
  3 10.26.0.6 5 msec 7 msec 6 msec
R5#traceroute 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.3.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.45.0.4 2 msec 2 msec 1 msec
  2 11.2.4.2 4 msec 1 msec 3 msec
  3 10.26.0.6 5 msec 6 msec 3 msec
R5#

comparison on different AS MED value

Project name: ccna-bgp14-always-compare-med

config almost same to ccna-bgp12-med.

Base Configuration

  • R1
en
conf t
!
hostname R1
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 1.1.1.1 255.255.255.255
no shut
exit
int gig0/0
ip address 10.16.0.1 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.1 255.255.255.0
no shut
exit
!
ip route 3.3.3.3 255.255.255.255 11.1.3.3
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
network 10.16.0.1 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 3.3.3.3 remote-as 9598
neighbor 3.3.3.3 update-source Lo1
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 2.2.2.2 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
exit
!
end
wr
  • R2
en
conf t
!
hostname R2
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 2.2.2.2 255.255.255.255
no shut
exit
int gig0/0
ip address 10.26.0.2 255.255.255.0
no shut
exit
int gig0/1
ip address 11.2.7.2 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.2 255.255.255.0
no shut
exit
!
ip route 4.4.4.4 255.255.255.255 11.2.4.4
ip route 7.7.7.7 255.255.255.255 11.2.7.7
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 10.26.0.2 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 4.4.4.4 remote-as 9598
neighbor 4.4.4.4 update-source Lo1
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 7.7.7.7 remote-as 100
neighbor 7.7.7.7 update-source Lo1
neighbor 7.7.7.7 ebgp-multihop 2
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
exit
!
end
wr
  • R3
en
conf t
!
hostname R3
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 3.3.3.3 255.255.255.255
no shut
exit
int gig0/0
ip address 10.34.0.3 255.255.255.0
no shut
exit
int gig0/1
ip address 10.35.0.3 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.3 255.255.255.0
no shut
exit
!
ip route 1.1.1.1 255.255.255.255 11.1.3.1
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 10.34.0.3 0.0.0.0 area 0
network 10.35.0.3 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Lo1
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 4.4.4.4 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R4
en
conf t
!
hostname R4
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 4.4.4.4 255.255.255.255
no shut
exit
int gig0/0
ip address 10.45.0.4 255.255.255.0
no shut
exit
int gig0/1
ip address 10.34.0.4 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.4 255.255.255.0
no shut
exit
int gig0/3
ip address 11.4.7.4 255.255.255.0
no shut
exit
!
ip route 2.2.2.2 255.255.255.255 11.2.4.2
ip route 7.7.7.7 255.255.255.255 11.4.7.7
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 10.45.0.4 0.0.0.0 area 0
network 10.34.0.4 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Lo1
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 7.7.7.7 remote-as 100
neighbor 7.7.7.7 update-source Lo1
neighbor 7.7.7.7 ebgp-multihop 2
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R5
en
conf t
!
hostname R5
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 5.5.5.5 255.255.255.255
no shut
exit
int Lo2
ip address 12.1.0.5 255.255.0.0
no shut
exit
int Lo3
ip address 12.2.0.5 255.255.0.0
no shut
exit
int gig0/0
ip address 10.35.0.5 255.255.255.0
no shut
exit
int gig0/1
ip address 10.45.0.5 255.255.255.0
no shut
exit
!
router ospf 1
network 5.5.5.5 0.0.0.0 area 0
network 10.35.0.5 0.0.0.0 area 0
network 10.45.0.5 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 4.4.4.4 peer-group IBGP-POL1
network 12.1.0.0 mask 255.255.0.0
network 12.2.0.0 mask 255.255.0.0
exit
!
end
wr
  • R6
en
conf t
!
hostname R6
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 6.6.6.6 255.255.255.255
no shut
exit
int Lo2
ip address 10.1.0.6 255.255.0.0
no shut
exit
int Lo3
ip address 10.2.0.6 255.255.0.0
no shut
exit
int Lo4
ip address 10.3.0.6 255.255.0.0
no shut
exit
int gig0/0
ip address 10.16.0.6 255.255.255.0
no shut
exit
int gig0/1
ip address 10.26.0.6 255.255.255.0
no shut
exit
!
router ospf 1
network 6.6.6.6 0.0.0.0 area 0
network 10.16.0.6 0.0.0.0 area 0
network 10.26.0.6 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 2.2.2.2 peer-group IBGP-POL1
network 10.1.0.0 mask 255.255.0.0
network 10.2.0.0 mask 255.255.0.0
network 10.3.0.0 mask 255.255.0.0
exit
!
end
wr
  • R7
en
conf t
!
hostname R7
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 7.7.7.7 255.255.255.255
no shut
exit
int gig0/0
ip address 11.4.7.7 255.255.255.0
no shut
exit
int gig0/1
ip address 11.2.7.7 255.255.255.0
no shut
exit
!
ip route 2.2.2.2 255.255.255.255 11.2.7.2
ip route 4.4.4.4 255.255.255.255 11.4.7.4
!
router bgp 100
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Lo1
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 4.4.4.4 remote-as 9598
neighbor 4.4.4.4 update-source Lo1
neighbor 4.4.4.4 ebgp-multihop 2
exit
!
end
wr

Base Configuration Verification

R4#sh ip bgp
BGP table version is 8, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *   10.1.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *   10.2.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *   10.3.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R5#sh ip bgp
BGP table version is 6, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 * i 10.2.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 * i 10.3.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R7#sh ip bgp
BGP table version is 8, local router ID is 7.7.7.7
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *   10.1.0.0/16      4.4.4.4                                0 9598 65001 i
 *>                   2.2.2.2                                0 65001 i
 *   10.2.0.0/16      4.4.4.4                                0 9598 65001 i
 *>                   2.2.2.2                                0 65001 i
 *   10.3.0.0/16      4.4.4.4                                0 9598 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>  12.1.0.0/16      4.4.4.4                                0 9598 i
 *                    2.2.2.2                                0 65001 9598 i
 *>  12.2.0.0/16      4.4.4.4                                0 9598 i
 *                    2.2.2.2                                0 65001 9598 i
R7#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/16 is subnetted, 3 subnets
B        10.1.0.0 [20/0] via 2.2.2.2, 00:22:35
B        10.2.0.0 [20/0] via 2.2.2.2, 00:22:35
B        10.3.0.0 [20/0] via 2.2.2.2, 00:22:35
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:16:35
B        12.2.0.0 [20/0] via 4.4.4.4, 00:16:35
R7#
  • R7
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 1 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 5
exit
route-map R-MED permit 20
exit
!
router bgp 100
neighbor 4.4.4.4 route-map R-MED out
exit
!
end
R4#sh ip bgp
BGP table version is 8, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *   10.1.0.0/16      7.7.7.7                  5             0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *   10.2.0.0/16      7.7.7.7                  5             0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *   10.3.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
  • R4
conf t
!
router bgp 9598
bgp always-compare-med
exit
!
end
  • R1
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 2 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 10
exit
route-map R-MED permit 20
match ip address 2
set metric 20
exit
route-map R-MED permit 30
exit
!
router bgp 65001
neighbor 3.3.3.3 route-map R-MED out
exit
!
end
  • R2
conf t
!
access-list 1 permit 10.1.0.0 0.0.255.255
access-list 2 permit 10.2.0.0 0.0.255.255
!
route-map R-MED permit 10
match ip address 1
set metric 20
exit
route-map R-MED permit 20
match ip address 2
set metric 10
exit
route-map R-MED permit 30
exit
!
router bgp 65001
neighbor 4.4.4.4 route-map R-MED out
exit
!
end

R7 route is not selected because AS_PATH length long

R4#sh ip bgp
BGP table version is 17, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *   10.1.0.0/16      7.7.7.7                  5             0 100 65001 i
 *>i                  3.3.3.3                 10    100      0 65001 i
 *                    2.2.2.2                 20             0 65001 i
 *   10.2.0.0/16      7.7.7.7                  5             0 100 65001 i
 *>                   2.2.2.2                 10             0 65001 i
 *   10.3.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i

Let's say AS_PATH prepend.

  • R1,2
conf t
!
route-map R-MED permit 10
match ip address 1
set as-path prepend 65001
exit
route-map R-MED permit 20
match ip address 2
set as-path prepend 65001
exit
!
end
R4#sh ip bgp
BGP table version is 20, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>  10.1.0.0/16      7.7.7.7                  5             0 100 65001 i
 *                    2.2.2.2                 20             0 65001 65001 i
 *>  10.2.0.0/16      7.7.7.7                  5             0 100 65001 i
 *                    2.2.2.2                 10             0 65001 65001 i
 *   10.3.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R4#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [20/5] via 7.7.7.7, 00:04:13
B        10.2.0.0/16 [20/5] via 7.7.7.7, 00:04:13
B        10.3.0.0/16 [20/0] via 2.2.2.2, 00:16:35
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [200/0] via 5.5.5.5, 00:16:35
B        12.2.0.0 [200/0] via 5.5.5.5, 00:16:35
R5#sh ip bgp
BGP table version is 13, local router ID is 12.2.0.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 *>i 10.1.0.0/16      4.4.4.4                  5    100      0 100 65001 i
 *>i 10.2.0.0/16      4.4.4.4                  5    100      0 100 65001 i
 * i 10.3.0.0/16      4.4.4.4                  0    100      0 65001 i
 *>i                  3.3.3.3                  0    100      0 65001 i
 *>  12.1.0.0/16      0.0.0.0                  0         32768 i
 *>  12.2.0.0/16      0.0.0.0                  0         32768 i
R5#sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 8 subnets, 3 masks
B        10.1.0.0/16 [200/5] via 4.4.4.4, 00:03:50
B        10.2.0.0/16 [200/5] via 4.4.4.4, 00:03:50
B        10.3.0.0/16 [200/0] via 3.3.3.3, 01:39:19
R5#ping 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.1.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/9/16 ms
R5#ping 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.2.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 3/6/7 ms
R5#ping 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 10.3.0.6, timeout is 2 seconds:
Packet sent with a source address of 12.1.0.5
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 6/7/8 ms
R5#traceroute 10.1.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.1.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.45.0.4 5 msec 4 msec 3 msec
  2 11.4.7.7 7 msec 6 msec 5 msec
  3 11.2.7.2 9 msec 5 msec 4 msec
  4 10.26.0.6 7 msec 6 msec 8 msec
R5#traceroute 10.2.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.2.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.45.0.4 2 msec 3 msec 4 msec
  2 11.4.7.7 5 msec 4 msec 3 msec
  3 11.2.7.2 5 msec 5 msec 7 msec
  4 10.26.0.6 8 msec 7 msec 7 msec
R5#traceroute 10.3.0.6 source 12.1.0.5
Type escape sequence to abort.
Tracing the route to 10.3.0.6
VRF info: (vrf in name/id, vrf out name/id)
  1 10.35.0.3 4 msec 3 msec 3 msec
  2 11.1.3.1 4 msec 4 msec 4 msec
  3 10.16.0.6 6 msec 4 msec 5 msec

Let's disable bgp always-compare-med

  • R3,4
conf t
!
router bgp 9598
no bgp always-compare-med
exit
!
end

no changes…

R4#sh ip bgp
BGP table version is 25, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.0/16      3.3.3.3                 10    100      0 65001 65001 i
 *>                   7.7.7.7                  5             0 100 65001 i
 *                    2.2.2.2                 20             0 65001 65001 i
 * i 10.2.0.0/16      3.3.3.3                 20    100      0 65001 65001 i
 *>                   7.7.7.7                  5             0 100 65001 i
 *                    2.2.2.2                 10             0 65001 65001 i
 *   10.3.0.0/16      7.7.7.7                                0 100 65001 i
 * i                  3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i

RESET

  1. TODO advertise R7 BGP network command.
  2. TODO and R2-R7 link change to OSPF link.

RESET Configuration

  • R1
en
conf t
!
hostname R1
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 1.1.1.1 255.255.255.255
no shut
exit
int gig0/0
ip address 10.16.0.1 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.1 255.255.255.0
no shut
exit
!
ip route 3.3.3.3 255.255.255.255 11.1.3.3
!
router ospf 1
network 1.1.1.1 0.0.0.0 area 0
network 10.16.0.1 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 3.3.3.3 remote-as 9598
neighbor 3.3.3.3 update-source Lo1
neighbor 3.3.3.3 ebgp-multihop 2
neighbor 2.2.2.2 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
exit
!
end
wr
  • R2
en
conf t
!
hostname R2
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 2.2.2.2 255.255.255.255
no shut
exit
int gig0/0
ip address 10.26.0.2 255.255.255.0
no shut
exit
int gig0/1
ip address 11.2.7.2 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.2 255.255.255.0
no shut
exit
!
ip route 4.4.4.4 255.255.255.255 11.2.4.4
!
router ospf 1
network 2.2.2.2 0.0.0.0 area 0
network 10.26.0.2 0.0.0.0 area 0
network 11.2.7.2 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 4.4.4.4 remote-as 9598
neighbor 4.4.4.4 update-source Lo1
neighbor 4.4.4.4 ebgp-multihop 2
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 6.6.6.6 peer-group IBGP-POL1
exit
!
end
wr
  • R3
en
conf t
!
hostname R3
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 3.3.3.3 255.255.255.255
no shut
exit
int gig0/0
ip address 10.34.0.3 255.255.255.0
no shut
exit
int gig0/1
ip address 10.35.0.3 255.255.255.0
no shut
exit
int gig0/2
ip address 11.1.3.3 255.255.255.0
no shut
exit
!
ip route 1.1.1.1 255.255.255.255 11.1.3.1
!
router ospf 1
network 3.3.3.3 0.0.0.0 area 0
network 10.34.0.3 0.0.0.0 area 0
network 10.35.0.3 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 1.1.1.1 remote-as 65001
neighbor 1.1.1.1 update-source Lo1
neighbor 1.1.1.1 ebgp-multihop 2
neighbor 4.4.4.4 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R4
en
conf t
!
hostname R4
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 4.4.4.4 255.255.255.255
no shut
exit
int gig0/0
ip address 10.45.0.4 255.255.255.0
no shut
exit
int gig0/1
ip address 10.34.0.4 255.255.255.0
no shut
exit
int gig0/2
ip address 11.2.4.4 255.255.255.0
no shut
exit
int gig0/3
ip address 11.4.7.4 255.255.255.0
no shut
exit
!
ip route 2.2.2.2 255.255.255.255 11.2.4.2
ip route 7.7.7.7 255.255.255.255 11.4.7.7
!
router ospf 1
network 4.4.4.4 0.0.0.0 area 0
network 10.45.0.4 0.0.0.0 area 0
network 10.34.0.4 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor IBGP-POL1 next-hop-self
neighbor 2.2.2.2 remote-as 65001
neighbor 2.2.2.2 update-source Lo1
neighbor 2.2.2.2 ebgp-multihop 2
neighbor 7.7.7.7 remote-as 100
neighbor 7.7.7.7 update-source Lo1
neighbor 7.7.7.7 ebgp-multihop 2
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 5.5.5.5 peer-group IBGP-POL1
exit
!
end
wr
  • R5
en
conf t
!
hostname R5
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 5.5.5.5 255.255.255.255
no shut
exit
int Lo2
ip address 12.1.0.5 255.255.0.0
no shut
exit
int Lo3
ip address 12.2.0.5 255.255.0.0
no shut
exit
int gig0/0
ip address 10.35.0.5 255.255.255.0
no shut
exit
int gig0/1
ip address 10.45.0.5 255.255.255.0
no shut
exit
!
router ospf 1
network 5.5.5.5 0.0.0.0 area 0
network 10.35.0.5 0.0.0.0 area 0
network 10.45.0.5 0.0.0.0 area 0
exit
!
router bgp 9598
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 9598
neighbor IBGP-POL1 update-source Lo1
neighbor 3.3.3.3 peer-group IBGP-POL1
neighbor 4.4.4.4 peer-group IBGP-POL1
network 12.1.0.0 mask 255.255.0.0
network 12.2.0.0 mask 255.255.0.0
exit
!
end
wr
  • R6
en
conf t
!
hostname R6
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 6.6.6.6 255.255.255.255
no shut
exit
int Lo2
ip address 10.1.0.6 255.255.0.0
no shut
exit
int Lo3
ip address 10.2.0.6 255.255.0.0
no shut
exit
int Lo4
ip address 10.3.0.6 255.255.0.0
no shut
exit
int gig0/0
ip address 10.16.0.6 255.255.255.0
no shut
exit
int gig0/1
ip address 10.26.0.6 255.255.255.0
no shut
exit
!
router ospf 1
network 6.6.6.6 0.0.0.0 area 0
network 10.16.0.6 0.0.0.0 area 0
network 10.26.0.6 0.0.0.0 area 0
exit
!
router bgp 65001
neighbor IBGP-POL1 peer-group
neighbor IBGP-POL1 remote-as 65001
neighbor IBGP-POL1 update-source Lo1
neighbor 1.1.1.1 peer-group IBGP-POL1
neighbor 2.2.2.2 peer-group IBGP-POL1
network 10.1.0.0 mask 255.255.0.0
network 10.2.0.0 mask 255.255.0.0
network 10.3.0.0 mask 255.255.0.0
exit
!
end
wr
  • R7
en
conf t
!
hostname R7
no ip domain-lookup
line console 0
exec-timeout 0 0
logging synchronous
!
int Lo1
ip address 7.7.7.7 255.255.255.255
no shut
exit
int gig0/0
ip address 11.4.7.7 255.255.255.0
no shut
exit
int gig0/1
ip address 11.2.7.7 255.255.255.0
no shut
exit
!
access-list 1 deny any
!
ip route 4.4.4.4 255.255.255.255 11.4.7.4
!
router ospf 1
network 7.7.7.7 0.0.0.0 area 0
network 11.2.7.7 0.0.0.0 area 0
exit
!
router bgp 100
neighbor 4.4.4.4 remote-as 9598
neighbor 4.4.4.4 update-source Lo1
neighbor 4.4.4.4 ebgp-multihop 2
network 10.1.0.0 mask 255.255.0.0
network 10.2.0.0 mask 255.255.0.0
network 10.3.0.0 mask 255.255.0.0

exit
!
end
wr
R4#sh ip bgp
BGP table version is 8, local router ID is 4.4.4.4
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale, m multipath, b backup-path, f RT-Filter,
              x best-external, a additional-path, c RIB-compressed,
Origin codes: i - IGP, e - EGP, ? - incomplete
RPKI validation codes: V valid, I invalid, N Not found

     Network          Next Hop            Metric LocPrf Weight Path
 * i 10.1.0.0/16      3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 * i 10.2.0.0/16      3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 * i 10.3.0.0/16      3.3.3.3                  0    100      0 65001 i
 *>                   2.2.2.2                                0 65001 i
 *>i 12.1.0.0/16      5.5.5.5                  0    100      0 i
 *>i 12.2.0.0/16      5.5.5.5                  0    100      0 i
R7#
*Jan  1 01:29:28.983: %OSPF-5-ADJCHG: Process 1, Nbr 2.2.2.2 on GigabitEthernet0/1 from LOADING to FULL, Loading Done
R7#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R7(config)#router bgp 100
R7(config-router)#network 10.1.0.0 mask 255.255.0.0
R7(config-router)#network 10.2.0.0 mask 255.255.0.0
R7(config-router)#network 10.3.0.0 mask 255.255.0.0
R7(config-router)#do sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        10.1.0.0/16 [20/0] via 4.4.4.4, 00:03:15
B        10.2.0.0/16 [20/0] via 4.4.4.4, 00:03:15
B        10.3.0.0/16 [20/0] via 4.4.4.4, 00:03:15
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:23:32
B        12.2.0.0 [20/0] via 4.4.4.4, 00:23:32
R7(config-router)#do sh ip ro ospf
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      1.0.0.0/32 is subnetted, 1 subnets
O        1.1.1.1 [110/4] via 11.2.7.2, 00:02:10, GigabitEthernet0/1
      2.0.0.0/32 is subnetted, 1 subnets
O        2.2.2.2 [110/2] via 11.2.7.2, 00:02:10, GigabitEthernet0/1
      6.0.0.0/32 is subnetted, 1 subnets
O        6.6.6.6 [110/3] via 11.2.7.2, 00:02:10, GigabitEthernet0/1
      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
O        10.16.0.0/24 [110/3] via 11.2.7.2, 00:02:10, GigabitEthernet0/1
O        10.26.0.0/24 [110/2] via 11.2.7.2, 00:02:10, GigabitEthernet0/1
R7(config-router)#do sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        10.1.0.0/16 [20/0] via 4.4.4.4, 00:07:28
B        10.2.0.0/16 [20/0] via 4.4.4.4, 00:07:28
B        10.3.0.0/16 [20/0] via 4.4.4.4, 00:07:28
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:27:45
B        12.2.0.0 [20/0] via 4.4.4.4, 00:27:45
R7(config-router)#exit
R7(config)#ac
R7(config)#access-list 1 10.1.0.0 0.0.255.255
                         ^
% Invalid input detected at '^' marker.

R7(config)#access-list 1 deny 10.1.0.0 0.0.255.255
R7(config)#access-list 1 deny 10.2.0.0 0.0.255.255
R7(config)#access-list 1 deny 10.3.0.0 0.0.255.255
R7(config)#no access-list 1
R7(config)#access-list 1 deny an
R7(config)#access-list 1 deny any
R7(config)#router bgp 100
R7(config-router)#distribu
R7(config-router)#distribute-list ?
  <1-199>      IP access list number
  <1300-2699>  IP expanded access list number
  WORD         Access-list name
  gateway      Filtering incoming updates based on gateway
  prefix       Filter prefixes in routing updates

R7(config-router)#distribute-list 1 i
R7(config-router)#distribute-list 1 in
R7(config-router)#do sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        10.1.0.0/16 [20/0] via 4.4.4.4, 00:10:44
B        10.2.0.0/16 [20/0] via 4.4.4.4, 00:10:44
B        10.3.0.0/16 [20/0] via 4.4.4.4, 00:10:44
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:31:01
B        12.2.0.0 [20/0] via 4.4.4.4, 00:31:01
R7(config-router)#do sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        10.1.0.0/16 [20/0] via 4.4.4.4, 00:10:46
B        10.2.0.0/16 [20/0] via 4.4.4.4, 00:10:46
B        10.3.0.0/16 [20/0] via 4.4.4.4, 00:10:46
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:31:03
B        12.2.0.0 [20/0] via 4.4.4.4, 00:31:03
R7(config-router)#do sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        10.1.0.0/16 [20/0] via 4.4.4.4, 00:10:47
B        10.2.0.0/16 [20/0] via 4.4.4.4, 00:10:47
B        10.3.0.0/16 [20/0] via 4.4.4.4, 00:10:47
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:31:04
B        12.2.0.0 [20/0] via 4.4.4.4, 00:31:04
R7(config-router)#do sh ip ro bgp
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR

Gateway of last resort is not set

      10.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
B        10.1.0.0/16 [20/0] via 4.4.4.4, 00:12:01
B        10.2.0.0/16 [20/0] via 4.4.4.4, 00:12:01
B        10.3.0.0/16 [20/0] via 4.4.4.4, 00:12:01
      12.0.0.0/16 is subnetted, 2 subnets
B        12.1.0.0 [20/0] via 4.4.4.4, 00:32:18
B        12.2.0.0 [20/0] via 4.4.4.4, 00:32:18
R7(config-router)#no distribute-list 1 in
R7(config-router)#

This time, I can't understand this bgp always-compare-med feature behavior.

Future TODO.

References

tech/network/cisco/bgp/bgp/med/med.txt · Last modified: 2019/01/01 10:49 by wnoguchi