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 Route Filtration on Inter-Area OSPF Routes

Network Requirements

  • Configure OSPF for all devices, and divide the devices into two areas, Area 0 and Area 1.
  • On the ABR, configure inter-area route filtration. According to route filtration, Area 0 does not allow injection of route 20.0.3.0/24, and 10.0.3.0/24 is not allowed to flood into other areas.

Network Topology

Networking for Configure Route Filtration on Inter-Area OSPF Routes

Figure 7-7 Networking for Configure Route Filtration on Inter-Area OSPF Routes

Configuration Steps

Step 1: Create VLANs, and add ports to the required VLANs. (Omitted)

Step 2: Configure IP addresses for the ports. (Omitted)

Step 3: Configure an OSPF process and let the interface cover different areas.

#Configure Device1.

Device1#configure terminal
Device1(config)#router ospf 100
Device1(config-ospf)#router-id 1.1.1.1
Device1(config-ospf)#network 10.0.1.0 0.0.0.255 area 0
Device1(config-ospf)#network 10.0.2.0 0.0.0.255 area 0
Device1(config-ospf)#network 10.0.3.0 0.0.0.255 area 0
Device1(config-ospf)#exit

#Configure Device2.

Device2#configure terminal
Device2(config)#router ospf 100
Device2(config-ospf)#router-id 2.2.2.2
Device2(config-ospf)#network 10.0.1.0 0.0.0.255 area 0
Device2(config-ospf)#network 20.0.1.0 0.0.0.255 area 1
Device2(config-ospf)#exit

#Configure Device3.

Device3#configure terminal
Device3(config)#router ospf 100
Device3(config-ospf)#router-id 3.3.3.3
Device3(config-ospf)#network 20.0.1.0 0.0.0.255 area 1
Device3(config-ospf)#network 20.0.2.0 0.0.0.255 area 1
Device3(config-ospf)#network 20.0.3.0 0.0.0.255 area 1
Device3(config-ospf)#exit

#Query the OSPF LSDB and routing table of Device2.

Device2#show ip ospf database  
            OSPF Router with ID (2.2.2.2) (Process ID 100) 
 
                Router Link States (Area 0) 
Link ID    ADV Router   Age  Seq#        CkSum  Link count
1.1.1.1	   1.1.1.1      329  0x8000005b  0xa6d5 3  
2.2.2.2    2.2.2.2      324  0x80000051  0xb007 1  
 
                Net Link States (Area 0) 
Link ID     ADV Router  Age  Seq#        CkSum
10.0.1.2    2.2.2.2     324  0x8000004e  0x9d2e  
 
                Summary Link States (Area 0) 
Link ID     ADV Router  Age  Seq#        CkSum   Route
20.0.1.0    2.2.2.2     324  0x8000004e  0xac25  20.0.1.0/24  
20.0.2.0    2.2.2.2     324  0x8000004d  0xad23  20.0.2.0/24  
20.0.3.0    2.2.2.2     259  0x80000001  0x3be0  20.0.3.0/24  
 
                Router Link States (Area 1) 
Link ID     ADV Router  Age  Seq#        CkSum   Link count
2.2.2.2     2.2.2.2     334  0x80000055  0x4f51  1  
3.3.3.3     3.3.3.3     335  0x80000059  0xca7a  3  
 
                Net Link States (Area 1) 
Link ID     ADV Router  Age  Seq#        CkSum
20.0.1.2	3.3.3.3     340  0x80000001  0xeb17  
 
                Summary Link States (Area 1) 
Link ID     ADV Router  Age  Seq#        CkSum   Route
10.0.1.0    2.2.2.2     365  0x80000001  0xc95f  10.0.1.0/24  
10.0.2.0    2.2.2.2     319  0x80000001  0xc85e  10.0.2.0/24  
10.0.3.0    2.2.2.2     256  0x80000001  0xbd68  10.0.3.0/24 
 
Device2#show ip route  
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management 
       D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS  
 
Gateway of last resort is not set 
 
C 10.0.1.0/24 is directly connected, 00:06:13, vlan2
O 10.0.2.0/24 [110/2] via 10.0.1.1, 00:05:22, vlan2
O 10.0.3.0/24 [110/2] via 10.0.1.1, 00:05:22, vlan2
C 20.0.1.0/24 is directly connected, 00:06:19, vlan3
O 20.0.2.0/24 [110/2] via 20.0.1.2, 00:05:32, vlan3
O 20.0.3.0/24 [110/2] via 20.0.1.2, 00:05:32, vlan3
C 127.0.0.0/8 is directly connected, 94:42:22, lo0 

In the OSPF database of Device2, three inter-area LSAs are generated respectively for Area 0 and Area 1.The intra-area routes of the areas have also been added into the routing table.

#Query the routing table of Device1.

Device1#show ip route  
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management 
       D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS  
 
Gateway of last resort is not set 
 
C 10.0.1.0/24 is directly connected, 00:08:41, vlan2
C 10.0.2.0/24 is directly connected, 37:59:10, vlan3
C 10.0.3.0/24 is directly connected, 38:05:36, vlan4
O 20.0.1.0/24 [110/2] via 10.0.1.2, 00:07:55, vlan2
O 20.0.2.0/24 [110/3] via 10.0.1.2, 00:07:55, vlan2
O 20.0.3.0/24 [110/3] via 10.0.1.2, 00:06:50, vlan2
C 127.0.0.0/8 is directly connected, 70:07:32, lo0 

Device1 has learnt routes of Area 1.

#Query the routing table of Device3.

Device3#show ip route  
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management 
       D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS  
 
Gateway of last resort is not set 
 
O 10.0.1.0/24 [110/2] via 20.0.1.1, 00:08:44, vlan2
O 10.0.2.0/24 [110/3] via 20.0.1.1, 00:08:33, vlan2
O 10.0.3.0/24 [110/3] via 20.0.1.1, 00:07:30, vlan2
C 20.0.1.0/24 is directly connected, 00:09:31, vlan2
C 20.0.2.0/24 is directly connected, 37:59:57, vlan3
C 20.0.3.0/24 is directly connected, 38:03:35, vlan4
C 127.0.0.0/8 is directly connected, 61:26:38, lo0

Device3 has learnt routes of Area 0.

Step 4: Configure a route filtration policy.

#Configure Device2.

Device2(config)#ip prefix-list 1 deny 10.0.3.0/24
Device2(config)#ip prefix-list 1 permit 0.0.0.0/0 le 32
Device2(config)#ip prefix-list 2 deny 20.0.3.0/24
Device2(config)#ip prefix-list 2 permit 0.0.0.0/0 le 32
Device2(config)#exit

Prefix list 1 filters out network 10.0.3.0/24 and allows all other networks. Prefix list 2 filters out network 20.0.3.0/24 and allows all other networks.

Step 5: On the ABR, configure filtration of inter-area routes and invoke the matching rules of a prefix list.

#Configure Device2.

Device2(config)#router ospf 100
Device2(config-ospf)#area 0 filter-list prefix 1 out
Device2(config-ospf)#area 0 filter-list prefix 2 in
Device2(config-ospf)#exit

Step 6: Check the result.

#Query OSPF LSDB of Device2.

Device2#show ip ospf database  
 
            OSPF Router with ID (2.2.2.2) (Process ID 100) 
 
                Router Link States (Area 0) 
Link ID   ADV Router  Age  Seq#       CkSum  Link count
1.1.1.1	  1.1.1.1     679  0x8000005b 0xa6d5 3  
2.2.2.2   2.2.2.2     673  0x80000051 0xb007 1  
 
                Net Link States (Area 0) 
Link ID   ADV Router  Age  Seq#       CkSum
10.0.1.2  2.2.2.2     673  0x8000004e 0x9d2e  
 
                Summary Link States (Area 0) 
Link ID   ADV Router  Age  Seq#       CkSum   Route
20.0.1.0  2.2.2.2     673  0x8000004e 0xac25  20.0.1.0/24  
20.0.2.0  2.2.2.2     673  0x8000004d 0xad23  20.0.2.0/24  
 
                Router Link States (Area 1) 
Link ID   ADV Router  Age  Seq#       CkSum  Link count
2.2.2.2   2.2.2.2     683  0x80000055 0x4f51 1  
3.3.3.3   3.3.3.3     684  0x80000059 0xca7a 3  
 
                Net Link States (Area 1) 
Link ID   ADV Router  Age  Seq#       CkSum
20.0.1.2  3.3.3.3     689  0x80000001 0xeb17  
 
                Summary Link States (Area 1) 
Link ID   ADV Router  Age  Seq#       CkSum   Route
10.0.1.0  2.2.2.2     714  0x80000001 0xc95f  10.0.1.0/24  
10.0.2.0  2.2.2.2     668  0x80000001 0xc85e  10.0.2.0/24 

Comparing the result with the result of Step 2, the LSA of network 20.0.3.0/24 has been deleted from Area 0 in the OSPF database. Similarly, the LSA of network 10.0.3.0/24 has been deleted from Area 1.

#Query the routing table of Device1.

Device1#show ip route  
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M - Management 
       D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B - BGP, i-ISIS  
 
Gateway of last resort is not set 
 
C 10.0.1.0/24 is directly connected, 00:12:57, vlan2 
C 10.0.2.0/24 is directly connected, 38:03:25, vlan3
C 10.0.3.0/24 is directly connected, 38:09:52, vlan4
O 20.0.1.0/24 [110/2] via 10.0.1.2, 00:12:11, vlan2
O 20.0.2.0/24 [110/3] via 10.0.1.2, 00:12:11, vlan2
C 127.0.0.0/8 is directly connected, 70:11:48, lo0 

The route 20.0.3.0/24 does not exist in the routing table of Device1.

#Query the routing table of Device3.

Device3#show ip route  
Codes: C - connected, S - static, R - RIP, O - OSPF, OE-OSPF External, M Management 
       D - Redirect, E - IRMP, EX - IRMP external, o - SNSP, B BGP, i-ISIS  
 
Gateway of last resort is not set 
 
O 10.0.1.0/24 [110/2] via 20.0.1.1, 00:13:09, vlan2
O 10.0.2.0/24 [110/3] via 20.0.1.1, 00:12:58, vlan2
C 20.0.1.0/24 is directly connected, 00:13:56, vlan2
C 20.0.2.0/24 is directly connected, 38:04:22, vlan3
C 20.0.3.0/24 is directly connected, 38:08:00, vlan4
C 127.0.0.0/8 is directly connected, 64:31:03, lo0

The route 10.0.3.0/24 does not exist in the routing table of Device3.