Route-map Continue Configuration
This section contains Route-map continue configuration with BGP.
Overview
The continue clauses allow you to configure and organize more modular policy definitions to reduce the number of policy configurations that are repeated within the same route map.
Continue clause under a route-map provides the capability to execute additional entries in a route map after an entry is executed with a successful match and set clauses. The continue command allows multiple entries to be evaluated within a single route-map. Continue commands can be assigned optional sequence numbers that indicates the order in which clauses are to be evaluated.
Using Continue with Match Clauses
When a match clause exists in a route-map with continue clause then continue clause is executed only when a successful match occurs. If a match clause does not exist in the route-map and if a continue clause exists, the continue clause will be evaluated and will go to the specified route-map entry. When a successful match occurs and we have a continue clause, the route-map executes the set clauses and then goes to the specified route-map entry. If a continue clause does not exist in the next route map, then the route-map will behave normally. If a continue clause exists in the next route-map but a match is not successful, the route-map will not continue and will “fall through” to the next sequence number if one exists
Using Continue with Set Actions
Set clauses are executed after the route-map evaluation is done. The set clauses are evaluated and executed in the order in which they were configured. Set clauses are only executed after a successful match occurs. The continue statement proceeds to the specified route-map entry only after configured set actions are performed. If a set action is configured in the first route-map and then the same set action occurs again but with a different value, in a subsequent route-map entry, then the last set action will override the previous set actions which were configured with the same set command.
Topology
Route-map continue
Configure Route-map continue on R1
In the below example we will apply route-map continue on R1 under BGP 100, with redistributed connected routes from R2 on R1. Here, 10.1.0.0/16 is a superset, while 10.1.1.0/24, 10.1.2.0 /24, 10.1.3.0/24, 10.1.4.0/24, and 10.1.5.0/24 are subsets and will filter PF1, which is a superset and sets several prefixes.
R1
R1#configure terminal | Enter configure mode. |
R1(config)#interface xe51 | Enter interface mode. |
R1(config-if)#ip address 20.1.1.1/24 | Configure the IP address of the interface. |
R1(config-if)#exit | Exit interface mode. |
R1(config)#ip prefix-list PF1 | Configure super set prefix PF1 |
R1(config-ip-prefix-list)#seq 5 permit 10.1.0.0/16 le 32 | Permit 10.1.0.0/16 length as 32 |
R1(config)#ip prefix-list P1 | Configure subset prefix P1 |
R1(config-ip-prefix-list)#seq 5 permit 10.1.1.0/24 le 32 | Permit 10.1.1.0/24 length as 32 |
R1(config)#ip prefix-list P2 | Configure subset prefix P2 |
R1(config-ip-prefix-list)#seq 5 permit 10.1.2.0/24 le 32 | Permit 10.1.2.0/24 length as 32 |
R1(config-ip-prefix-list)#ip prefix-list P3 | Configure subset prefix P3 |
R1(config-ip-prefix-list)#seq 5 permit 10.1.3.0/24 le 32 | Permit 10.1.3.0/24 length as 32 |
R1(config-ip-prefix-list)#exit | Exit from prefix-list mode |
R1(config)#route-map myid1 permit 1 | Configure route-map myid1 with sequence number 1 |
R1(config-route-map)match ip address prefix- list PF1 | Match for prefix PF1 |
R1(config-route-map)continue | Configure continue command without sequence number |
R1(config-route-map)set metric 10 | Set metric as 10 |
R1(config-route-map)set weight 3465789 | Set weight as 3465789 |
R1(config-route-map)route-map myid1 permit 2 | Configure route-map myid1 with sequence number 2 |
R1(config-route-map)match ip address prefix- list P1 | Match for IP prefix-list P1 |
R1(config-route-map)continue 3 | Configure continue with sequence number 3 |
R1(config-route-map)set metric 20 | Set metric as 20. |
R1(config-route-map)set origin igp | Set origin as IGP protocol |
R1(config-route-map)route-map myid1 permit 3 | Configure route-map myid1 with sequence number 3 |
R1(config-route-map)match ip address prefix- list P2 | Match for IP prefix-list P2 |
R1(config-route-map)continue 4 | Configure continue with sequence number 4 |
R1(config-route-map)set metric 30 | Set metric as 30. |
R1(config-route-map)set as-path prepend 600 | Set as-path prepend as 600 |
R1(config-route-map)route-map myid1 permit 4 | Configure route-map myid1 with sequence number 4 |
R1(config-route-map)match ip address prefix- list P3 | Match for IP prefix-list P3. |
R1(config-route-map)set local-preference 400 | Set local preference as 400 |
R1(config-route-map)set weight 400 | Set weight as 400 |
R1(config-route-map)end | End the route-map |
R1(config)#router bgp 100 | Configure bgp process 100 |
R1(config-router)#bgp router-id 1.1.1.1 | Configure bgp router id |
R1(config-router)#neighbor 20.1.1.2 remote-as 100 | Configure bgp remote-as 100 with neighbor IP |
R1(config-router)#address-family ipv4 | Enter address-family mode |
R1(config-router-af)#neighbor 20.1.1.2 activate | Activate neighbor 20.1.1.2 |
R1(config-router-af)#neighbor 20.1.1.2 route-map myid1 in | Configure bgp route-map myid1 as In bound policy with neighbor ip |
R1(config-router-af)#end | Exit the router bgp mode |
R2
R2#configure terminal | Enter configure mode. |
R2(config)#interface xe32/1 | Enter interface mode. |
R2(config-if)#ip address 10.1.1.1/24 | Configure the IP address of the interface on an interface which is up and running |
R2(config-if)#interface xe32/2 | Enter interface mode. |
R2(config-if)#ip address 10.1.2.1/24 | Configure the IP address of the interface on an interface which is up and running |
R2(config-if)#interface xe32/4 | Enter interface mode. |
R2(config-if)#ip address 10.1.3.1/24 | Configure the IP address of the interface on an interface which is up and running |
R2(config-if)#interface xe17/1 | Enter interface mode. |
R2(config-if)#ip address 10.1.4.1/24 | Configure the IP address of the interface on an interface which is up and running |
R2(config-if)#interface xe21/1 | Enter interface mode. |
R2(config-if)#ip address 10.1.5.1/24 | Configure the IP address of the interface on an interface which is up and running |
R2(config-if)#interface xe32/3 | Enter interface mode. |
R2(config-if)#ip address 20.1.1.2/24 | Configure the IP address on the connected interface. |
R2(config-if)#exit | Exit interface mode. |
R2(config)#router bgp 100 | Configure BGP process 100 |
R2(config-router)#bgp router-id 2.2.2.2 | Configure BGP router id |
R2(config-router)#neighbor 20.1.1.1 remote-as 100 | Configure BGP remote-as 100 with neighbor IP |
R2(config-router)#address-family ipv4 | Enter address-familymode |
R2(config-router-af)#neighbor 20.1.1.1 activate | Activate neighbor20.1.1.1 |
R2(config-router-af)#redistribute connected | Redistribute the connected routes which are 10 networks here. |
R2(config-router-as)#end | Exit router BGP mode |
Validation
R1
R1#show ip bgp summary
BGP router identifier 1.1.1.1, local AS number 100
BGP table version is 5
2 BGP AS-PATH entries
0 BGP community entries
Neighbor V AS MsgRcv MsgSen TblVer InQ OutQ Up/Down State/PfxRcd
20.1.1.2 4 100 145 177 5 0 0 00:40:05 5
Total number of neighbors 1
Total number of Established sessions 1
Note: Check the prefixes learnt here are 5.
R1#
R1#show ip bgp
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
l - labeled, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i 10.1.1.0/24 20.1.1.2 20 100 3465789 i
*>i 10.1.2.0/24 20.1.1.2 30 100 3465789 600 ?
*>i 10.1.3.0/24 20.1.1.2 10 400 400 ?
*>i 10.1.4.0/24 20.1.1.2 10 100 3465789 ?
*>i 10.1.5.0/24 20.1.1.2 10 100 3465789 ?
Total number of prefixes 5
R1#
Note: In the above example, 10.1.4.0/24 and 10.1.5.0/24 prefixes will match only on PF1 which is a super set prefix and metric is set as 10, while the 10.1.1.0/24, 10.1.2.0/24 and 10.1.3.0/24 prefixes will match in P1, P2 and P3 prefix-lists and execute the set clauses respectively.
R1#show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
IP Route Table for VRF "default"
B 10.1.1.0/24 [200/20] via 20.1.1.2, xe51, 00:45:05
B 10.1.2.0/24 [200/30] via 20.1.1.2, xe51, 00:45:05
B 10.1.3.0/24 [200/10] via 20.1.1.2, xe51, 00:45:05
B 10.1.4.0/24 [200/10] via 20.1.1.2, xe51, 00:25:05
B 10.1.5.0/24 [200/10] via 20.1.1.2, xe51, 00:24:35
C 20.1.1.0/24 is directly connected, xe51, 01:00:40
C 127.0.0.0/8 is directly connected, lo, 02:26:41
Gateway of last resort is not set
R1#
R1#show ip bgp route-map myid1
BGP table version is 5, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
l - labeled, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*>i 10.1.1.0/24 20.1.1.2 20 100 3465789 i
*>i 10.1.2.0/24 20.1.1.2 30 100 3465789 600 ?
*>i 10.1.3.0/24 20.1.1.2 10 400 400 ?
*>i 10.1.4.0/24 20.1.1.2 10 100 3465789 ?
*>i 10.1.5.0/24 20.1.1.2 10 100 3465789 ?
Total number of prefixes 5
R1#
R1#
R2
R2#show ip bgp summary
BGP router identifier 2.2.2.2, local AS number 100
BGP table version is 3
1 BGP AS-PATH entries
0 BGP community entries
Neighbor V AS MsgRcv MsgSen TblVer InQ OutQ Up/Down State/PfxRcd
20.1.1.1 4 100 133 133 3 0 0 00:39:57 0
Total number of neighbors 1
Total number of Established sessions 1
R2#
R2#
R2#show ip bgp
BGP table version is 3, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
l - labeled, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 10.1.1.0/24 0.0.0.0 0 100 32768 ?
*> 10.1.2.0/24 0.0.0.0 0 100 32768 ?
*> 10.1.3.0/24 0.0.0.0 0 100 32768 ?
*> 10.1.4.0/24 0.0.0.0 0 100 32768 ?
*> 10.1.5.0/24 0.0.0.0 0 100 32768 ?
*> 20.1.1.0/24 0.0.0.0 0 100 32768 ?
Total number of prefixes 6
R2#
R2#show ip route
Codes: K - kernel, C - connected, S - static, R - RIP, B - BGP
O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2,
ia - IS-IS inter area, E - EVPN,
v - vrf leaked
* - candidate default
IP Route Table for VRF "default"
C 10.1.1.0/24 is directly connected, xe32/1, 01:02:22
C 10.1.2.0/24 is directly connected, xe32/2, 01:01:46
C 10.1.3.0/24 is directly connected, xe32/4, 01:02:21
C 10.1.4.0/24 is directly connected, xe17/1, 00:26:52
C 10.1.5.0/24 is directly connected, xe21/1, 00:26:32
C 20.1.1.0/24 is directly connected, xe32/3, 01:02:22
C 127.0.0.0/8 is directly connected, lo, 01:34:40
Gateway of last resort is not set
R2#
Route-map Show Commands
R1#show running-config route-map
!
route-map myid1 permit 1
match ip address prefix-list PF1
continue
set metric 10
set weight 3465789
!
route-map myid1 permit 2
match ip address prefix-list P1
continue 3
set metric 20
set origin igp
!
route-map myid1 permit 3
match ip address prefix-list P2
continue 4
set metric 30
set as-path prepend 600
!
route-map myid1 permit 4
match ip address prefix-list P3
set local-preference 400
set weight 400
!
R1#
R1#show route-map
route-map myid1, permit, sequence 1
Match clauses:
ip address prefix-list: PF1
Continue clause: next sequence
Set clauses:
metric 10
weight 3465789
route-map myid1, permit, sequence 2
Match clauses:
ip address prefix-list: P1
Continue clause: sequence 3:
Set clauses:
metric 20
origin igp
route-map myid1, permit, sequence 3
Match clauses:
ip address prefix-list: P2
Continue clause: sequence 4:
Set clauses:
metric 30
as-path prepend 600
route-map myid1, permit, sequence 4
Match clauses:
ip address prefix-list: P3
Set clauses:
local-preference 400
weight 400
R1#