You are on page 1of 11

642-902 Lab - Configure eBGP routing.

Exam: 642-902
Exam Objective: Configure eBGP routing.

Contents

Introduction Technology Background Lab Scenario Lab Objectives Lab Solution

Lab 1

Introduction
BGP is a path vector protocol which does not use metric like other routing protocols to decide on the best path. Routes learned via BGP have associated properties that are used to determine the best route to a destination when multiple paths exist to a particular destination. These properties are referred to as BGP attributes.

Technology Background
BGP uses a complex set of rules involving attributes to select the best path. The path selection process is given below: *If the path specifies a next hop that is inaccessible, drop the update. *Prefer the path with the largest weight. *If the weights are the same, prefer the path with the largest local preference. *If the local preferences are the same, prefer the path that was originated by BGP running on this router. *If no route was originated, prefer the route that has the shortest AS_path.

*If all paths have the same AS_path length, prefer the path with the lowest origin type (where IGP is lower than EGP, and EGP is lower than incomplete). *If the origin codes are the same, prefer the path with the lowest MED attribute. *If the paths have the same MED, prefer the external path over the internal path. *If the paths are still the same, prefer the path through the closest IGP neighbor. *Prefer the path with the lowest IP address, as specified by the BGP router ID. There are many ways to influence which path traffic takes in and out of an AS. All of the methods influence one attribute or another keeping the selection process given above. Let's discuss the most common ones: Weight Attribute: The Cisco proprietary weight attribute selects the exit interface when there are multiple paths to the same destination. The higher the weight value, the better the path. Weight is local to the router and the attribute is not propagated to other routers. To configure the weight attribute, use the following command: Router(config-router)#neighbor <ip-address> weight <weight> Or Router(config-router)#neighbor <peer-group-name> weight <weight> The value of weight can be anything from 0 to 65535. A route originating from a router will have a weight of 32768 by default. All other routes have a weight of 0 by default. Let's consider Figure 1 to understand how weight can be manipulated to influence the Path taken:

Figure 1 RouterD has to paths to get to AS 65101 - one from RouterB and one from RouterC. We we want the path through RouterB to be used, then the following configuration will be needed on RouterC: Router(config-router)#neighbor 192.168.1.2 weight 20 The above command will cause all routes learned from RouterB to have a weight of 20 against a weight of 0 for routers learned from RouterC. So BGP will prefer the routes learned from RouterB. Note that weight can only be used to influence route taken out of a Router and eventually out of an AS. It cannot be used to influence the path into an AS. Local Preference: Local preference is also used to influence the path taken out of an AS but there difference is that this attribute is passed to other routers within the AS. So we can set this attribute in the preferred gateway and all the routers in the AS can be influenced. In the previous example, we had configured the weight on RouterD to influence the exit path taken out of AS 65102. Instead we can configure the local preference on RouterB to influence the exit path taken by all the routers in the AS. Local preference can be configured in two ways:

Configure the default local preference for all routes on router using the following command: Router(config-router)#bgp default local-preference <value> Local preference has a range from 0 to 4,294,967,295; higher values are preferred in selecting routes. The default is 100

Local preference can be configured on neighbor or prefix basis using a route-map. The command to apply the route-map is: Router(config-router)#neighbor <ip-address> route-map <route-map-name> in Or Router(config-router)#neighbor <peer-group-name> route-map <route-map-name> in Example: Router(config)#route-map lpref permit 10 Router(config-route-map)#set local-preference 300 Router(config-route-map)#exit Router(config)#router bgp 65102 Router(config-router)#neighbor 200.1.20.10 route-map lpref in The above example will set the local preference of every route received from neighbor 200.1.20.10 to 300.

Multi-exit Discriminator (MED): Local Preference and Weight are used to influence exit path taken out of an AS. If there are multiple entry points into an AS, then it is desirable to control which path is taken by traffic coming into the AS. This is mostly desirable to better utilize resources. MED can be used to set the metric of routes advertised outside the AS. For example, In Figure 1, if we want traffic coming into AS 65102 from RouterA to take the path through RouterC, then we can configure a lower metric for routes being advertised by RouterC to RouterA. MED can be configured in two ways:

Configure Default metric for all routes advertised using the following command: Router(config-router)#default-metric <value>

The range for metric is 1 to 4294967295. Lower metric is preferred.

MED can be set on neighbor/peer-group basis using a route-map. An example is shown below: Router(config)#route-map med permit 10 Router(config-route-map)#set metric 50 Router(config-route-map)#exit Router(config)#router bgp 65102 Router(config-router)#neighbor 200.1.20.10 route-map med out

AS Path: When a route advertisement passes through an autonomous system, the AS number is added to an ordered list of AS numbers that the route advertisement has traversed. BGP will prefer a route with less number of AS listed in it. It is possible to influence the path taken by incoming traffic by adding AS number to AS Path list in a route to make it less preferred. For example, In Figure 1 if we want all traffic coming to AS 65102 to take the path from RouterB, then we can configure RouterC to add AS 65102 twice instead of once when advertising route to RouterA. This will cause routes from RouterB to appear better to RouterA. It should be noted that changing AS path can cause loops and route rejection. So only own AS should be added to the path. AS can be added by applying a route-map as shown below: Router(config)#route-map aspath permit 10 Router(config-route-map)#set as-path prepend 65102 65102 Router(config-route-map)#exit Router(config)#router bgp 65102 Router(config-router)#neighbor 200.1.20.10 route-map aspath out

Lab Scenario

We have two ISP links coming into our network which is shown in Figure 2

Figure 2 The relevant configuration of our Routers (AS 8004) is given below: RouterA#sh run ! hostname RouterA ! interface FastEthernet0/0 ip address 200.10.1.100 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 192.168.1.1 255.255.255.0

duplex auto speed auto ! router bgp 8004 no synchronization bgp log-neighbor-changes neighbor 192.168.1.2 remote-as 8004 neighbor 192.168.1.2 next-hop-self neighbor 200.10.1.1 remote-as 5001 no auto-summary RouterB#sh run ! hostname RouterB ! ! interface FastEthernet0/0 ip address 210.120.1.140 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 ip address 192.168.2.1 255.255.255.0 duplex auto

speed auto ! router bgp 8004 no synchronization bgp log-neighbor-changes neighbor 192.168.2.2 remote-as 8004 neighbor 192.168.2.2 next-hop-self neighbor 210.120.1.1 remote-as 4002 no auto-summary RouterC#sh run ! hostname RouterC ! ! interface Loopback0 ip address 140.1.1.1 255.255.255.0 ! interface FastEthernet0/0 ip address 192.168.1.2 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1

ip address 192.168.2.2 255.255.255.0 duplex auto speed auto ! router bgp 8004 no synchronization bgp log-neighbor-changes network 140.1.1.0 mask 255.255.255.0 neighbor 192.168.1.1 remote-as 8004 neighbor 192.168.2.1 remote-as 8004 no auto-summary ! Both the ISPs are advertising routes to our branch offices to RouterA and RouterB. Your task is to configure the Routers such that:

RouterC sends all traffic destined to our branch offices using the path through RouterB All traffic coming into our AS takes the path through RouterA

Lab Objectives

Configure local preference on RouterB for routes received from ISP2 Configure AS Path pre-pend on RouterB for routes advertised out.

Lab Solution
We can use weight or local preference to influence traffic path out of an AS. Here we are going to use local preference on RouterB: RouterB(config)#route-map inmap permit 10 RouterB(config-route-map)#set local-preference 500 RouterB(config-route-map)#exit

RouterB(config)#router bgp 8004 RouterB(config-router)#neighbor 210.120.1.1 route-map inmap in Let's verify the routing table and the bgp table on RouterC: RouterC#sh ip bgp BGP table version is 10, local router ID is 192.168.2.2 Status codes: s suppressed, d damped, h history, * valid, > best, i - internal, r RIB-failure, S Stale Origin codes: i - IGP, e - EGP, ? - incomplete Network *>i100.1.1.0/24 *i *>i101.1.1.0/24 *i *>i102.1.1.0/24 *i *>i103.1.1.0/24 *i *> 140.1.1.0/24 Next Hop 192.168.2.1 192.168.1.1 192.168.2.1 192.168.1.1 192.168.2.1 192.168.1.1 192.168.2.1 192.168.1.1 0.0.0.0 0 Metric LocPrf Weight Path 0 0 0 0 0 0 0 0 500 100 500 100 500 100 500 100 0 4002 i 0 5001 i 0 4002 i 0 5001 i 0 4002 i 0 5001 i 0 4002 i 0 5001 i

32768 i

RouterC#sh ip route --output truncated-Gateway of last resort is not set 102.0.0.0/24 is subnetted, 1 subnets B 102.1.1.0 [200/0] via 192.168.2.1, 00:00:27

103.0.0.0/24 is subnetted, 1 subnets B 103.1.1.0 [200/0] via 192.168.2.1, 00:00:27 100.0.0.0/24 is subnetted, 1 subnets B 100.1.1.0 [200/0] via 192.168.2.1, 00:00:27 101.0.0.0/24 is subnetted, 1 subnets B 101.1.1.0 [200/0] via 192.168.2.1, 00:00:27 140.1.0.0/24 is subnetted, 1 subnets C C C 140.1.1.0 is directly connected, Loopback0 192.168.1.0/24 is directly connected, FastEthernet0/0 192.168.2.0/24 is directly connected, FastEthernet0/1

The above outputs show that the routes learned from RouterB have a local preference of 500 and hence are used on RouterC. Next we configure RouterB to prepend AS path for routes advertised to ISP2 so that the route in from RouterA is used: Router(config)#route-map outmap permit 10 Router(config-route-map)#set as-path prepend 8004 8004 Router(config-route-map)#exit Router(config)#router bgp 8004 Router(config-router)#neighbor 210.120.1.1 route-map outmap out In real world we will not have access to the ISP2 router so we cannot really verify the configuration. In the lab we should see a similar output for "sh ip bgp" on ISP2 router: *> 140.1.1.0/24 References: Border Gateway Protocol 210.120.1.140 0 8004 8004 8004 i

You might also like