3

When I run ip route on my Linux machine, I see

default via xxx.xxx.xxx.xxx dev eno1 metric 202

I wonder, where this 202 metric is configured and what other ip commands use it.

Eugene Yarmash
  • 14,675
  • 14
  • 50
  • 57
  • Do you have the value 202 specified somewhere in the file `/etc/sysconfig/network-scripts/ifcfg-eno1`? – Ramesh Dec 02 '14 at 17:24
  • @Ramesh I don't have `/etc/sysconfig` (I'm using ArchLinux) – Eugene Yarmash Dec 02 '14 at 18:22
  • I don't know enough to provide a full answer but I'm pretty sure the metric default is selected by the kernel. The kernel is the piece of software that actually weights different routes anyways. `ip` is just a management tool for kernel configuration. – Bratchley Dec 02 '14 at 19:24
  • metric is generally not used, I have no metrics listed in my `ip route` output. It might be used if you're using a routing protocol via e.g. `zebra`, it indicates the (relative) cost of using that route. See e.g. [here](http://technet.microsoft.com/en-us/library/cc779122(WS.10).aspx) for an explanation of metric. Where your value of 202 comes from can't be determined without more information. – wurtel Dec 03 '14 at 12:28
  • @wurtel I find metrics useful for overriding routes created by a VPN client. As for the value, I suppose it's a default in ArchLinux. – Eugene Yarmash Dec 03 '14 at 14:32
  • @eugeney does it actually work? AFAIK the metric is not used in the kernel, only by routing software. For overriding routes you should use `ip rule` priorities, see [lartc FAQ](http://www.lartc.org/lartc.html) for details. – wurtel Dec 03 '14 at 15:22
  • @wurtel Yes, it works fine. See [iproute2 cheat sheet](http://baturin.org/docs/iproute2/#Routes%20with%20different%20metric) – Eugene Yarmash Dec 03 '14 at 19:05

0 Answers0