229
However, Router C and Router A reside in the same AS, and Router C has a greater MED, so network
10.0.0.0 learned from Router C should not be optimal.
You can configure the
bestroute compare-med
command to enable MED comparison for routes from the
same AS on Router D. After that, Router D puts the routes received from each AS into a group, selects the
route with the lowest MED from each group, and compares routes from different groups. This mechanism
avoids the above-mentioned problem. The following output shows the BGP routing table on Router D after
this feature is enabled. Network 10.0.0.0 learned from Router B is the optimal route.
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 10.0.0.0 2.2.2.2 50 0 300e
* i 3.3.3.3 50 0 200e
* i 1.1.1.1 60 0 200e
To enable MED comparison for routes on a per-AS basis (IPv4 unicast/multicast address family):
Step Command
Remarks
1.
Enter system view.
system-view
N/A
2.
Enter BGP IPv4 unicast
address family view,
BGP-VPN IPv4 unicast
address family view, or
BGP IPv4 multicast
address family view.
•
Enter BGP IPv4 unicast address
family view:
a.
bgp
as-number
b.
address-family ipv4
[
unicast
]
•
Enter BGP-VPN IPv4 unicast address
family view:
a.
bgp
as-number
b.
ip vpn-instance
vpn-instance-name
c.
address-family ipv4
[
unicast
]
•
Enter BGP IPv4 multicast address
family view:
a.
bgp
as-number
b.
address-family ipv4 multicast
N/A
3.
Enable MED comparison
for routes on a per-AS
basis.
bestroute compare-med
By default, this feature is disabled.
To enable MED comparison for routes on a per-AS basis (IPv6 unicast/multicast address family):
Step Command
Remarks
1.
Enter system view.
system-view
N/A
2.
Enter BGP IPv6 unicast
address family view or BGP
IPv6 multicast address family
view.
•
Enter BGP IPv6 unicast address
family view:
a.
bgp
as-number
b.
address-family ipv6
[
unicast
]
•
Enter BGP IPv6 multicast address
family view:
a.
bgp
as-number
b.
address-family ipv6 multicast
N/A
3.
Enable MED comparison for
routes on a per-AS basis.
bestroute compare-med
By default, this feature is
disabled.