NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/52554: IPv6 connections not routing to default gateway



On 03/10/2017 02:31, Ryota Ozaki wrote:
> On Tue, Oct 3, 2017 at 10:08 AM, Roy Bixler <rcbixler%nyx.net@localhost> wrote:
>> On Mon, Oct 02, 2017 at 02:15:01PM +0000, Roy Bixler wrote:
>>>  I asked the network admin. and he tells me that that IPv6 routers are
>>>  advertising priorities and the router that works has the highest
>>>  priority.  He says that it's an option that was put into the Linux
>>>  kernel a few years ago.  The option, CONFIG_IPV6_ROUTER_PREF, quotes
>>>  RFC4191 as a reference.  From looking at the dhcp client logs, I can
>>>  see that it's getting advertisements from all of the routers and it
>>>  just picks the first one (i.e. sets its default route according to it)
>>>  and disregards the others.  I still wonder why this doesn't happen
>>>  with NetBSD 7.1.
>>
>> I'm fairly convinced that the problem is with dhcpcd.  With NetBSD-8,
>> I tried an experiment, which set ip6mode to autohost and pass the -4
>> flag to dhcpcd.  I observed that the correct default router was
>> applied more often.  If it wasn't, then I could do an "ndp -R" command
>> one (or a few) time(s).  If it found the highest priority router
>> first, then "ndp -H" was enough to correct the default IPv6 router.
>> If some other IPv6 router was found first, then a router with higher
>> preference will not change the routing table.  However, similar
>> experiments I did with NetBSD 7.1 had the same result.
>>
>> The difference is that, with NetBSD 7.1, dhcpcd will obey the router's
>> priority.  Even if a lower preference router advertises first and is
>> made the default IPv6 router, dhcpcd will correct that later if the
>> higher preference router advertises.  With NetBSD 8, dhcpcd strictly
>> takes the first IPv6 router that advertises and makes that the
>> default.  It will never update the default unless I manually do "ndp
>> -R" once or a few times, the highest priority router happens to
>> advertise first and then I do "ndp -H" to update the routing table.
> 
> Thank you for the in-depth investigations.
> Let's summon the author of dhcpcd :)
> 
> Roy (Marples), do you have any ideas?

I appear as if by magic wearing my wizards robe and pointy hat!

dhcpcd looks like it should be doing this correctly.
https://roy.marples.name/git/dhcpcd.git/tree/src/ipv6nd.c#n506

As we can see, dhcpcd obeys router preference if, and only if the
interface metrics they are received on are equal. Otherwise dhcpcd will
prefer the router on the interface with the lowest metric. So by
default, dhcpcd will use a low priority router on a wired interface over
a high priority router on a wireless interface because dhcpcd prefered
wired over wireless by default. So the question becomes, are the RA's
being receieved on one interface or many interfaces?

One comment though - ndp won't influence dhcpcd directly (at most it
could clear addresses and routes, but dhcpcd will just put back it's
idea of them when another RA comes in), so if you do use dhcpcd, don't
use ndp other than for reporting purposes.

Roy


Home | Main Index | Thread Index | Old Index