This is excerpt from my ip route command: dev enp1s0  proto kernel  scope link  src  metric 100 dev wlp2s0  proto kernel  scope link  src  metric 600 

First interface enp1s0 (Ethernet), has metric value of 100 (higher priority/lower number of hops) and the second, wlp2s0 (WLAN) has a value 600 (lower priority). I'm using Linux kernel 4.7.2.

How are those values set in Linux? When does it happen exactly?

  • What kernel are you using, and I assume enp1s0 is a wired interface?
    – cutrightjm
    Sep 17, 2016 at 17:48
  • I'm using Linux kernel 4.7.2 and yes, it's a wired interface.
    – syntagma
    Sep 17, 2016 at 18:04

1 Answer 1


The IPv4 routing table is not created by the kernel. The kernel merely stores and acts upon the routing table.

The metrics come from the user-space program which installed the default route. For a computer using DHCP, that will be from the DHCP daemon. For a computer with static addressing and routing, that will be from the distribution's interface addressing mechanism (Red Hat's /etc/sysconfig/network, Debian's ifupdown, etc).

It's common in user-space applications like NetworkManager to set the metric for the default route using the wired device to be better (lower) than the metric for the default route using the wireless device. That matches the commonly expected behaviour of preferring to use the wired link, if it is viable. This is the strategy you are seeing in your ip route show command.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .