Re: IPv6: metrics of default routes on different interfaces (Ethernetvs. wifi)

From: Alexander E. Patrakov
Date: Sun Aug 28 2011 - 11:56:20 EST


28.08.2011 21:02, Jan KundrÃt wrote:
I'm assuming here that the metrics of the default routes are somehow
derived from the "kind" of the underlying network interface, so that a
gigabit Ethernet is preferred over a 100Mbps one, which is preferred
over a 10Mbps one, etc. Please correct me if I'm wrong and the metrics
have a different origin, or if the wired-ethernet-preference it's just a
pure luck.

I've tried grepping my kernel sources, but wasn't able to find out the
place where the interface type is used in metric assignment.

It is not in the kernel. You have to grep through the source of whatever utility you are using to configure your interfaces. For dhcpcd, the code is around line 200 in net.c:

/* We reserve the 100 range for virtual interfaces, if and when
* we can work them out. */
iface->metric = 200 + if_nametoindex(iface->name);
if (getifssid(ifname, iface->ssid) != -1) {
iface->wireless = 1;
iface->metric += 100;
}

but this doesn't match the metrics that you have. So I assume you use some other tool.

--
Alexander E. Patrakov
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/