BGP IPv6 - Med-always-compare

Med-always-compare

In BGP (Border Gateway Protocol) for IPv6, the "Med-always-compare" command plays a crucial role in influencing route selection based on the Multi-Exit Discriminator (MED) attribute. When enabled, this command ensures that the MED value is always considered, even if routes are received from different autonomous systems. By doing so, it provides finer control over path selection, allowing network administrators to prioritize routes based on the MED attribute. This feature proves valuable in scenarios where diverse routing policies and preferences need to be accommodated within an IPv6 BGP network, contributing to enhanced routing flexibility and efficiency.

Lab:

BGP Topology

Disclaimer

This Configuration Guide is designed to assist members to enhance their skills in particular technology area. While every effort has been made to ensure that all material is as complete and accurate as possible, the enclosed material is presented on an “as is” basis. Neither the authors nor Forum assume any liability or responsibility to any person or entity with respect to loss or damages incurred from the information contained in this guide. This configuration guide was developed by Forum. Any similarities between material presented in this configuration guide and any other material is completely coincidental.

Cisco IOS Software, Linux Software (I86BI_LINUX-ADVENTERPRISEK9-M), Version 15.2(4)M1, DEVELOPMENT TEST SOFTWARE

Task 1: Configure IPv6 BGP MED compare always

Step 1: In the configuration mode of router configure IPv6 BGP Process by following command:

R1:
int lo 100
ipv6 add 100::1/64
exit 
ipv6 unicast-routing
ipv6 router ospf 1
int s2/0
ipv6 ospf 1 area 0
int lo 1	
ipv6 ospf 1 area 0
int lo 2
ipv6 ospf 1 area 0
int lo 3
ipv6 ospf 1 area 0
int lo 100
ipv6 ospf 1 area 0
exit

router bgp 65100		
neighbor 22:0:1::2 remote-as 65000	
neighbor 22:0:1::2 ebgp-multihop 5
neighbor 22:0:1::2 update- loopback 1	
address-family ipv6				
network 100::/64
neighbor 22:0:1::2 activate			
exit

R2:
ipv6 unicast-routing
ipv6 router ospf 1
int s2/0
ipv6 ospf 1 area 0
int e0/0
ipv6 ospf 1 area 0
int lo 1
ipv6 ospf 1 area 0
int lo 2
ipv6 ospf 1 area 0
int lo 3
ipv6 ospf 1 area 0
exit

router bgp 65000
neighbor 11:0:1::1 remote-as 65100
neighbor 11:0:1::1 ebgp-multihop 5		
neighbor 11:0:1::1 update-source loopback 1	
neighbor 33:0:1::3 remote-as 65000
neighbor 33:0:1::3 update-source loopback 1
address-family ipv6
neighbor 11:0:1::1 activate
neighbor 33:0:1::3 activate
exit

R3:
ipv6 unicast-routing
ipv6 router ospf 1
int s2/0
ipv6 ospf 1 area 0
int e0/0
ipv6 ospf 1 area 0
int lo 1
ipv6 ospf 1 area 0
int lo 2
ipv6 ospf 1 area 0
int lo 3
ipv6 ospf 1 area 0
exit

router bgp 65000
neighbor 44:0:1::4 remote-as 65200
neighbor 44:0:1::4 ebgp-multihop 5
neighbor 44:0:1::4 update-source loopback 1
neighbor 22:0:1::2 remote-as 65000
neighbor 22:0:1::2 update-source loopback 1
address-family ipv6
neighbor 44:0:1::4 activate
neighbor 22:0:1::2 activate
exit

R4:
int lo 100
ipv6 add 100::4/64
exit 
ipv6 unicast-routing
ipv6 router ospf 1
int s2/0
ipv6 ospf 1 area 0
int lo 1
ipv6 ospf 1 area 0
int lo 2
ipv6 ospf 1 area 0
int lo 3
ipv6 ospf 1 area 0
int lo 100
ipv6 ospf 1 area 0
exit

router bgp 65200
neighbor 33:0:1::3 remote-as 65000
neighbor 33:0:1::3 ebgp-multihop 5
neighbor 33:0:1::3 update-source loopback 1
address-family ipv6
network 100::/64
neighbor 33:0:1::3 activate
exit

		
R2:
R2#show bgp ipv6 unicast
BGP table version is 2, local router ID is 22.0.3.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
 *>  100::/64         11:0:1::1             0                 0 	65100 i
 * i                  44:0:1::4             0    	 100      0 	65200 i
Router R2 has two path to reach the network 100::/64 via 11:0:1::1 & via 44:0:1::4
Router R2 selects 11:0:1::1 as its best path to reach 100::/64 network.