www.howtonetwork.org

CCNA & CCNP Certifcation Training

  • About
  • Contact
  • FAQ
  • Join
  • Home
  • CCNA
    • ICND1
    • ICND2
    • 101 CCNA LABS
  • CCNP
    • ROUTE
    • SWITCH
    • TSHOOT
    • 101 CCNP LABS
  • CompTIA
    • Security+
    • Network+
  • Design
    • CCDA
    • CCDP
You are here: Home / 101 CCNP Labs Solutions / CCNP Lab 040 Solution: Border Gateway Protocol Lab

CCNP Lab 040 Solution: Border Gateway Protocol Lab

Lab Objective:

The focus of this lab is to understand BGP implementation and configuration in Cisco IOS routers. Additional technologies include summarization, route filtering and path control.

Lab Topology:

The lab network topology is illustrated below:

department640

 

IMPORTANT NOTE

If you are using the www.howtonetwork.net racks, please bring up the LAN interfaces connected to the routers by issuing the no shutdown command on the connected switches. If you are using a home lab with no
Switches, you can bring up the LAN interfaces using the following configurations on your routers:

interface fastethernet 0/0
 no keepalive
 loopback
 no shutdown

Alternately, you can simply connect the interfaces to a hub or switch if you have one available in your own lab.

 

Task 1

Configure hostnames and IP addressing on all routers as illustrated in the network topology. Additionally, configure a Loopback 0 interface on all routers using the router number and a host mask. For example, on R1, configure Loopback 0 with the IP address 1.1.1.1/32, on R2 configure interface Loopback 0 with the IP address 2.2.2.2/32 and so forth for R3 and also R4.

Task 2

Configure BGP as illustrated in the topology. Use the Loopback 0 addresses for peering. Do NOT configure any IGPs. Instead, use static routes only. R1 should peer with R2 and R4. R2 should peer with R1 and R3. R3 should peer with R2 and R4. R4 should peer with R1 and R3. On R3 and R4, ensure that packets are load balanced between the two WAN links. Do NOT configure PPP Multilink. Verify the configuration using the appropriate commands.

Task 3

Configure all routers to advertise their LAN subnet addresses via BGP. These should appear in the BGP RIBs of all other routers with an ORIGIN code of INCOMPLETE, by default. Verify the configuration using the appropriate commands.

 

 

Task 4

Configure BGP so that R4 prefers the path via R3 to reach any subnet. You are NOT allowed to implement any configuration on R4 itself. Verify your BGP configuration using the appropriate commands.

Task 5

Configure R4 so that it sends all updates to R3 with a MED of 4. Configure R2 so that it sends all updates to R3 with a MED of 2. Ensure that R3 prefers all routes with the better (lower) MED value. Do NOT modify any other BGP attributes or default administrative distance values when completing this task. Verify your configuration using the appropriate commands.

Task 6

Configure the following Loopback interfaces on R2:

Loopback 192: IP Address 192.1.1.1/24
Loopback 193: IP Address 193.1.1.1/24
Loopback 194: IP Address 194.1.1.1/24
Loopback 195: IP Address 195.1.1.1/24

The 192.1.1.1/24 subnet should appear to have originated in AS 192. The 193.1.1.1/24 subnet should appear to have originated in AS 193. The 194.1.1.1/24 subnet should appear to have originated in AS 194. And finally, the 195.1.1.1/24 subnet should appear to have originated in AS 195. These prefixes should be advertised using the network command. Verify your configuration using the appropriate commands.

Task 7

Configure R1 so that it only accepts prefixes originated in AS 192, 193, 194 and 195 from R4. It should never have any entries in its BGP RIB for any prefixes originating in these ASes directly from R2. Use an AS_PATH filter. This should only have TWO lines. Verify your configuration using the appropriate commands.

Lab Validation

Task 1

Please refer to previous labs for basic IP addressing and hostname configuration. This will not be included in this section to avoid being redundant.

Task 2

The most simple way to complete this task is to use BGP peer group configuration to minimize the number of commands that you need to specify. However, the task specifically states that peer groups should not be used. Additionally, in order to establish the BGP adjacencies using peer groups, you need to configure static routes on all routers because you are not allowed to enable an IGP of any kind. This task is completed as follows:

R1(config)#ip route 2.2.2.2 255.255.255.255 serial 0/0
R1(config)#ip route 4.4.4.4 255.255.255.255 fastethernet 0/0 150.1.1.4
R1(config)#router bgp 1
R1(config-router)#neighbor 2.2.2.2 remote-as 2
R1(config-router)#neighbor 2.2.2.2 update-source loopback 0
R1(config-router)#neighbor 2.2.2.2 ebgp-multihop
R1(config-router)#neighbor 4.4.4.4 remote-as 4
R1(config-router)#neighbor 4.4.4.4 update-source loopback 0
R1(config-router)#neighbor 4.4.4.4 ebgp-multihop
R1(config-router)#exit
R2(config)#ip route 1.1.1.1 255.255.255.255 serial 0/0
R2(config)#ip route 3.3.3.3 255.255.255.255 serial 0/1
R2(config)#router bgp 2
R2(config-router)#neighbor 1.1.1.1 remote-as 1
R2(config-router)#neighbor 1.1.1.1 update-source loopback 0
R2(config-router)#neighbor 1.1.1.1 ebgp-multihop
R2(config-router)#neighbor 3.3.3.3 remote-as 3
R2(config-router)#neighbor 3.3.3.3 update-source loopback 0
R2(config-router)#neighbor 3.3.3.3 ebgp-multihop
R2(config-router)#exit
R3(config)#ip route 2.2.2.2 255.255.255.255 serial 1/1
R3(config)#ip route 4.4.4.4 255.255.255.255 serial 1/2
R3(config)#ip route 4.4.4.4 255.255.255.255 serial 1/3
R3(config)#router bgp 3
R3(config-router)#neighbor 2.2.2.2 remote-as 2
R3(config-router)#neighbor 2.2.2.2 update-source loopback 0
R3(config-router)#neighbor 2.2.2.2 ebgp-multihop
R3(config-router)#neighbor 4.4.4.4 remote-as 4
R3(config-router)#neighbor 4.4.4.4 update-source loopback 0
R3(config-router)#neighbor 4.4.4.4 ebgp-multihop
R3(config-router)#exit
R4(config)#ip route 1.1.1.1 255.255.255.255 fastethernet 0/0 150.1.1.1
R4(config)#ip route 3.3.3.3 255.255.255.255 serial 0/0
R4(config)#ip route 3.3.3.3 255.255.255.255 serial 0/1
R4(config)#router bgp 4
R4(config-router)#neighbor 1.1.1.1 remote-as 1
R4(config-router)#neighbor 1.1.1.1 update-source loopback 0
R4(config-router)#neighbor 1.1.1.1 ebgp-multihop
R4(config-router)#neighbor 3.3.3.3 remote-as 3
R4(config-router)#neighbor 3.3.3.3 update-source loopback 0
R4(config-router)#neighbor 3.3.3.3 ebgp-multihop
R4(config-router)#exit

Verify your configuration using the show ip bgp summary command on all routers:

R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 1
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2     4     2      11      12        1    0    0 00:08:30        0
4.4.4.4     4     4       5       5        1    0    0 00:01:30        0

R2#show ip bgp summary
BGP router identifier 2.2.2.2, local AS number 2
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1     4     1      12      11        1    0    0 00:08:33        0
3.3.3.3     4     3       7       8        1    0    0 00:04:03        0

R3#show ip bgp summary
BGP router identifier 3.3.3.3, local AS number 3
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
2.2.2.2     4     2       8       7        1    0    0 00:04:06        0
4.4.4.4     4     4       4       4        1    0    0 00:00:57        0

R4#show ip bgp summary
BGP router identifier 4.4.4.4, local AS number 4
BGP table version is 1, main routing table version 1

Neighbor    V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
1.1.1.1     4     1       5       5        1    0    0 00:01:40        0
3.3.3.3     4     3       5       5        1    0    0 00:01:00        0

 

 

 

Task 3

In order to ensure that the ORIGIN code is INCOMPLETE, you need to redistribute the LAN subnets into BGP. However, you can also use the networkstatement in conjunction with a route map and set the ORIGIN code within the route map. Either option is acceptable when completing this task. This task is completed as follows when using the redistribution method:

R1(config)#route-map CONNECTED permit 10
R1(config-route-map)#match interface fastethernet 0/0
R1(config-route-map)#exit
R1(config)#route-map CONNECTED deny 20
R1(config-route-map)#exit
R1(config)#router bgp 1
R1(config-router)#redistribute connected route-map CONNECTED
R1(config-router)#exit
R2(config)#route-map CONNECTED permit 10
R2(config-route-map)#match interface fastethernet 0/0
R2(config-route-map)#exit
R2(config)#route-map CONNECTED deny 20
R2(config-route-map)#exit
R2(config)#router bgp 2
R2(config-router)#redistribute connected route-map CONNECTED
R2(config-router)#exit
R3(config)#route-map CONNECTED permit 10
R3(config-route-map)#match interface fastethernet 0/0
R3(config-route-map)#exit
R3(config)#route-map CONNECTED deny 20
R3(config-route-map)#exit
R3(config)#router bgp 3
R3(config-router)#redistribute connected route-map CONNECTED
R3(config-router)#exit
R4(config)#route-map CONNECTED permit 10
R4(config-route-map)#match interface fastethernet 0/0
R4(config-route-map)#exit
R4(config)#route-map CONNECTED deny 20
R4(config-route-map)#exit
R4(config)#router bgp 4
R4(config-router)#redistribute connected route-map CONNECTED
R4(config-router)#exit

You can verify the ORIGIN code by looking at the prefix entry in the BGP Tables. The ORIGIN code of INCOMPLETE is denoted by a question mark (?) in the output of the show ip bgp command. You can view additional detail on a per-prefix basis also when using this command.

R1#show ip bgp
BGP table version is 4, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*  150.1.1.0/24     4.4.4.4                  0             0 4 ?
*>                  0.0.0.0                  0         32768 ?
*> 150.2.2.0/24     2.2.2.2                  0             0 2 ?
*  150.3.3.0/24     2.2.2.2                                0 2 3 ?
*>                  4.4.4.4                                0 4 3 ?

R2#show ip bgp
BGP table version is 4, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*  150.1.1.0/24     3.3.3.3                                0 3 4 ?
*>                  1.1.1.1                  0             0 1 ?
*> 150.2.2.0/24     0.0.0.0                  0         32768 ?
*  150.3.3.0/24     1.1.1.1                                0 1 4 3 ?
*>                  3.3.3.3                  0             0 3 ?

R3#show ip bgp
BGP table version is 5, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*> 150.1.1.0/24     4.4.4.4                  0             0 4 ?
*                   2.2.2.2                                0 2 1 ?
*  150.2.2.0/24     4.4.4.4                                0 4 1 2 ?
*>                  2.2.2.2                  0             0 2 ?
*> 150.3.3.0/24     0.0.0.0                  0         32768 ?

R4#show ip bgp
BGP table version is 6, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*> 150.1.1.0/24     0.0.0.0                  0         32768 ?
*                   1.1.1.1                  0             0 1 ?
*  150.2.2.0/24     3.3.3.3                                0 3 2 ?
*>                  1.1.1.1                                0 1 2 ?
*> 150.3.3.0/24     3.3.3.3                  0             0 3 ?

 

Task 4

This task requires a little thought. Because we cannot implement any configuration on R4 itself, we have to think outside the box. The current BGP RIB on R4 shows the following entries:

R4#show ip bgp
BGP table version is 6, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*> 150.1.1.0/24     0.0.0.0                  0         32768 ?
*                   1.1.1.1                  0             0 1 ?
*  150.2.2.0/24     3.3.3.3                                0 3 2 ?
*>                  1.1.1.1                                0 1 2 ?
*> 150.3.3.0/24     3.3.3.3                  0             0 3 ?

In the output above, the path via R3 is preferred for the 150.3.3.0/24 prefix; however, the router prefers the path via R1 for the 150.2.2.0/24 prefix because, all else being equal, it is the router with the lower IP address. To influence path selection in this case, we need to configure BGP on R1 to advertise all prefixes with a longer AS_PATH. The MED will not work because this attribute is not, by default, considered when prefixes are received from multiple ASes. This task is completed by configuring R1 as follows:

R1(config)#route-map PREPEND permit 10
R1(config-route-map)#set as-path prepend 1 1 1 1
R1(config-route-map)#exit
R1(config)#router bgp 1
R1(config-router)#neighbor 4.4.4.4 route-map PREPEND out
R1(config-router)#exit

Following this configuration, the BGP Table on R4 shows the following:

R4#show 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*  150.1.1.0/24     1.1.1.1                  0             0 1 1 1 1 1 ?
*>                  0.0.0.0                  0         32768 ?
*> 150.2.2.0/24     3.3.3.3                                0 3 2 ?
*                   1.1.1.1                                0 1 1 1 1 1 2 ?
*> 150.3.3.0/24     3.3.3.3                  0             0 3 ?
*                   1.1.1.1                                0 1 1 1 1 1 2 3 ?

Task 5

The requirements of this task are two-fold. The first requirement is that R4 and R2 advertise all prefixes to R3 with a MED of 4 and 2, respectively. This is completed using an outbound route map on these two routers. Before any BGP configuration changes, the BGP RIB on R3 shows the following route entries:

R3#show ip bgp
BGP table version is 11, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*> 150.1.1.0/24     4.4.4.4                  0             0 4 ?
*                   2.2.2.2                                0 2 1 ?
*> 150.2.2.0/24     2.2.2.2                  0             0 2 ?
*> 150.3.3.0/24     0.0.0.0                  0         32768 ?

The first part of this task is completed as follows:

R4(config)#route-map MED permit 10
R4(config-route-map)#set metric 4
R4(config-route-map)#exit
R4(config)#router bgp 4
R4(config-router)#neighbor 3.3.3.3 route-map MED out
R4(config-router)#exit
R2(config)#route-map MED permit 10
R2(config-route-map)#set metric 2
R2(config-route-map)#exit
R2(config)#router bgp 2
R2(config-router)#neighbor 3.3.3.3 route-map MED out
R2(config-router)#exit

Following these changes, the BGP RIB on R3 shows the following:

R3#show ip bgp
BGP table version is 13, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*> 150.1.1.0/24     4.4.4.4                  4             0 4 ?
*                   2.2.2.2                  2             0 2 1 ?
*> 150.2.2.0/24     2.2.2.2                  2             0 2 ?
*> 150.3.3.0/24     0.0.0.0                  0         32768 ?

The second part of this task has two caveats. The first is that the MED attribute should be used in the path selection process. The issue here is that, by default, the MED is only compared for path received from the same AS. In order to allow BGP to compare MED values from prefixes received from multiple ASes, this default behavior needs to be modified. The second caveat is that the MED is compared AFTER the AS_PATH. This means that, for example, BGP will select the path via R4 as the best path to the 150.1.1.0/24 prefix because of the shorter AS_PATH length. Again, this default behavior has to be modified to complete this task. The second part of this task is therefore completed as follows:

R3(config)#router bgp 3
R3(config-router)#bgp bestpath as-path ignore
R3(config-router)#bgp always-compare-med
R3(config-router)#exit

Following this configuration, the BGP Table on R3 now shows the following:

R3#show 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*  150.1.1.0/24     4.4.4.4                  4             0 4 ?
*>                  2.2.2.2                  2             0 2 1 ?
*> 150.2.2.0/24     2.2.2.2                  2             0 2 ?
*> 150.3.3.0/24     0.0.0.0                  0         32768 ?

A more detailed look reveals that the path with the longer AS_PATH sequence, but LOWER metric (MED) value is now preferred because of the configuration implemented on R3:

R3#show ip bgp 150.1.1.0 255.255.255.0
BGP routing table entry for 150.1.1.0/24, version 14
Paths: (2 available, best #2, table Default-IP-Routing-Table)
Flag: 0x820
Advertised to update-groups:
1
4
4.4.4.4 from 4.4.4.4 (4.4.4.4)
Origin incomplete, metric 4, localpref 100, valid, external
2 1
    2.2.2.2 from 2.2.2.2 (2.2.2.2)
      Origin incomplete, metric 2, localpref 100, valid, external, best

 

 

Task 6

While seemingly difficult, this task is very straightforward and requires the use of AS_PATH prepending when advertising these prefixes via BGP on R2. This is completed as follows:

R2(config)#interface loopback 192
R2(config-if)#ip address 192.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface loopback 193
R2(config-if)#ip address 193.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface loopback 194
R2(config-if)#ip address 194.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#interface loopback 195
R2(config-if)#ip address 195.1.1.1 255.255.255.0
R2(config-if)#exit
R2(config)#ip prefix-list LOOPBACK192 seq 5 permit 192.1.1.0/24
R2(config)#ip prefix-list LOOPBACK193 seq 5 permit 193.1.1.0/24
R2(config)#ip prefix-list LOOPBACK194 seq 5 permit 194.1.1.0/24
R2(config)#ip prefix-list LOOPBACK195 seq 5 permit 195.1.1.0/24
R2(config)#route-map PREPEND permit 10
R2(config-route-map)#match ip address prefix-list LOOPBACK192
R2(config-route-map)#set as-path prepend 192
R2(config-route-map)#exit
R2(config)#route-map PREPEND permit  20
R2(config-route-map)#match ip address prefix-list LOOPBACK193
R2(config-route-map)#set as-path prepend 193
R2(config-route-map)#exit
R2(config)#route-map PREPEND permit 30
R2(config-route-map)#match ip address prefix-list LOOPBACK194
R2(config-route-map)#set as-path prepend 194
R2(config-route-map)#exit
R2(config)#route-map PREPEND permit 40
R2(config-route-map)#match ip address prefix-list LOOPBACK195
R2(config-route-map)#set as-path prepend 195
R2(config-route-map)#exit
R2(config)#route-map PREPEND permit 50
R2(config-route-map)#exit
R2(config)#router bgp 2
R2(config-router)#network 192.1.1.0
R2(config-router)#network 193.1.1.0
R2(config-router)#network 194.1.1.0
R2(config-router)#network 195.1.1.0
R2(config-router)#neighbor 1.1.1.1 route-map PREPEND out
R2(config-router)#neighbor 3.3.3.3 route-map PREPEND out
R2(config-router)#exit

 

 

 

Following this configuration, verify the BGP RIB entries for these prefixes are correct:

R1#show ip bgp
BGP table version is 29, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop         Metric LocPrf Weight Path
*  150.1.1.0/24     4.4.4.4               0             0 4 ?
*>                  0.0.0.0               0         32768 ?
*  150.2.2.0/24     4.4.4.4                             0 4 3 2 ?
*>                  2.2.2.2               0             0 2 ?
*  150.3.3.0/24     4.4.4.4                             0 4 3 ?
*>                  2.2.2.2                             0 2 3 ?
*  192.1.1.0        4.4.4.4                             0 4 3 2 192 i
*>                  2.2.2.2               0             0 2 192 i
*  193.1.1.0        4.4.4.4                             0 4 3 2 193 i
*>                  2.2.2.2               0             0 2 193 i
*  194.1.1.0        4.4.4.4                             0 4 3 2 194 i
*>                  2.2.2.2               0             0 2 194 i
*  195.1.1.0        4.4.4.4                             0 4 3 2 195 i
*>                  2.2.2.2               0             0 2 195 i

R3#show ip bgp
BGP table version is 44, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop         Metric LocPrf Weight Path
*  150.1.1.0/24     4.4.4.4               4             0 4 ?
*>                  2.2.2.2                             0 2 1 ?
*> 150.2.2.0/24     2.2.2.2               0             0 2 ?
*> 150.3.3.0/24     0.0.0.0               0         32768 ?
*> 192.1.1.0        2.2.2.2               0             0 2 192 i
*> 193.1.1.0        2.2.2.2               0             0 2 193 i
*> 194.1.1.0        2.2.2.2               0             0 2 194 i
*> 195.1.1.0        2.2.2.2               0             0 2 195 i

R4#show ip bgp
BGP table version is 38, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop         Metric LocPrf Weight Path
*  150.1.1.0/24     3.3.3.3                             0 3 2 1 ?
*                   1.1.1.1               0             0 1 1 1 1 1 ?
*>                  0.0.0.0               0         32768 ?
*> 150.2.2.0/24     3.3.3.3                             0 3 2 ?
*                   1.1.1.1                                0 1 1 1 1 1 2 ?
*> 150.3.3.0/24     3.3.3.3               0             0 3 ?
*                   1.1.1.1                             0 1 1 1 1 1 2 3 ?
*> 192.1.1.0        3.3.3.3                             0 3 2 192 i
*                   1.1.1.1                             0 1 1 1 1 1 2 192 i
*> 193.1.1.0        3.3.3.3                             0 3 2 193 i
*                   1.1.1.1                             0 1 1 1 1 1 2 193 i
*> 194.1.1.0        3.3.3.3                             0 3 2 194 i
*                   1.1.1.1                             0 1 1 1 1 1 2 194 i
*> 195.1.1.0        3.3.3.3                             0 3 2 195 i
*                   1.1.1.1                             0 1 1 1 1 1 2 195 i

Task 7

To complete this task, we need to use a two-line AS_PATH filter. Prior to any configuration changes, the BGP Table on R1 shows the following entries:

R1#show ip bgp
BGP table version is 29, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop         Metric LocPrf Weight Path
*  150.1.1.0/24     4.4.4.4               0             0 4 ?
*>                  0.0.0.0               0         32768 ?
*  150.2.2.0/24     4.4.4.4                             0 4 3 2 ?
*>                  2.2.2.2               0             0 2 ?
*  150.3.3.0/24     4.4.4.4                             0 4 3 ?
*>                  2.2.2.2                             0 2 3 ?
*  192.1.1.0        4.4.4.4                             0 4 3 2 192 i
*>                  2.2.2.2               0             0 2 192 i
*  193.1.1.0        4.4.4.4                             0 4 3 2 193 i
*>                  2.2.2.2               0             0 2 193 i
*  194.1.1.0        4.4.4.4                             0 4 3 2 194 i
*>                  2.2.2.2               0             0 2 194 i
*  195.1.1.0        4.4.4.4                             0 4 3 2 195 i
*>                  2.2.2.2               0             0 2 195 i

To complete this task, you need to have a good understanding of basic regular expressions and how they are configured. A regular expression comprises four main parts. These four main parts, which are described in the following sections, are:

  1. A Range
  2. An Atom
  3. A Piece
  4. A Branch

 

A range is a sequence of characters within left and right square brackets. Examples of ranges are [abcd] or [1-9] or [0,4-7]. An atom is a single character. A Piece or Multiplier is a symbol that follows an Atom. Examples include the plus sign (+) and the question mark (?).branch is 0 or more concatenated pieces, i.e. 0 or more pieces used together in a regular expression, for example ^[0-9]+ [0-9]+?$. Before configuring and then applying AS_PATH filters, you should always use the show ip bgp regexp <regular expression> command to ensure that you are matching the desired routes. For example, prior to R1s configuration change, this command, used with the appropriate regular expression, confirms that the AS_PATH filter will match the desired prefixes:

R1#show ip bgp regexp _19[2-5]$
BGP table version is 29, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*  192.1.1.0        4.4.4.4                                0 4 3 2 192 i
*>                  2.2.2.2                  0             0 2 192 i
*  193.1.1.0        4.4.4.4                                0 4 3 2 193 i
*>                  2.2.2.2                  0             0 2 193 i
*  194.1.1.0        4.4.4.4                                0 4 3 2 194 i
*>                  2.2.2.2                  0             0 2 194 i
*  195.1.1.0        4.4.4.4                                0 4 3 2 195 i
*>                  2.2.2.2                  0             0 2 195 i

To complete this task, implement the following configuration on R1:

R1(config)#ip as-path access-list 1 deny _19[2-5]$
R1(config)#ip as-path access-list 1 permit .*
R1(config)#router bgp 1
R1(config-router)#neighbor 2.2.2.2 filter-list 1 in
R1(config-router)#exit

Following this change, the BGP Table on R1 shows the following entries:

R1#show ip bgp
BGP table version is 33, 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
Origin codes: i – IGP, e – EGP, ? – incomplete

Network          Next Hop            Metric LocPrf Weight Path
*  150.1.1.0/24     4.4.4.4                  0             0 4 ?
*>                  0.0.0.0                  0         32768 ?
*  150.2.2.0/24     4.4.4.4                                0 4 3 2 ?
*>                  2.2.2.2                  0             0 2 ?
*  150.3.3.0/24     4.4.4.4                                0 4 3 ?
*>                  2.2.2.2                                0 2 3 ?
*> 192.1.1.0        4.4.4.4                                0 4 3 2 192 i
*> 193.1.1.0        4.4.4.4                                0 4 3 2 193 i
*> 194.1.1.0        4.4.4.4                                0 4 3 2 194 i
*> 195.1.1.0        4.4.4.4                                0 4 3 2 195 i

NOTE: You can also complete this task by matching the configured AS_PATH ACL in a route map and applying that inbound. Either solution is acceptable.

Final Router Configurations

R1

 

R1#term len 0
R1#sh run
Building configuration…

Current configuration : 1614 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R1
!
boot-start-marker
boot-end-marker
!
no logging console
!
no aaa new-model
no network-clock-participate slot 1
no network-clock-participate wic 0
ip cef
!
!
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 150.1.1.1 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 10.0.0.1 255.255.255.252
clock rate 2000000
!
interface Serial0/1
no ip address
shutdown
!
router bgp 1
no synchronization
bgp log-neighbor-changes
redistribute connected route-map CONNECTED
neighbor 2.2.2.2 remote-as 2
neighbor 2.2.2.2 ebgp-multihop 255
neighbor 2.2.2.2 update-source Loopback0
neighbor 2.2.2.2 filter-list 1 in
neighbor 4.4.4.4 remote-as 4
neighbor 4.4.4.4 ebgp-multihop 255
neighbor 4.4.4.4 update-source Loopback0
neighbor 4.4.4.4 route-map PREPEND out
no auto-summary
!
ip forward-protocol nd
ip route 2.2.2.2 255.255.255.255 Serial0/0
ip route 4.4.4.4 255.255.255.255 FastEthernet0/0 150.1.1.4
!
ip as-path access-list 1 deny _19[2-5]$
ip as-path access-list 1 permit .*
!
no ip http server
no ip http secure-server
!
!
route-map PREPEND permit 10
set as-path prepend 1 1 1 1
!
route-map CONNECTED permit 10
match interface FastEthernet0/0
!
route-map CONNECTED deny 20
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end

R1#

R2

 

R2#term len 0
R2#sh run
Building configuration…

Current configuration : 2455 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R2
!
boot-start-marker
boot-end-marker
!
no logging console
!
no aaa new-model
no network-clock-participate slot 1
no network-clock-participate wic 0
ip cef
!
!
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 2.2.2.2 255.255.255.255
!
interface Loopback192
ip address 192.1.1.1 255.255.255.0
!
interface Loopback193
ip address 193.1.1.1 255.255.255.0
!
interface Loopback194
ip address 194.1.1.1 255.255.255.0
!
interface Loopback195
ip address 195.1.1.1 255.255.255.0
!
interface FastEthernet0/0
ip address 150.2.2.2 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 10.0.0.2 255.255.255.252
!
interface Serial0/1
ip address 10.0.0.9 255.255.255.252
!
router bgp 2
no synchronization
bgp log-neighbor-changes
network 192.1.1.0
network 193.1.1.0
network 194.1.1.0
network 195.1.1.0
redistribute connected route-map CONNECTED
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 ebgp-multihop 255
neighbor 1.1.1.1 update-source Loopback0
neighbor 1.1.1.1 route-map PREPEND out
neighbor 3.3.3.3 remote-as 3
neighbor 3.3.3.3 ebgp-multihop 255
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 route-map PREPEND out
no auto-summary
!
ip forward-protocol nd
ip route 1.1.1.1 255.255.255.255 Serial0/0
ip route 3.3.3.3 255.255.255.255 Serial0/1
!
!
no ip http server
no ip http secure-server
!
!
ip prefix-list LOOPBACK192 seq 5 permit 192.1.1.0/24
!
ip prefix-list LOOPBACK193 seq 5 permit 193.1.1.0/24
!
ip prefix-list LOOPBACK194 seq 5 permit 194.1.1.0/24
!
ip prefix-list LOOPBACK195 seq 5 permit 195.1.1.0/24
!
route-map MED permit 10
set metric 2
!
route-map PREPEND permit 10
match ip address prefix-list LOOPBACK192
set as-path prepend 192
!
route-map PREPEND permit 20
match ip address prefix-list LOOPBACK193
set as-path prepend 193
!
route-map PREPEND permit 30
match ip address prefix-list LOOPBACK194
set as-path prepend 194
!
route-map PREPEND permit 40
match ip address prefix-list LOOPBACK195
set as-path prepend 195
!
route-map PREPEND permit 50
!
route-map CONNECTED permit 10
match interface FastEthernet0/0
!
route-map CONNECTED deny 20
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end

R2#

R3

 

R3#term len 0
R3#sh run
Building configuration…

Current configuration : 1850 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R3
!
boot-start-marker
boot-end-marker
!
no logging console
!
no aaa new-model
no network-clock-participate slot 1
no network-clock-participate wic 0
ip cef
!
!
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 3.3.3.3 255.255.255.255
!
interface FastEthernet0/0
ip address 150.3.3.3 255.255.255.0
duplex auto
speed auto
!
interface Serial1/0
no ip address
shutdown
clock rate 128000
!
interface Serial1/1
ip address 10.0.0.10 255.255.255.252
clock rate 128000
!
interface Serial1/2
ip address 10.0.0.13 255.255.255.252
clock rate 128000
!
interface Serial1/3
ip address 10.0.0.17 255.255.255.252
clock rate 128000
!
interface Serial1/4
no ip address
shutdown
!
interface Serial1/5
no ip address
shutdown
!
interface Serial1/6
no ip address
shutdown
!
interface Serial1/7
no ip address
shutdown
!
router bgp 3
no synchronization
bgp always-compare-med
bgp log-neighbor-changes
bgp bestpath as-path ignore
redistribute connected route-map CONNECTED
neighbor 2.2.2.2 remote-as 2
neighbor 2.2.2.2 ebgp-multihop 255
neighbor 2.2.2.2 update-source Loopback0
neighbor 4.4.4.4 remote-as 4
neighbor 4.4.4.4 ebgp-multihop 255
neighbor 4.4.4.4 update-source Loopback0
no auto-summary
!
ip forward-protocol nd
ip route 2.2.2.2 255.255.255.255 Serial1/1
ip route 4.4.4.4 255.255.255.255 Serial1/2
ip route 4.4.4.4 255.255.255.255 Serial1/3
!
!
no ip http server
no ip http secure-server
!
!
route-map CONNECTED permit 10
match interface FastEthernet0/0
!
route-map CONNECTED deny 20
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end

R3#

R4

 

R4#term len 0
R4#sh run
Building configuration…

Current configuration : 1518 bytes
!
version 12.4
service timestamps debug datetime msec
service timestamps log datetime msec
no service password-encryption
!
hostname R4
!
boot-start-marker
boot-end-marker
!
no logging console
!
no aaa new-model
no network-clock-participate slot 1
no network-clock-participate wic 0
ip cef
!
!
!
!
no ip domain lookup
ip auth-proxy max-nodata-conns 3
ip admission max-nodata-conns 3
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
interface Loopback0
ip address 4.4.4.4 255.255.255.255
!
interface FastEthernet0/0
ip address 150.1.1.4 255.255.255.0
duplex auto
speed auto
!
interface Serial0/0
ip address 10.0.0.14 255.255.255.252
!
interface Serial0/1
ip address 10.0.0.18 255.255.255.252
!
router bgp 4
no synchronization
bgp log-neighbor-changes
redistribute connected route-map CONNECTED
neighbor 1.1.1.1 remote-as 1
neighbor 1.1.1.1 ebgp-multihop 255
neighbor 1.1.1.1 update-source Loopback0
neighbor 3.3.3.3 remote-as 3
neighbor 3.3.3.3 ebgp-multihop 255
neighbor 3.3.3.3 update-source Loopback0
neighbor 3.3.3.3 route-map MED out
no auto-summary
!
ip forward-protocol nd
ip route 1.1.1.1 255.255.255.255 FastEthernet0/0 150.1.1.1
ip route 3.3.3.3 255.255.255.255 Serial0/0
ip route 3.3.3.3 255.255.255.255 Serial0/1
!
!
no ip http server
no ip http secure-server
!
!
route-map MED permit 10
set metric 4
!
route-map CONNECTED permit 10
match interface FastEthernet0/0
!
route-map CONNECTED deny 20
!
!
!
control-plane
!
!
!
!
!
!
!
!
!
!
line con 0
line aux 0
line vty 0 4
login
!
!
end

R4#

Prev

Next

About Us

This is a free bonus site for members of www.howtonetwork.com

Copyright

The content on this copyright Reality Press Ltd.
Copyright Reality Press Ltd.