* IPv6: metrics of default routes on different interfaces (Ethernet vs. wifi)
@ 2011-08-28 15:02 Jan Kundrát
2011-08-28 15:48 ` Alexander E. Patrakov
0 siblings, 1 reply; 3+ messages in thread
From: Jan Kundrát @ 2011-08-28 15:02 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2507 bytes --]
Dear LKML,
in the IPv4 world, the default routes on my wired interface have a
different metric than the WiFi ones:
velbloud ~ # ip r
default via 192.168.1.1 dev eth0 metric 3
default via 192.168.3.1 dev wlan0 metric 2004
127.0.0.0/8 via 127.0.0.1 dev lo
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.250
192.168.3.0/24 dev wlan0 proto kernel scope link src 192.168.3.250
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.
On the other hand, the IPv6 default routes, as auto-configured by kernel
with help from radvd running on my router both have the same metric:
velbloud ~ # ip -6 r
2a00:c500:215:23f5::/64 dev eth0 proto kernel metric 256 expires 86394sec
2a00:c500:515:2336::/64 dev wlan0 proto kernel metric 256 expires
86036sec
fe80::/64 dev eth0 proto kernel metric 256
fe80::/64 dev wlan0 proto kernel metric 256
ff00::/8 dev eth0 metric 256
ff00::/8 dev wlan0 metric 256
default via fe80::c63d:c7ff:fe90:d066 dev eth0 proto kernel metric
1024 expires 1799sec hoplimit 64
default via fe80::c83d:c7ff:fe90:d066 dev wlan0 proto kernel metric
1024 expires 1442sec hoplimit 64
(The router is the same box for both networks, and the radvd is
configured to advertise a high AdvRoutePreference on wired ethernet and
a medium one over wifi. This has no effect, which is -- I guess --
expected, as the preference shall affect only selection among routers on
the same interface.)
In this particular setup (e1000e and iwl3945 on an ancient Thinkpad T60
2007-FRG, kernel 2.6.39-gentoo-r2), the end result is general IPv4
traffic preferring wired gigabit Ethernet, with IPv6 data utilizing the
WiFi connection.
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. Could you
please point me to the right direction, so that I can come up with a
patch doing the same for IPv6? Or is this a flawed idea for some reason?
I'd appreciate a Cc on reply, as I'm not subscribed to this list. Or
just yell at me if that's wrong approach here.
Cheers,
Jan
--
Trojita, a fast e-mail client -- http://trojita.flaska.net/
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: IPv6: metrics of default routes on different interfaces (Ethernet vs. wifi)
2011-08-28 15:02 IPv6: metrics of default routes on different interfaces (Ethernet vs. wifi) Jan Kundrát
@ 2011-08-28 15:48 ` Alexander E. Patrakov
2011-08-28 18:49 ` Jan Kundrát
0 siblings, 1 reply; 3+ messages in thread
From: Alexander E. Patrakov @ 2011-08-28 15:48 UTC (permalink / raw)
To: Jan Kundrát; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: IPv6: metrics of default routes on different interfaces (Ethernet vs. wifi)
2011-08-28 15:48 ` Alexander E. Patrakov
@ 2011-08-28 18:49 ` Jan Kundrát
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kundrát @ 2011-08-28 18:49 UTC (permalink / raw)
To: Alexander E. Patrakov; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 526 bytes --]
On 08/28/11 17:48, Alexander E. Patrakov wrote:
> 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:
Doh, that completely explains what I'm seeing. The IPv6
autoconfiguration is not handled by userspace at all, AFAIK.
Thanks for correcting my assumptions, now I know where to work further.
With kind regards,
Jan
--
Trojita, a fast e-mail client -- http://trojita.flaska.net/
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-08-28 18:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-28 15:02 IPv6: metrics of default routes on different interfaces (Ethernet vs. wifi) Jan Kundrát
2011-08-28 15:48 ` Alexander E. Patrakov
2011-08-28 18:49 ` Jan Kundrát
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox