Hà Nội: NTT03, Line 1, Thống Nhất Complex, 82 Nguyễn Tuân, Thanh Xuân, Hà Nội. ● HCM: Số 31B, Đường 1, Phường An Phú, Quận 2 (Thủ Đức), TP HCM. ===> Đơn Vị Hàng Đầu Trong Lĩnh Vực Cung Cấp Thiết Bị Security - Network - Wifi - CCTV - Conference - Máy chủ Server - Lưu trữ Storge.
Danh mục sản phẩm

Configure Routing Policy for Configuring Route Redistribution

Network Requirements

  • Run OSPF between Device1 and Device2, and run RIP between Device2 and Device3.
  • On Device2, configure OSPF to redistribute RIP routes, and associate a routing policy to modify route properties. It is required that the tag property of route 100.1.1.0/24 is changed to 5, the metric value of route v is changed to 50, and the property of route 120.1.1.0/24 keeps unchanged.

Network Topology

Configuring a routing policy for configuring route redistribution

Figure 15–1 Configuring a routing policy for configuring route redistribution

Configuration Steps

Step 1: Configure the VLAN and join the interface to the corresponding VLAN. (Omitted) 

Step 2: Configure the IP addresses of the interfaces. (Omitted)

Step 3: Configure OSPF.

#Configure Device1.

Device1#configure terminal
Device1(config)#router ospf 100
Device1(config-ospf)#network 172.1.1.0 0.0.0.255 area 0
Device1(config-ospf)#exit

#Configure Device2.

Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#network 172.1.1.0 0.0.0.255 area 0
Device2(config-ospf)#exit

Step 4: Configure RIP.

#Configure Device2.

Device2(config)#router rip
Device2(config-rip)#version 2
Device2(config-rip)#network 171.1.1.0
Device2(config-rip)#exit

#Configure Device3.

Device3(config)#configure terminal
Device3(config)#router rip
Device3(config-rip)#version 2
Device3(config-rip)#network 171.1.1.0
Device3(config-rip)#network 100.1.1.0
Device3(config-rip)#network 110.1.1.0
Device3(config-rip)#network 120.1.1.0
Device3(config-rip)#exit

Step 5: Configure OSPF to redistribute RIP routes.

#Configure Device2.

Device2(config)#router ospf 100
Device2(config-ospf)#redistribute rip
Device2(config-ospf)#exit

#Query the routing table of Device1.

Device1#show ip route ospf 
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS 
       U - Per-user Static route 
       O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external 
 
OE 100.1.1.0/24 [150/20] via 172.1.1.2, 02:22:08, vlan2
OE 110.1.1.0/24 [150/20] via 172.1.1.2, 00:49:57, vlan2
OE 120.1.1.0/24 [150/20] via 172.1.1.2, 02:22:08, vlan2
OE 171.1.1.0/24 [150/20] via 172.1.1.2, 02:22:41, vlan2

According to the routing table of Device1, the RIP routes 100.1.1.0/24, 110.1.1.0/24, and 120.1.1.0/24 are redistributed to the OSPF process and successfully advertised to Device1.

Step 6: Configure an ACL and routing policy.

#Configure Device2.

Configure an ACL to allow routes 100.1.1.0/24, 110.1.1.0/24, and 120.1.1.0/24 to pass.

Device2(config)#ip access-list standard 1
Device2(config-std-nacl)#permit 100.1.1.0 0.0.0.255
Device2(config-std-nacl)#commit
Device2(config-std-nacl)#exit
Device2(config)#ip access-list standard 2
Device2(config-std-nacl)#permit 110.1.1.0 0.0.0.255
Device2(config-std-nacl)#commit
Device2(config-std-nacl)#exit
Device2(config)#ip access-list standard 3
Device2(config-std-nacl)#permit 120.1.1.0 0.0.0.255
Device2(config-std-nacl)#commit
Device2(config-std-nacl)#exit

Configure routing policy rip_to_ospf. Set the tag property of the routes that match ACL 1, set the metric property of the routes that match ACL2, and do not change the routing properties of the routes that match ACL 3.

Device2(config)#route-map rip_to_ospf 10
Device2(config-route-map)#match ip address 1
Device2(config-route-map)#set tag 5
Device2(config-route-map)#exit
Device2(config)#route-map rip_to_ospf 20
Device2(config-route-map)#match ip address 2
Device2(config-route-map)#set metric 50
Device2(config-route-map)#exit
Device2(config)#route-map rip_to_ospf 30
Device2(config-route-map)#match ip address 3
Device2(config-route-map)#exit

note


  • In configuring a routing policy, you can create a matching rule based on a prefix list or ACL. The prefix list can precisely match routing masks while the ACL cannot match routing masks.

Step 7: Configure OSPF to redistribute RIP routes and associate a routing policy.

#Configure Device2.

Device2(config)#router ospf 100
Device2(config-ospf)#redistribute rip route-map rip_to_ospf
Device2(config-ospf)#exit

Step 8: Check the result.

#Check the OSPF database of Device1.

Device1#show ip ospf database external 
            OSPF Router with ID (172.1.1.1) (Process ID 100) 
                AS External Link States  
 
    LS age: 1183   
  Options: 0x22 (-|-|DC|-|-|-|E|-) 
  LS Type: AS-external-LSA 
  Link State ID: 100.1.1.0 (External Network Number) 
  Advertising Router: 172.1.1.2 
  LS Seq Number: 80000006 
  Checksum: 0xbcc0 
  Length: 36 
  Network Mask: /24 
        Metric Type: 2 (Larger than any link state path) 
        TOS: 0 
        Metric: 20 
        Forward Address: 0.0.0.0 
        External Route Tag: 5 
 
  LS age: 1233   
  Options: 0x22 (-|-|DC|-|-|-|E|-) 
  LS Type: AS-external-LSA 
  Link State ID: 110.1.1.0 (External Network Number) 
  Advertising Router: 172.1.1.2 
  LS Seq Number: 80000006 
  Checksum: 0x0d4d 
  Length: 36 
  Network Mask: /24 
        Metric Type: 2 (Larger than any link state path) 
        TOS: 0 
        Metric: 50 
        Forward Address: 0.0.0.0 
        External Route Tag: 0 
 
  LS age: 1113   
  Options: 0x22 (-|-|DC|-|-|-|E|-) 
  LS Type: AS-external-LSA 
  Link State ID: 120.1.1.0 (External Network Number) 
  Advertising Router: 172.1.1.2 
  LS Seq Number: 80000005 
  Checksum: 0x5f10 
  Length: 36 
  Network Mask: /24 
        Metric Type: 2 (Larger than any link state path) 
        TOS: 0 
        Metric: 20 
        Forward Address: 0.0.0.0 
        External Route Tag: 0  

#Query the routing table of Device1.

Device1#show ip route ospf 
Codes: C - Connected, L - Local, S - static, R - RIP, B - BGP, i-ISIS 
       U - Per-user Static route 
       O - OSPF, OE-OSPF External, M - Management, E - IRMP, EX - IRMP external 
 
OE 100.1.1.0/24 [150/20] via 172.1.1.2, 02:30:28, vlan2
OE 110.1.1.0/24 [150/50] via 172.1.1.2, 00:58:17, vlan2
OE 120.1.1.0/24 [150/20] via 172.1.1.2, 02:30:28, vlan2

According to the OSPF database and routing table of Device1, the tag of route 100.1.1.0/24 is 5, the metric of route 110.1.1.0/24 is 50, and the routing properties of route 120.1.1.0/24 are not changed.

note


  • In redistributing external routes, the routes of the direct connect interfaces that are covered by the RIP process will also be redistributed into the target protocol.