General concepts
The network metric refers to the value assigned to a static route based on its estimated cost or distance relative to other available routes. In other words, the network metric is a measure of the efficiency or quality of a given route.
This metric is used in the process of selecting the optimal route to send a data packet from a source to a destination over the network. Static routing implies that the network administrator has manually defined the routes and associated metrics, rather than letting dynamic routing protocols automatically determine the best routes.
Some of the common metrics used in static routing include:
Cost: It is the value assigned to a route based on its estimated cost in terms of time, bandwidth or any other factor that may influence its performance.
Distance: It is the measure of the physical or logical distance between the origin and destination of the route.
Bandwidth: It is the amount of data that can be transferred per second over the path.
Time delay: It is the time it takes for a data packet to travel through the route.
Reliability: It is the probability that the route is available and working correctly.
Examples of using network metrics in static routing
The following are some practical examples of how network metrics are used in static routing:
Suppose a company has two routers connected to its internal network, and one of them is connected to an external network. The network administrator has defined a static route through the router connected to the external network to access an external server. To determine the best route, the administrator can assign a cost metric to each available route. If the route through the router connected to the external network has a lower cost in terms of time and bandwidth, it will be selected as the optimal route.
Another company has several branches located in different cities, each with a separate Internet connection. The network administrator has defined several static routes between the branches to allow direct communication between them. To determine the best route to send data between two branches, the administrator can assign a distance metric to each available route. If a route has a shorter distance, it will be selected as the optimal route.
An Internet service provider uses static routing to send its customers' traffic over its network. The provider can assign a bandwidth metric to each available route to determine the optimal route to send customer traffic. If a path has a higher bandwidth, it will be selected as the optimal path.
Examples of using network metrics with RouterOS
Suppose we have an enterprise network that consists of two subnets: 192.168.1.0/24 and 192.168.2.0/24. Both subnets are connected to a MikroTik router that has two network interfaces: ether1 and ether2. The ether1 interface is connected to the 192.168.1.0/24 subnet and the ether2 interface is connected to the 192.168.2.0/24 subnet.
Furthermore, the MikroTik router is connected to the Internet through the ether3 interface, and we need to define a static route to access an external web server with the IP address 203.0.113.10.
To implement static routing and assign metrics to the available routes, we can use a route table in RouterOS. The route table is a list of all the routes available on the router, along with their metrics and other attributes.
Here is an example of how the route table can be configured in RouterOS for our scenario:
/ip route add dst-address=203.0.113.10/32 gateway=192.0.2.1 distance=1 check-gateway=ping
/ip route add dst-address=203.0.113.10/32 gateway=192.0.2.2 distance=2 check-gateway=ping
In this example, we are adding two static routes to the route table. Both routes have the same destination address (203.0.113.10/32), but differ in the gateway address and the assigned distance (metric).
The first route (distance=1) has the gateway 192.0.2.1 and is considered the preferred route because it has a shorter distance. The second route (distance=2) has the gateway 192.0.2.2 and is considered a secondary route because it has a longer distance.
Additionally, we are using the “check-gateway=ping” attribute to check the availability of the gateway before sending data over the route. This helps avoid connectivity issues when a gateway is unavailable.
Botton line
The route table in RouterOS is used to define static routes and assign metrics to the available routes. This allows the router to select the best path to send data across the network, based on defined metrics and other configured attributes.
1 comment on “Network Metrics”
It helps me a lot, thank you 🫂