In today’s high-performance networks, the network must be optimized to ensure network scalability, stability, security, and fast convergence. Route filtering and policy routing are common methods of route optimization.
Route filtering means that certain routes are not sent and received during route update. Passive interfaces, distributed control lists, redistribution and routing policies can implement route filtering.Policy routing provides a mechanism for packet forwarding based on standards set by network managers.Policy-based routing is more powerful and flexible than traditional routing. It allows network managers to select forwarding paths based on the destination address and based on protocol type, packet size, application, or IP source address.The policy routing policy is defined by a route map. The most important of the “route map” commands are “match” and “set”.
Match is used to define the matching condition, and the matching statement detects the packet at the input port of the router. Common matching conditions include IP address, interface, metrics, and packet length.Set Defines the behavior to be taken on statements that match the matching criteria.
Set ip next hop: Set the next hop address of the packet
Set interface : set the packet out interface
Set ip default next hop : Sets the default next hop address for when there is no routing destination entry in the routing table.
Set default interface : set the default outgoing interface
Set ip tos : Set the IP ToS value of the IP packet
Set ip precedence : set the priority of the IP packet
- The last default “deny any” of a route map. The result of this deny depends on how this route map is used.If a packet has no match for route map, it will be forwarded according to the normal destination address, and if there is no match for the route entry, it will be rejected.
- A route map can contain multiple route map statements, which are executed in the same order as ACLs from top to bottom.
Control routing updates with a distribution control list:

In this experiment, the router is controlled by using the distribution control list. R1 only sends the route with the third odd number in the loopback interface and the route of the g0/0 interface to R2. The entire network runs the RIPv2 routing protocol.
Experimental steps:
Router R1 emulates a PC. Router R2 acts as R1 and router R3 acts as R2.
Configure the interface IP address:
Router>enable
Router#configure terminal
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#no ip domain-lo
Router(config)#no ip domain-lookup
Router(config)#hostname PC
PC(config)#interface fastEthernet 0/0
PC(config-if)#ip address 172.16.1.1 255.255.255.0
PC(config-if)#no shutdown
Router>enable
Router#configure terminal
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#no ip domain-lookup
Router(config)#hostname R1
R1(config)#interface fastEthernet 0/0
R1(config-if)#ip address 172.16.1.254 255.255.255.0
R1(config-if)#no shutdown
R1(config)#interface serial 2/0
R1(config-if)#ip address 192.168.12.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#interface lo0
R1(config-if)#ip address 1.1.0.1 255.255.255.0
R1(config)#interface lo1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#int lo2
R1(config-if)#ip address 1.1.2.1 255.255.255.0
R1(config-if)#int lo3
R1(config-if)#ip address 1.1.3.1 255.255.255.0
R1(config-if)#int lo4
R1(config-if)#ip address 1.1.4.1 255.255.255.0
R1(config-if)#int lo5
R1(config-if)#ip address 1.1.5.1 255.255.255.0
R1(config-if)#int lo6
R1(config-if)#ip address 1.1.6.1 255.255.255.0
R1(config-if)#int lo7
R1(config-if)#ip address 1.1.7.1 255.255.255.0
R1(config-if)#exit
Router>enable
Router#configure terminal
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#no ip domain-lookup
Router(config)#hostname R2
R2(config)#interface serial 2/0
R2(config-if)#ip address 192.168.12.2 255.255.255.0
R2(config-if)#no shutdown
R2(config-if)#exit
R2(config)#interface lo0
R2(config-if)#ip address 2.2.2.2 255.255.255.0
R2(config-if)#exit
Configure the RIP dynamic routing protocol.
R1(config)#access-list 1 permit 172.16.1.0
R1(config)#access-list 1 permit 1.1.1.0 0.0.254.0 //Configure the access control list to allow the third bit to be an odd route
R1(config)#router rip
R1(config-router)#version 2
R1(config-router)#no auto-summary
R1(config-router)#network 1.0.0.0
R1(config-router)#network 172.16.0.0
R1(config-router)#network 192.168.12.0
R1(config-router)#passive-interface default //Default is passive interface
R1(config-router)#no passive-interface s2/0 //Close the default interface
R1(config-router)#distribute-list 1 out s2/0 //Configure the distribution control list in the outbound direction
The “distribute-list” command can globally filter routes in an inbound or outbound route update, or set route filtering for the inbound or outbound direction of each interface involved in a routing process.
R2(config)#router rip
R2(config-router)#version 2
R2(config-router)#no auto-summary
R2(config-router)#network 192.168.12.0
R2(config-router)#network 2.0.0.0
R2(config-router)#exit
The configuration is complete.
View the routing table on R2:

The learned routing entry indicates that R2 only receives the route of the Ethernet port of R1 and the loopback interface of the third bit.
R1#show ip protocols

The above output information indicates that there is no distribution control list in the global context, and the distribution control list is applied in the outbound direction of the S2/0 interface.
For more articles you can follow us on: