Subject: [alpine-devel] [Alpine 2.4] Network Interface Hotplugging Detection

From: Der Tiger <[email-masked]>
Date: Wed, 31 Oct 2012 16:45:48 +0100

It seems Alpine does not detect link up and down events on NICs.

My Alpine system has two NICs (Intel and RealTek) installed, which both
work fine as long as the link stays up. If I disconnect one of the
cables, the link goes down, as can be expected. Once the cable is
reconnected, the link stays down and dhcpcd won't renew the ip address
from an external DHCP server, even if I manually trigger a renew. Alpine
therefore ignores any link state changes.

AFAIK, link up and down events are usually handled by daemons like
ifplugd (http://linux.die.net/man/8/ifplugd), netplugd
(http://linux.die.net/man/8/netplugd) or hotplug
(http://linux.die.net/man/8/hotplug). Unfortunately I cannot find any of
those tools available as installable package for Alpine.

Is there any other way Alpine is supposed to handle link up and down
events (e.g. directly by the kernel)?

Does link event handling on Alpine require a certain configuration
(apart from /etc/network/interfaces) in order to work properly?

If, at this stage, Alpine doesn't handle link up and down events on NICs
at all, I will gladly contribute one of the utilities mentioned above as
installable package. On the other hand, if there is a solution allready
in place, which is just not configured properly on my system, I'd rather
use the solution available than create a redundant package.

Thank you for your input!

Regards, Tiger

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Natanael Copa <[email-masked]>
Date: Wed, 31 Oct 2012 20:54:06 +0100

On Wed, 31 Oct 2012 16:45:48 +0100

> It seems Alpine does not detect link up and down events on NICs.

What kernel is it?
> 
> My Alpine system has two NICs (Intel and RealTek) installed, which
> both work fine as long as the link stays up. If I disconnect one of
> the cables, the link goes down, as can be expected. Once the cable is
> from an external DHCP server, even if I manually trigger a renew.

This is most likely a bug in kernel driver.

I know that the r8169 driver got some signifcant changes with 3.4
kernel. I noticed today that I can no longer set link speed with
ethtool on one of my boxes.

Does it happen with intel nic too?

Does it happen with v2.4.5 iso (with 3.3 kernel)

> Alpine therefore ignores any link state changes.
> 
> (http://linux.die.net/man/8/hotplug). Unfortunately I cannot find any
> of those tools available as installable package for Alpine.

add dhcpcd to that list.

> events (e.g. directly by the kernel)?

No this is a bug.

Do you think you could test the latest edge snapshot iso? or wait for
v2.5_rc1 which should be be released tomorrow.

> (apart from /etc/network/interfaces) in order to work properly?

No

> If, at this stage, Alpine doesn't handle link up and down events on
> NICs at all, I will gladly contribute one of the utilities mentioned
> above as installable package. On the other hand, if there is a
> solution allready in place, which is just not configured properly on
> my system, I'd rather use the solution available than create a
> redundant package.

I wouldn't mind to add ifplugd but I don't think I would ever use it.
dhcpcd does the job for me.

> Thank you for your input!

Thanks for your feedback!

-nc

---

---

From: Der Tiger <[email-masked]>
Date: Wed, 31 Oct 2012 21:23:30 +0100

Hi Natanael,

Thanks for your prompt reply!

>> It seems Alpine does not detect link up and down events on NICs.
That's 3.4.13, but I can reproduce the behaviour at least down to 3.3.

> Does it happen with intel nic too?
I'm not sure. I'll have to verify that ASAP.

> Does it happen with v2.4.5 iso (with 3.3 kernel)
Yepp, it does.

>> ifplugd, netplugd or hotplug
> add dhcpcd to that list.
Didn't know that. That's, of course, a lead to follow. I'm going to
check the dhcpcd configuration, tomorrow.

> v2.5_rc1 which should be be released tomorrow.
I prefer to wait for tomorrow's 2.5 rc1 and come back to you with more
info as soon as I've tested the new release candidate.

> dhcpcd does the job for me.
Wouldn't do any good to add ifplugd, since dhcpcd does the link
handling, anyway. I just have to "motivate" dhcpcd to call ifup or
ifdown whenever the link status changes. Should be a configuration
problem, if it's not a kernel bug.

Regards, Tiger

---

---

From: Timo Teräs <[email-masked]>
Date: Wed, 31 Oct 2012 22:38:24 +0200

Hi,

> That's 3.4.13, but I can reproduce the behaviour at least down to 3.3.

Kernel detects it for me. But often dhcpd exits if it does not get lease within some time.

> check the dhcpcd configuration, tomorrow.

I just configured my dhcpd to never exit, and it handles the link state changes properly.

But if you want net specific static ip or dhcp params you probably need one of those hotplug things.

-Timo

---

---

From: Natanael Copa <[email-masked]>
Date: Thu, 1 Nov 2012 10:52:43 +0100

On Wed, 31 Oct 2012 22:38:24 +0200

> Kernel detects it for me. But often dhcpd exits if it does not get

I suppose you mean dhcpcd.

> > > > AFAIK, link up and down events are usually handled by daemons
> > > > like ifplugd, netplugd or hotplug
> > > add dhcpcd to that list.

dhcpcd can be configured to set static ip too on link detection.

-nc

---

---

From: Natanael Copa <[email-masked]>
Date: Thu, 1 Nov 2012 16:40:21 +0100

On Wed, 31 Oct 2012 21:23:30 +0100

> check the dhcpcd configuration, tomorrow.

I just remembered. I think you can run dhcpcd in 2 ways.
1) configure the interface as 'dhcp' in /etc/network/interfaces and let
   busybox ifup it.

2) remove all interfaces (maybe except lo) from /etc/network/interfaces
   and then run dhcpcd as standalone. 'rc-service dhcpcd start'
   and 'rc-update add dhcpcd'. dhcpcd will by default give all
   interfaces a dhcp address on link detection. You can configure it to
   ignore given interfaces, and set static ip address on link detect
   in /etc/dhcpcd/dhcpcd.conf

I'm not sure if the link detection is enabled in mode #1 but i know for
sure that mode #2 works.

-nc

---

---

From: Der Tiger <[email-masked]>
Date: Fri, 02 Nov 2012 17:26:53 +0100

ReHi Natanael,

> I'm not sure if the link detection is enabled in mode #1 but i know for

I upgraded my system to Alpine 2.5 rc1 (kernel 3.6.4). Hotplugging is
now recognized by the kernel on both NICs, again. I suppose it has been
a kernel bug that caused the interfaces (at least the RealTek NIC) to
stay down after reconnecting the network cable.

I also tried the dhcpcd variant (mode #2 in your description above), but
was unable to assign two static ipv4 addresses as well as static ipv6
addresses to a single interface in /etc/dhcpcd.conf. From what I
gathered roaming the WWW, dhcpcd isn't able to handle neither static
ipv6 addresses, nor multiple ipv4 addresses on the same interface.

Anyway, since the ifup/ifdown (mode #1) is now working fine, I see no
reason to change to dhcpcd, even if dhcpcd would have been my preferred
mode.

Thanks for your help!

Kind Regards, Tiger

---

---

From: Natanael Copa <[email-masked]>
Date: Fri, 2 Nov 2012 22:33:19 +0100

On Fri, 02 Nov 2012 17:26:53 +0100
Der Tiger <[email-masked]> wrote:
> > 2) remove all interfaces (maybe except lo)
> > from /etc/network/interfaces and then run dhcpcd as standalone.
> > 'rc-service dhcpcd start' and 'rc-update add dhcpcd'. dhcpcd will
> > by default give all interfaces a dhcp address on link detection.
> > You can configure it to ignore given interfaces, and set static ip

...
 
> I also tried the dhcpcd variant (mode #2 in your description above),
> but was unable to assign two static ipv4 addresses as well as static
> ipv6 addresses to a single interface in /etc/dhcpcd.conf. From what I

I wouldn't have known it unless Roy himself had told me, and pointing
out that its mentioned in the manpage. (something we should add to our
wiki so googles indexer finds it?).

From the man page:

     static value
             Configures a static value.  If you set ip_address then
     dhcpcd will not attempt to obtain a lease and just use the value
     for the address with an infinite lease time.

             Here is an example which configures a static address,
             routes and dns.
                   interface eth0
                   static ip_address=192.168.0.10/24
                   static routers=192.168.0.1
                   static domain_name_servers=192.168.0.1

Looks like it also has some support for ipv6. I dont know about static.

-nc

---