Policy-Based Routing and NULL0 with match statements

NULL0 is a mechanism used to drop packets in the Policy-Based Routing (PBR). If the NULL0 interface is specified within a stanza and the stanza also contains a “match ACL” statement, only traffic meeting the match criteria within the ACL is forwarded to the NULL0 interface. If the NULL0 interface is specified within a stanza that does not contain a “match” statement, the match criteria is implicitly “match any.”

In this example, the use of the NULL0 interface is only applicable to frames that meet the match criteria defined in the created ACL, or implicit "permit any" when no explicit match statement is listed for the stanza.

  1. Configure the ACLs.
    device(config)# ip access-list standard Jules
    device(conf-ipacl-std)# permit 192.168.0.0 255.255.255.0
    device(conf-ipacl-std)# deny 192.168.1.1 255.255.255.0
    device(config)# ip access-list standard Vincent
    device(conf-ipacl-std)# permit 192.168.2.2 255.255.255.0
  2. Create the first stanza of the route map. (The example is using a route-map named pulp_fiction.)
    device(config)# route-map pulp_fiction permit 10
    device(config-routemap-pulp_fiction/permit/10)# match ip address acl Jules
    device(config-routemap-pulp_fiction/permit/10)# set ip vrf pulp_fiction next-hop 3.3.3.3
    device(config-routemap-pulp_fiction/permit/10)# set ip interface NULL0
  3. Create the second stanza of the route map. (The example is using a route map named pulp_fiction.)
    device(config)# route-map pulp_fiction permit 20
    device(config-routemap-pulp_fiction/permit/20)# match ip address acl Vincent
    device(config-routemap-pulp_fiction/permit/20)# set ip vrf pulp_fiction next-hop 3.3.3.5

    Based on the above configuration, when address 192.168.0.0 255.255.255.0 is received, it matches stanza 10:

    • If the next hop 3.3.3.3 is selected, the packet is forwarded to 3.3.3.3.
    • If 3.3.3.3 is not selected by the PBR logic, the packet is sent to the next specified next-hop, which is the NULL0 interface, resulting in the traffic being dropped.
    • If address 192.168.1.1 255.255.255.0 is received, since it matches the deny case of the ACL, it is denied from using the next hops specified in the route map and the traffic is forwarded according to global route table.
    • If address 12.12.12.12 is received, because it meets none of the specified match criteria in either of the two stanzas, it basically falls off the end of the route map and the traffic is forwarded according to global route table.