IPv4 prefix sets apply to all dynamic routing protocols and can be used to match source, destination, and next hop IP addresses. This section describes how to configure IPv4 prefix sets.
If only paragraph editing is used as an example, the corresponding line editing is similar. To use the line editing mode, perform the operations described in paragraph editing.
For detailed set and route-filter configuration steps, see Configuration Procedures of Sets and Route-Filters Using the Paragraph Editing Mode. For details about XPL clauses, see XPL Paragraph Editing Clauses.
Objective | Configure an IPv4 prefix set to match the routes in 1.1.1.0/24, 2.2.2.0/24, and 3.3.3.3/32 network segments. |
Configuration Example 1 | <HUAWEI> edit xpl ip-prefix-list aaa
xpl ip-prefix-list aaa
1.1.1.0 24,
2.2.2.0 24,
3.3.3.3 32
end-list
The IPv4 prefix set aaa includes three elements and matches the routes in 1.1.1.0/24, 2.2.2.0/24, and 3.3.3.3/32 network segments. |
Objective | Configure an IPv4 prefix set to match the routes in network segment 1.1.1.0/24 with the mask length ranging from 26 to 30 bits, the routes in network segment 2.2.2.0/24 with the mask length greater than or equal to 28 bits, and the routes in network segment 3.3.3.0/24 with the mask length of 30 bits. |
Configuration Example 2 | <HUAWEI> edit xpl ip-prefix-list bbb
xpl ip-prefix-list bbb
1.1.1.0 24 ge 26 le 30,
2.2.2.0 24 ge 28,
3.3.3.0 24 eq 30
end-list
The IPv4 prefix set bbb includes three elements and matches the routes in network segment 1.1.1.0/24 with the mask length ranging from 26 to 30 bits, the routes in network segment 2.2.2.0/24 with the mask length greater than or equal to 28 bits, and the routes in network segment 3.3.3.0/24 with the mask length of 30 bits. |
Objective | Configure a route-filter to set MED 60 for the routes that match IPv4 prefix set bbb, set MED 70 for the routes that do not match IPv4 prefix set bbb but match aaa, and set MED 80 for all other routes. |
Reference Example | <HUAWEI> edit xpl route-filter r1
xpl route-filter r1
if ip route-destination in bbb then
apply med 60
elseif ip route-destination in aaa then
apply med 70
else
apply med 80
endif
end-filter
The route-filter r1 references two IPv4 destination address prefix sets (aaa and bbb) and sets MED 60 for the routes that match the set bbb, sets MED 70 for the routes that do not match the set bbb but match the set aaa, and sets MED 80 for all other routes. |