Setup Route Metric for specific route Without Network Manager
To add a route metric for a specific route, create or modify the route-<interface> file in the /etc/sysconfig/network-scripts/ directory, where <interface> is the name of the interface to which the route metric applies. Each route should be on a separate line and follow the basic format <network/prefix> via <gateway> <metric “value”>, where <network/prefix> denotes the remote network’s address with prefix, <gateway> denotes the next hop’s IP address, and <metric “value”> denotes a route’s priority. The greater the metric, the lower the route’s priority.
# cat /etc/sysconfig/network-scripts/route-<interface>
10.20.30.0/24 via 192.168.100.10 metric 200
10.0.1.0/24 via 192.168.10.20 metric 50
For changes to take effect, the interface must be brought back up.
# ifup <interface>
Setup Route Metric for specific route With Network Manager
To add a route metric for a specific route using nmcli, modify the ipv4.routes property of the connection. For instance, to add the route metric 400 to a specific route on the ens192 connection.
# nmcli connection modify ens192 ipv4.routes "10.0.30.0/24 192.168.100.10 400"
To add additional metric routes, use the + (plus) modifier on the ipv4.routes property of the connection.
# nmcli connection modify external +ipv4.routes "10.10.2.0/24 192.168.110.30 350"
Bring the connection up after making any of the above changes to ensure that the changes take effect.
# nmcli connection up ens192