:: Re: [DNG] ifstat.eth0 on Boot [SOLV…
Página Inicial
Delete this message
Reply to this message
Autor: Didier Kryn
Data:  
Para: dng@lists.dyne.org
Assunto: Re: [DNG] ifstat.eth0 on Boot [SOLVED]
Le 20/12/2018 à 15:26, Didier Kryn a écrit :
> Le 19/12/2018 à 19:02, Pontus Goffe a écrit :
>> On 2018-12-19 18:23, Didier Kryn wrote:
>>>
>>>     Seems it can only work for one user because now it doesn't work
>>> for me any more (~:
>>
>>
>> I got your patch to work nicely but only if I did not use "auto ethx"
>> in /etc/network/interfaces.
>> I use only "allow-hotplug ethx" and "iface ethx inet dhcp"
>> //PG
>>
> Le 20/12/2018 à 01:03, Tom H a écrit :
>> [ off-list ]
>>
>> Hi Didier
>>
>> I've been meaning to email you since Saturday because that's when I
>> read your "/etc/init.d/networking" patch and it didn't make sense to
>> me.
>>
>> --- networking~    2016-09-16 15:02:20.000000000 +0200
>> +++ networking    2017-12-18 17:25:49.902781233 +0100
>> @@ -112,7 +112,12 @@ ifup_hotplug () {
>>                   done)
>>           if [ -n "$ifaces" ]
>>           then
>> -        ifup $ifaces "$@" || true
>> +        # link detection does not work unless we up the link
>> +        ip link set "$iface" up || true
>> +        if [ "$(cat /sys/class/net/$link/operstate)" = up ]
>> +        then
>> +            echo "$iface"
>> +        fi
>>           fi
>>       fi
>>   }
>>
>> I see two problems.
>>
>> 1) You use "$iface" but the rest of the script uses "$ifaces".
>>
>> 2) 'ip link set "$iface" up' brings "$iface" up but 'ifup $ifaces
>> "$@"" configures "$ifaces" and brings it up.
>>
>> So I'm not surprised that your edit's not working for you.
>>
>> What is/was the bug with "ifup_hotplug"?
>>
>> If eth0's plugged in during boot and "allow-hotplug eth0" isn't
>> bringing it up, you can add "allow-auto eth0", eth0'll be brought up
>> by "ifup -a ...", and "ifup_hotplug ..." will print an "already
>> configured" warning to the console. It'll only work around your
>> "allow-hotplug" bug but it's a start.
>
>     You are right. The patched line was not the right one. But I had a
> little thinking about it all...
>
>     The use case is a laptop with one ethernet interface (say eth0)
> and one wifi interface (say wlan0), where only one of the network
> interfaces is used: eth0 when it is connected to the network, wlan0
> otherwise. To manage the changes, you need netplug or ifplugd, which
> are able to detect when a cable is plugged into eth0 or removed, a
> thing the init script does not try to detect.
>
>     There are two ways to tell the init script to bring up interfaces.
> If a network interface can be hotplugged, then the interfaces file
> needs the 'allow-hotplug' stanza, otherwise, the good old 'auto'
> stanza is fine. However allow-hotplug works fine in all cases,
> provided a hotplugger (udev/eudev/vdev/mdev) is installed. ifplugd
> doesn't need these stanzas.
>
>     For what concerns eth0, I found that the simplest solution is to
> remove any auto or allow-hotplug concerning eth0. netplug/ifplugd will
> take care of  bringinig it up (and wlan0 down) if it detects a
> carrier. It is just an error to leave the possibility to the init
> script to bring eth0 up when it cannot know if it is connected.
>
>     I would just suggest to restore the original initscript and
> configure the interfaces file according to the previous explanation.
> Here is my working example (note the absence of 'auto eth0' or
> 'allow-hotplug eth0'):
>
> auto lo iface lo inet loopback iface eth0 inet dhcp
>
> auto wlan0 iface wlan0 inet manualwpa-roam
> /etc/wpa_supplicant/wpa_supplicant.conf
>
> iface default inet dhcp
>
>
>             Didier
>
>

    The f. mail client has messed up the formatting. Here is (in
attachment) the working interfaces file



auto lo
iface lo inet loopback

iface eth0 inet dhcp

auto wlan0
iface wlan0 inet manual
      wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf


iface default inet dhcp