A metric is a weighted cost assigned to static and dynamic routes. Metrics have a value between 1 and 254. Lower metrics are considered better and take precedence over higher costs. SonicOS adheres to Cisco-defined metric values for directly connected interfaces, statically encoded routes, and all dynamic IP routing protocols.
Traditionally, routes have been prioritized based on the specificity of the destination IP address. Routes with longer prefixes (more specific) have a higher priority than routes with shorter prefixes (less specific).
With the metric-based policy routing, three additional fields are used to prioritize a route:
The general prioritization of policy routing (from high to low) is as follows:
Within these 15 classifications, routes are further prioritized based on the cumulative specificity of the defined route entries. For the source and destination fields, specificity is measured by counting the number of IP addresses represented in the address object.
For example, the network address object 10.0.0.0/24 represents 256 IP addresses, while the network address object 10.0.0.0/20 represents 4096 IP addresses. The longer /24 prefix represents fewer host IP addresses and is more specific. Range address objects have (end - begin + 1) IP addresses.
For example, routes with only the destination defined are prioritized based on the cumulative number of host IP addresses, represented by their destination address objects. The routes with a smaller number of host addresses are more specific than those with a greater number, and are prioritized accordingly. The metric comes into play only if two or more of the routes have an identical number of host IP addresses represented by their destinations.
The metric-weighted prioritization option takes precedence over the route specificity prioritization.