Previous Table of Contents Next


The MULTI_EXIT_DISC (MED) Attribute

This example shows how metrics can be used by one AS to influence routing decisions of another AS. In figure 10-8, AS3 is the customer of provider AS1. AS3 wants to generate metrics toward AS1 to influence inbound traffic. In case all BGP attributes are the same, BGP will prefer routes with a lower metric over routes with a higher metric.


Figure 10-8  Setting the MED attribute.

RTA and RTF are running IBGP internally and EBGP with the provider AS1. RTG is an internal non-BGP router, running OSPF only. Assume that RTA and RTF want to send MEDs toward AS1 to achieve the following:

1.  Incoming traffic toward network 172.16.1.0/24 takes the SF link.
2.  Incoming traffic toward all other networks should come in by using the border router that can reach these networks with a smaller internal metric. Incoming traffic toward network 172.16.112.0/24, for example, should come in on the SF link if RTA can reach this network with a smaller internal metric than RTF.

The following is the required configuration:

RTA configuration:

    router ospf 10
     passive-interface Serial0
     network 172.16.0.0 0.0.255.255 area 0

    router bgp 3
     no synchronization
     network 172.16.1.0 mask 255.255.255.0
     network 172.16.10.0 mask 255.255.255.0
     network 172.16.65.0 mask 255.255.255.192
     network 172.16.220.0 mask 255.255.255.0
     network 172.16.112.0 mask 255.255.255.0
     neighbor 172.16.1.2 remote-as 3
     neighbor 172.16.1.2 update-source Loopback0
     neighbor 172.16.20.1 remote-as 1
     neighbor 172.16.20.1 filter-list 10 out
     no auto-summary

    ip as-path access-list 10 permit ^$

RTF configuration:

    router ospf 10
     network 172.16.0.0 0.0.255.255 area 0

    router bgp 3
     no synchronization
     network 172.16.1.0 mask 255.255.255.0
     network 172.16.10.0 mask 255.255.255.0
     network 172.16.65.0 mask 255.255.255.192
     network 172.16.220.0 mask 255.255.255.0
     network 172.16.112.0 mask 255.255.255.0
     neighbor 172.16.2.254  remote-as 3
     neighbor 172.16.2.254 next-hop-self
     neighbor 192.68.5.2 remote-as 1
     neighbor 192.68.5.2 route-map SETMETRIC out
     neighbor 192.68.5.2 filter-list 10 out
     no auto-summary

    ip as-path access-list 10 permit ^$
    access-list 1 permit 172.16.1.0 0.0.0.255

    route-map SETMETRIC permit 10
     match ip address 1
     set metric 50

    route-map SETMETRIC permit 20

The preceding configuration will make RTF generate prefix 172.16.1.0/24 with a MED of 50. When AS1 gets the prefix, AS1 will compare a metric of 50 coming from RTF versus a metric of 0 coming from RTA and will prefer the SF link. All other networks will be advertised with their internal metrics carried into BGP, and AS1 will choose the entrance with a smaller metric to the destination.

    RTD#sh ip bgp
    BGP table version is 17, local router ID is 192.68.10.1
    Status codes: s suppressed, d damped, h history, * valid, > best,
    i - internal Origin codes: i - IGP, e - EGP, ? - incomplete
       Network          Next Hop          Metric LocPrf Weight Path
    *  172.16.1.0/24    192.68.5.1            50             0 3 i
    *>i                 192.68.6.2             0    100      0 3 i
    *> 172.16.10.0/24   192.68.5.1             0             0 3 i
    *> 172.16.65.0/26   192.68.5.1             0             0 3 i
    *  172.16.112.0/24  192.68.5.1            84             0 3 i
    *>i                 192.68.6.2            74    100      0 3 i
    *  172.16.220.0/24  192.68.5.1            20             0 3 i
    *>i                 192.68.6.2             0    100      0 3 i
    *> 192.68.10.0      0.0.0.0                0         32768 i
    *>i192.68.11.0      192.68.6.2             0    100      0 i

Note how RTD has preferred network 172.16.1.0/24 via next hop 192.68.6.2, which is RTC (RTC is using next-hop-self). This is because of the lower metric ( 0 <50). For all other networks, RTD is preferring routes with the smaller metrics. Note that 172.16.112.0/24 is learned via metric 74 from RTA and metric 84 from RTF. RTD will prefer the SF link to reach 172.16.112.0/24.

For BGP learned routes, an AS can also advertise these routes to another AS with the internal IGP metric carried into BGP. This is achieved by using the following command as part of a route map towards a neighbor: set metric-type internal. This would cause BGP routes to carry the internal IGP metric as MED.


Previous Table of Contents Next