Routing policy configuration example for IPv4 route redistribution
Network requirements
As shown in Figure 120, Switch B exchanges routing information with Switch A by using OSPF and with Switch C by using IS-IS.
On Switch B, enable route redistribution from IS-IS to OSPF. Use a routing policy to set the cost of route 172.17.1.0/24 to 100 and the tag of route 172.17.2.0/24 to 20.
Figure 120: Network diagram
Configuration procedure
Specify IP addresses for interfaces. (Details not shown.)
Configure IS-IS:
# Configure Switch C.
<SwitchC> system-view [SwitchC] isis [SwitchC-isis-1] is-level level-2 [SwitchC-isis-1] network-entity 10.0000.0000.0001.00 [SwitchC-isis-1] quit [SwitchC] interface vlan-interface 200 [SwitchC-Vlan-interface200] isis enable [SwitchC-Vlan-interface200] quit [SwitchC] interface vlan-interface 201 [SwitchC-Vlan-interface201] isis enable [SwitchC-Vlan-interface201] quit [SwitchC] interface vlan-interface 202 [SwitchC-Vlan-interface202] isis enable [SwitchC-Vlan-interface202] quit [SwitchC] interface vlan-interface 203 [SwitchC-Vlan-interface203] isis enable [SwitchC-Vlan-interface203] quit
# Configure Switch B.
<SwitchB> system-view [SwitchB] isis [SwitchB-isis-1] is-level level-2 [SwitchB-isis-1] network-entity 10.0000.0000.0002.00 [SwitchB-isis-1] quit [SwitchB] interface vlan-interface 200 [SwitchB-Vlan-interface200] isis enable [SwitchB-Vlan-interface200] quit
Configure OSPF and route redistribution:
# Configure OSPF on Switch A.
<SwitchA> system-view [SwitchA] ospf [SwitchA-ospf-1] area 0 [SwitchA-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [SwitchA-ospf-1-area-0.0.0.0] quit [SwitchA-ospf-1] quit
# On Switch B, configure OSPF and enable route redistribution from IS-IS to OSPF.
[SwitchB] ospf [SwitchB-ospf-1] area 0 [SwitchB-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255 [SwitchB-ospf-1-area-0.0.0.0] quit [SwitchB-ospf-1] import-route isis 1 [SwitchB-ospf-1] quit
# Display the OSPF routing table on Switch A to view redistributed routes.
[SwitchA] display ospf routing OSPF Process 1 with Router ID 192.168.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 192.168.1.0/24 1 Stub 192.168.1.1 192.168.1.1 0.0.0.0 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 172.17.1.0/24 1 Type2 1 192.168.1.2 192.168.2.2 172.17.2.0/24 1 Type2 1 192.168.1.2 192.168.2.2 172.17.3.0/24 1 Type2 1 192.168.1.2 192.168.2.2 Total Nets: 4 Intra Area: 1 Inter Area: 0 ASE: 3 NSSA: 0
Configure filtering lists:
# Configure IPv4 basic ACL 2002 to permit route 172.17.2.0/24.
[SwitchB] acl basic 2002 [SwitchB-acl-ipv4-basic-2002] rule permit source 172.17.2.0 0.0.0.255 [SwitchB-acl-ipv4-basic-2002] quit
# Configure IP prefix list prefix-a to permit route 172.17.1.0/24.
[SwitchB] ip prefix-list prefix-a index 10 permit 172.17.1.0 24
Configure a routing policy.
[SwitchB] route-policy isis2ospf permit node 10 [SwitchB-route-policy-isis2ospf-10] if-match ip address prefix-list prefix-a [SwitchB-route-policy-isis2ospf-10] apply cost 100 [SwitchB-route-policy-isis2ospf-10] quit [SwitchB] route-policy isis2ospf permit node 20 [SwitchB-route-policy-isis2ospf-20] if-match ip address acl 2002 [SwitchB-route-policy-isis2ospf-20] apply tag 20 [SwitchB-route-policy-isis2ospf-20] quit [SwitchB] route-policy isis2ospf permit node 30 [SwitchB-route-policy-isis2ospf-30] quit
Apply the routing policy to route redistribution:
# On Switch B, enable route redistribution from IS-IS to OSPF and apply the routing policy.
[SwitchB] ospf [SwitchB-ospf-1] import-route isis 1 route-policy isis2ospf [SwitchB-ospf-1] quit
# Display the OSPF routing table on Switch A.
[SwitchA] display ospf routing OSPF Process 1 with Router ID 192.168.1.1 Routing Tables Routing for Network Destination Cost Type NextHop AdvRouter Area 192.168.1.0/24 1 Transit 192.168.1.1 192.168.1.1 0.0.0.0 Routing for ASEs Destination Cost Type Tag NextHop AdvRouter 172.17.1.0/24 100 Type2 1 192.168.1.2 192.168.2.2 172.17.2.0/24 1 Type2 20 192.168.1.2 192.168.2.2 172.17.3.0/24 1 Type2 1 192.168.1.2 192.168.2.2 Total Nets: 4 Intra Area: 1 Inter Area: 0 ASE: 3 NSSA: 0
The output shows that the cost of route 172.17.1.0/24 is 100 and the tag of route 172.17.2.0/24 is 20.