Set Network Interface Metric

What is the correct way to define network interface metrics these days?

I am looking for command line ways to do this. I am currently using Arch Linux, but the distribution-agnostic method is preferred.

Here is my unsuccessful attempt:

$ sudo ifconfig wlan0 metric 1 SIOCSIFMETRIC: Operation not supported 
+8
linux networking archlinux
source share
1 answer

As pointed out by man ifconfig , the metric is not supported for the ifconfig command on Linux systems, because when the ifconfig command is processed, it does not create a routing table entry.

  metric N This parameter sets the interface metric. It is not available under GNU/Linux. 

To answer your question, you will need to use the route command to add a route with the desired metric and delete the old entry. For example:

 sudo route add -net default gw 10.10.0.1 netmask 0.0.0.0 dev wlan0 metric 1 sudo route del -net default gw 10.10.0.1 netmask 0.0.0.0 dev wlan0 metric 0 
+17
source share

All Articles