Site icon Karneliuk

The book of policies. Vol.1. Nokia (Alcatel-Lucent) SR OS and Cisco IOS XR

Hello my friend,

Across my journey in the world of interoperability between Nokia (Alcatel-Lucent) SR OS and Cisco IOS XR I’ve many times mentioned route policies. Each time I was doing it in the context of the particular routing protocol, but this time I’m gonna do it for each protocol (or most of them) in the single place.

1
2
3
4
5
No part of this blogpost could be reproduced, stored in a
retrieval system, or transmitted in any form or by any
means, electronic, mechanical or photocopying, recording,
or otherwise, for commercial purposes without the
prior permission of the author.

Disclaimer

Just two things before we jump into overview.

The first one is that it’s almost impossible to cover all actions and matching criteria of route policies. There are so many possibilities, where they can used, that I even don’t have everything in my mind. But I’ll show you general approach so that you’ll easily deploy required policy, even if you haven’t done it previously.

The second one is the name of the article. It’s inspired by the album “The book of souls” by Iron Maiden, so if you see some similarities, you are right 🙂

Brief overview

Route-policies are really widely used. You meet them when you configure redistribution (export operation in Nokia(Alcatel-Lucent) SR OS), filtering and so on. If we speak about BGP, it’s just impossible to configure this protocol without applying correct route policies in order to filter prefixes and modify path attributes of the routes that are sent to or received from peering router. BGP IP/MPLS VPNs, PIM, LDP… We can continue this list forever.

In general, the logic of route policies is very straightforward: based on some match condition we perform some actions. If you are familiar with scripting or programming, you can think about route policy as an “if-then” condition. Actually, in Cisco IOS XR you configure route policy exactly with “if-then” construction.

In Nokia (Alcatel-Lucent) SR OS you have usually just two points, where you can apply route policy: import or export. Import policy is used between protocol internal data structure (OSPF/ISIS LSDB, LDP/BGP RIB, etc) and routing table, so that import policies filter, what can be installed in route table. In case of BGP import policies are also used for modification of the path attributes in the incoming updates in order to influence best path selection.

In Cisco IOS XR there are other names rather than import/export, but the directions are the same. There is almost no difference in the logic for the import policies comparing to Nokia (Alcatel-Lucent) SR OS, but there is one significant in the “out” direction.

The following table summarizes main facts about route policies

Route policy Nokia SR OS Cisco IOS XR
Import Based on “from” entry perform “accept/drop” action between routing protocol data structure (RIB) and routing table. Route is saved in RIB. Based on “if” entry perform “set/pass/drop” action between routing protocol data structure (RIB) and routing table. Route is saved in RIB.
Export Based on “entry” entry take route from routing table and perform “accept/drop” action in the direction of protocol RIB and/or neighbor 1st step is redistribution.

Based on “if” condition take route from routing table and perform “set/pass/drop” action in the direction of protocol RIB.

2nd step is output filtering.

Based on “if” condition take route from protocol RIB and perform “set/pass/drop” action in the direction of neighbor.

What are we going to test?

We will provide the scenario on which one routing protocol (IGP) is taken to export routes learned from multiple sources. Then we’ll explain the similarities and differences in working logic and configuration between Nokia (Alcatel-Lucent) SR OS and Cisco IOS XR.

Topology

Physical topology is as usual with two Nokia (Alcatel-Lucent) VSRs and Cisco IOS XRv 9000:

More information on the lab setup could be found in the very first article in this series.

Today the logical topology is simple chain of routers:

OSPF is launched between SR2 and XR3 with its simplest configuration. Both on links SR1-SR2 and XR3-XR4 two routing protocols (ISIS and BGP) are launched. Each protocol sends its own prefixes.

Here are the initial configuration files: initial_linux initial_sr1 initial_sr2 initial_xr3 initial_xr4

Routing policy configuration

Before we step into any configuration, let’s check the routing tables at our Nokia (Alcatel-Lucent) VSR SR2:

A:SR2# show router route-table
===============================================================================
Route Table (Router: Base)
===============================================================================
Dest Prefix[Flags]                            Type    Proto     Age        Pref
Next Hop[Interface Name]                                           Metric
——————————————————————————-
10.0.0.0/31                                   Local   Local     00h34m39s  0
toSR1                                                              0
10.0.0.2/31                                   Local   Local     00h34m39s  0
toXR3                                                              0
10.0.0.4/31                                   Remote  OSPF      00h06m35s  10
10.0.0.3                                                           101
10.0.0.251/32                                 Remote  OSPF      00h34m38s  10
10.0.0.0                                                           100
10.0.0.252/32                                 Local   Local     00h34m56s  0
system                                                             0
10.0.0.253/32                                 Remote  OSPF      00h12m46s  10
10.0.0.3                                                           101
10.0.0.254/32                                 Remote  OSPF      00h06m11s  10
10.0.0.3                                                           102
10.0.10.1/32                                  Remote  BGP       00h20m52s  170
10.0.0.0                                                           0
10.0.20.1/32                                  Remote  ISIS      00h34m38s  18
10.0.0.0                                                           10
10.0.30.1/32                                  Remote  ISIS      00h34m38s  18
10.0.0.0                                                           10
10.0.40.1/32                                  Remote  ISIS      00h34m38s  18
10.0.0.0                                                           10
10.1.10.1/32                                  Remote  BGP       00h20m52s  170
10.0.0.0                                                           0
10.1.20.1/32                                  Remote  ISIS      00h24m41s  18
10.0.0.0                                                           10
——————————————————————————-
No. of Routes: 13
Flags: n = Number of times nexthop is repeated
.      B = BGP backup route available
.      L = LFA nexthop available
.      S = Sticky ECMP requested
===============================================================================

And at Cisco IOS XRv router XR3:

RP/0/0/CPU0:XR3#show route ipv4
Codes: C – connected, S – static, R – RIP, B – BGP, (>) – Diversion path
.      D – EIGRP, EX – EIGRP external, 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, E – EGP
.      i – ISIS, L1 – IS-IS level-1, L2 – IS-IS level-2
.      ia – IS-IS inter area, su – IS-IS summary null, * – candidate default
.      U – per-user static route, o – ODR, L – local, G – DAGR, l – LISP
.      A – access/subscriber, a – Application route
.      M – mobile route, r – RPL, (!) – FRR Backup path
Gateway of last resort is not set
O    10.0.0.0/31 [110/101] via 10.0.0.2, 00:13:44, GigabitEthernet0/0/0/0.23
C    10.0.0.2/31 is directly connected, 00:13:44, GigabitEthernet0/0/0/0.23
L    10.0.0.3/32 is directly connected, 00:13:44, GigabitEthernet0/0/0/0.23
C    10.0.0.4/31 is directly connected, 00:07:34, GigabitEthernet0/0/0/0.34
L    10.0.0.4/32 is directly connected, 00:07:34, GigabitEthernet0/0/0/0.34
O    10.0.0.251/32 [110/101] via 10.0.0.2, 00:13:44, GigabitEthernet0/0/0/0.23
O    10.0.0.252/32 [110/1] via 10.0.0.2, 00:13:44, GigabitEthernet0/0/0/0.23
L    10.0.0.253/32 is directly connected, 00:13:44, Loopback0
O    10.0.0.254/32 [110/2] via 10.0.0.5, 00:07:14, GigabitEthernet0/0/0/0.34
B    10.0.10.4/32 [200/0] via 10.0.0.254, 00:05:00
i    L2 10.0.20.4/32 [115/10] via 10.0.0.5, 00:07:18, GigabitEthernet0/0/0/0.34
i    L2 10.0.30.4/32 [115/10] via 10.0.0.5, 00:07:18, GigabitEthernet0/0/0/0.34
i    L2 10.0.40.4/32 [115/10] via 10.0.0.5, 00:07:18, GigabitEthernet0/0/0/0.34
B    10.1.10.4/32 [200/0] via 10.0.0.254, 00:05:00
i    L2 10.1.20.4/32 [115/10] via 10.0.0.5, 00:07:18, GigabitEthernet0/0/0/0.34

We see that each of them learn variety of routes from different sources, but what is important for now they learn only IPv4 prefixes in the range 10.0.0.0/24 from OSPF.

Now, we take OSPF as a routing protocol, where we are going to inject routes from those different sources in. The following tasks must be accomplished:

The task seems to be long, but it isn’t too complex. Let’s take a look into necessary configuration at our vendors of choice:

Nokia (Alcatel-Lucent) SR OS Cisco IOS XR
SR2 XR3

A:SR1>edit-cfg# candidate view
=========================
configure
router
policy-option
begin
prefix-list “PL_IPV4_10.0.10.0_24_32”
prefix 10.0.10.0/24 prefix-length-range 24-32
exit
prefix-list “PL_IPV4_10.0.20.0_24_32”
prefix 10.0.20.0/24 prefix-length-range 24-32
exit
prefix-list “PL_IPV4_10.0.30.0_24_32”
prefix 10.0.30.0/24 prefix-length-range 24-32
exit
prefix-list “PL_IPV4_10.0.0.0_16_32”
prefix 10.0.0.0/16 prefix-length-range 16-32
exit
policy-statement “RP_OSPF_OUT”
entry 10
from
protocol bgp
prefix-list “PL_IPV4_10.0.10.0_24_32”
exit
action accept
metric set 100
type 1
exit
exit
entry 20
from
protocol isis
prefix-list “PL_IPV4_10.0.20.0_24_32”
exit
action accept
tag 1234
exit
exit
entry 30
from
protocol isis
prefix-list “PL_IPV4_10.0.30.0_24_32”
exit
action drop
exit
exit
entry 40
from
prefix-list “PL_IPV4_10.0.0.0_16_32”
exit
action accept
exit
exit
exit
commit
exit
router ospf
asbr
export “RP_OSPF_OUT”
exit
exit
exit
=========================

RP/0/0/CPU0:XR3(config)#show conf
!
prefix-set PS_IPV4_10.0.10.0_24
10.0.10.0/24 le 32
end-set
!
prefix-set PS_IPV4_10.0.20.0_24
10.0.20.0/24 le 32
end-set
!
route-policy RP_BGP_TO_OSPF($SET1)
if destination in $SET1 then
set metric-type type-1
set ospf-metric 100
elseif destination in (10.0.0.0/16 le 32) then
pass
endif
end-policy
!
route-policy RP_ISIS_TO_OSPF
if destination in PS_IPV4_10.0.20.0_24 then
set tag 1234
elseif destination in (10.0.30.0/24 le 32) then
drop
elseif destination in (10.0.0.0/16 le 32) then
pass
endif
end-policy
!
router ospf CORE
redistribute bgp 65000 route-policy RP_BGP_TO_OSPF (PS_IPV4_10.0.10.0_24)
redistribute isis TEST route-policy RP_ISIS_TO_OSPF
!
router bgp 65000
bgp redistribute-internal
!
end

The first point that you definitely spot is how sources of routes redistribution are configured. In Nokia (Alcatel-Lucent) SR OS you have single policy that covers everything, whereas in Cisco IOS XR (as well as Cisco IOS/IOS XE/NX-OS) you always define exact source of distribution and apply policy to that particular routing source. Both these logics have solid ground in my opinion:

This difference is obvious in the realization of the 4th task. In Nokia (Alcatel-Lucent) SR OS we just configure and apply to the rule the prefix-list without mentioning routing protocol. In Cisco IOS XR we configure the same rule two times (one per routing policy). If we SR2 will somehow now about any new prefix in 10.0.0.0/16 range (like new configured interface, static route, ISIS, BGP, RIP, whatever else), it will distribute it to the peers, whereas Cisco IOS XR will distribute further prefixes learned only through BGP or ISIS.

But for the sake of completeness, we can achieve the same level of control in Nokia by splitting rule 40 into two new. Was:

A:SR1>edit-cfg# candidate view
=========================
configure
router
policy-statement
begin
policy-statement “RP_OSPF_OUT”
entry 40
from
prefix-list “PL_IPV4_10.0.0.0_16_32”
exit
action accept
exit
exit
exit
commit
exit
exit
exit
=========================

Become:

A:SR1>edit-cfg# candidate view
=========================
configure
router
policy-statement
begin
policy-statement “RP_OSPF_OUT”
entry 40
from
prefix-list “PL_IPV4_10.0.0.0_16_32”
protocol isis
exit
action accept
exit
exit
entry 40
from
prefix-list “PL_IPV4_10.0.0.0_16_32”
protocol bgp
exit
action accept
exit
exit
exit
commit
exit
exit
exit
=========================

Back to our configuration. There is one interesting moment in the configuration of Cisco IOS XR route-policies that is variables. Pay attention to the configuration of the route policy RP_BGP_TO_OSPF. You see that I put in brackets some name, which is used later in the script itself. It gives me possibility to use such route-policy in different contexts just by changing value that I put to this argument.

Let’s check, if we see at Cisco IOS XR router XR3 routes, which are exported at SR2:

RP/0/0/CPU0:XR3#show route ipv4 ospf
O    10.0.0.0/31 [110/101] via 10.0.0.2, 01:03:04, GigabitEthernet0/0/0/0.23
O    10.0.0.251/32 [110/101] via 10.0.0.2, 01:03:04, GigabitEthernet0/0/0/0.23
O    10.0.0.252/32 [110/1] via 10.0.0.2, 01:03:04, GigabitEthernet0/0/0/0.23
O    10.0.0.254/32 [110/2] via 10.0.0.5, 01:02:31, GigabitEthernet0/0/0/0.34
O    E1 10.0.10.1/32 [110/101] via 10.0.0.2, 00:17:17, GigabitEthernet0/0/0/0.23
O    E2 10.0.20.1/32 [110/10] via 10.0.0.2, 00:17:17, GigabitEthernet0/0/0/0.23
O    E2 10.0.40.1/32 [110/10] via 10.0.0.2, 00:17:17, GigabitEthernet0/0/0/0.23

At a glance all of the required routes are being received. Let’s start by checking the details. IPv4 prefix 10.0.10.1/32 is redistributed with OSPF metric type E1 and metric value 100 ( you see metric 101 which is redistributes metric 100 and 1 is metric from XR3 to SR2).

I haven’t adjusted reference-bandwidth for OSPF between Nokia (Alcatel-Lucent) SR OS and Cisco IOS XR, though un production it’s necessary (link).

The next IPv4 prefix 10.0.20.1/32 should have tag 1234, which it has:

RP/0/0/CPU0:XR3#show route ipv4 10.0.20.1/32
Routing entry for 10.0.20.1/32
. Known via “ospf CORE”, distance 110, metric 10
. Tag 1234, type extern 2
. Installed May 8 18:40:31.302 for 00:22:24
. Routing Descriptor Blocks
.   10.0.0.2, from 10.0.0.252, via GigabitEthernet0/0/0/0.23
.     Route metric is 10
. No advertising protos.

As there were no interesting changes in IPv4 route 10.0.40.1/32 during redistribution, for us it’s just enough to see that it exists in the routing table.

Let’s check Nokia (Alcatel-Lucent) SR OS side that is SR2 in this case:

*A:SR2# show router route-table protocol ospf
===============================================================================
Route Table (Router: Base)
===============================================================================
Dest Prefix[Flags]                            Type    Proto     Age        Pref
Next Hop[Interface Name]                                           Metric
——————————————————————————-
10.0.0.4/31                                   Remote  OSPF      01h31m58s  10
10.0.0.3                                                           101
10.0.0.251/32                                 Remote  OSPF      01h32m52s  10
10.0.0.0                                                           100
10.0.0.253/32                                 Remote  OSPF      01h31m58s  10
10.0.0.3                                                           101
10.0.0.254/32                                 Remote  OSPF      01h31m26s  10
10.0.0.3                                                           102
10.0.10.4/32                                  Remote  OSPF      00h51m51s  150
10.0.0.3                                                           200
10.0.20.4/32                                  Remote  OSPF      01h11m47s  150
10.0.0.3                                                           20
10.0.40.4/32                                  Remote  OSPF      00h11m35s  150
10.0.0.3                                                           20
——————————————————————————-
No. of Routes: 7
Flags: n = Number of times nexthop is repeated
.      B = BGP backup route available
.      L = LFA nexthop available
.      S = Sticky ECMP requested
===============================================================================

It’s not possible to define the route type and its parameters from the routing table so let’s see directly into LSA:

*A:SR2# show router ospf database type external 10.0.10.4 detail
===============================================================================
Rtr Base OSPFv2 Instance 0 Link State Database (type: External) (detail)
===============================================================================
——————————————————————————-
AS Ext LSA for Network 10.0.10.4 (167774724)
——————————————————————————-
Area Id          : N/A                  Adv Router Id    : 10.0.0.253
Link State Id    : 10.0.10.4 (167774724)
LSA Type         : AS Ext
Sequence No      : 0x80000002           Checksum         : 0x1e91
Age              : 1390 Length : 36
Options          : DC
Network Mask     : 255.255.255.255      Fwding Address   : 0.0.0.0
Metric Type      : Type 1               Metric-0         : 100
Ext Route Tag    : 0
===============================================================================
!
!
*A:SR2# show router ospf database type external 10.0.20.4 detail
===============================================================================
Rtr Base OSPFv2 Instance 0 Link State Database (type: External) (detail)
===============================================================================
——————————————————————————-
AS Ext LSA for Network 10.0.20.4 (167777284)
——————————————————————————-
Area Id          : N/A                  Adv Router Id    : 10.0.0.253
Link State Id    : 10.0.20.4 (167777284)
LSA Type         : AS Ext
Sequence No      : 0x80000003           Checksum         : 0x2578
Age              : 406 Length : 36
Options          : DC
Network Mask     : 255.255.255.255      Fwding Address   : 0.0.0.0
Metric Type      : Type 2               Metric-0         : 20
Ext Route Tag    : 1234
===============================================================================

Here are the configuration files with what result our lab findings: final_sr2 final_sr1 final_xr4 final_xr3

Lessons learned

The devil is hidden in the details. I can also add that in the network world the devil is hidden the default behaviour.

When we don’t define any parameters for export of the route into OSPF, the following is happens:

You will come to these results if will play with metric at Nokia (Alcatel-Lucent) SR OS side and redistribution sources at Cisco IOS XR. Based on this I always recommend to minimize the amount of default values and manually define all the parameters. Especially it’s important in multi-vendor scenarios

Conclusion

As I’ve said in the very beginning, route policies are one of the most important tool that is used in many different tasks in the router. Sometimes it’s mandatory, sometimes it’s optional, but in all the cases it gives you flexibility if you understand how it to deal with it. In the next article we’ll talk about policies in BGP in details. Take care and good bye!

Support us





BR,
Anton Karneliuk

Exit mobile version