Re: network reference v2: questions about allow-hotplug
On Sat, Feb 02, 2008 at 03:39:08PM +1100, vincent.mcintyre@atnf.csiro.au wrote:
> Hello,
>
> I have been looking at the wiki version of the network reference
> [ http://wiki.debian.org/DebianReference/Network ]
>
> I have a few questions about the description of "allow-hotplug", which
> I think could be improved further. I have always found the documentation
> for this stanza difficult to understand, both in the Reference and in
> interfaces(5).
>
> Question 1.
> In the table of stanzas, you have this line
> | "allow-hotplug <interface_name>" |
> To start interface <interface_name> upon hotplug event of the system. |
>
> I take this to mean that there is hotplug support in the ifupdown
> programs, so that they can respond to hotplug events from the kernel.
> Is that correct?
> Would it be better to say it this way?
> | "allow-hotplug <interface_name>" |
> Start interface <interface_name> when the kernel detects a hotplug event
> from the interface. |
Yes. If you think this table should use imperative than noun pharase,
please correct all. For now, I kept "To verb ..." structure. Done for
now.
> Question 2.
> Under "The network interface served by the DHCP" is the sentence:
> The following configuration entry in the /e/n/i file brings up the
> primary network interface eth0 upon the Linux kernel finding up the
> physical interface eth0 (via allow-hotplug stanza) while configuring
> it with DHCP.
>
> Would it be better to say this?
> The following configuration entry in the /e/n/i file is the typical
> way to set up a network interface in such an environment. When the
> Linux kernel detects the physical interface eth0, the allow-hotplug
> stanza will cause ifup to bring up the interface and the iface stanza
> will cause ifup to use DHCP to configure the interface.
Yes. Much more readable English. Done.
> Question 3.
>
> If I understand correctly the "hotplug events" referred to here are
> relating to the network hardware being hotplugged into a running system,
> eg a PCMCIA card being inserted or a USB ethernet device being plugged in.
>
> When a system with a built-in ethernet card is powered up, is a hotplug
> event generated when the kernel detects it, during the boot sequence?
That should only be enabled by "auto", I thought.
> Question 4.
> If I power up a system with a built-in ethernet interface, but with
> no ethernet cable plugged into it, does plugging in an ethernet cable
> also generate a hotplug event that is noticed by allow-hotplug?
Unfortunately no at this moment. I should say I was annoyed for this
when I forget to plug in wire. I always have to do "ifdown eth0; ifup
etho". It becomes some zombee state as I observed. This is very good
question.
> This last part is the piece I find most confusing. The section on the
> wiki page about "The caution for operations" helped quite a bit,
> explaining that if one is using ifplugd then "auto" and "allow-hotplug"
> should not be used. I think that is the first time I have seen that
> written down clearly.
I inherited that from the previous version mostly described by Thomas
Hood. If you understand that these system has layered structure, it is
quite natural.
> The section "auto-switchable network configuration" hints that the
> answer here is yes, plugging in an ethernet cable generates a hotplug
> event that allow-hotplug will act upon.
> If so, does that mean ifplugd is no longer needed?
Tat is what it is. But am not in such fancy network now to positively
test it. I just summarized documentation here. In the second thought,
if unplugged ethernet cause funny network state, how can it be done like
this. I may be wrong here.
Recently, I put ifupdown-extra package into my system. Which seem to do
something on unplugged ethernet cable.... I need to check...
Let me do ifdown / unplug / ... and:
osamu@snoopy:~$ sudo ifdown eth0
Restarting mail retriever agent: fetchmail.
There is already a pid file /var/run/dhclient.eth0.pid with pid 4110
killed old client process, removed PID file
Internet Systems Consortium DHCP Client V3.1.0
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:19:e3:63:0e:3f
Sending on LPF/eth0/00:19:e3:63:0e:3f
Sending on Socket/fallback
option_space_encapsulate: option space agent does not exist, but is configured.
DHCPRELEASE on eth0 to 192.168.11.1 port 67
osamu@snoopy:~$ sudo ifup eth0
osamu[12616]: WARNING: Initialising interface eth0 which does not have link
Internet Systems Consortium DHCP Client V3.1.0
Copyright 2004-2007 Internet Systems Consortium.
All rights reserved.
For info, please visit http://www.isc.org/sw/dhcp/
Listening on LPF/eth0/00:19:e3:63:0e:3f
Sending on LPF/eth0/00:19:e3:63:0e:3f
Sending on Socket/fallback
option_space_encapsulate: option space agent does not exist, but is configured.
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 12
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
osamu@snoopy:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:19:e3:63:0e:3f
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:296268 errors:0 dropped:0 overruns:0 frame:0
TX packets:208408 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:324564384 (309.5 MiB) TX bytes:75106855 (71.6 MiB)
Interrupt:16
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:13564 errors:0 dropped:0 overruns:0 frame:0
TX packets:13564 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2849107 (2.7 MiB) TX bytes:2849107 (2.7 MiB)
osamu@snoopy:~$
This "Link encap:Ethernet" is the state without wire. Let me plug-in:
Nothing happen. then I run ifdown/ifup
eth0 Link encap:Ethernet HWaddr 00:19:e3:63:0e:3f
inet addr:192.168.11.2 Bcast:192.168.11.255 Mask:255.255.255.0
inet6 addr: fe80::219:e3ff:fe63:e3f/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:296348 errors:0 dropped:0 overruns:0 frame:0
TX packets:208538 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:324579278 (309.5 MiB) TX bytes:75124347 (71.6 MiB)
Interrupt:16
Oh, I am using simple single DHCP set up now. At least, plugging-in wire does not cause hotplug event.
I need to check how ifupdown-extra can be leveraged. Any onw with idea?
> Question 5.
> At the top of the page it explains:
> This section will address network setup for the mobile PC which moves
> around different networks. (For the non-mobile PC, the debian-installer
> should have taken care your network setup and there are almost nothing
> for us to play with.)
> I think that it would be worth including a short subsection describing
> how a non-mobile PC is normally set up. What do others think?
> For example:
>
> == Non-mobile PCs ==
> Systems that are normally permanently attached to a single network
> should have been correctly configured by the debian-installer.
> Typically the /e/n/i file looks like this:
> {{{
> auto lo
> iface lo inet loopback
> auto eth0
> iface etho inet dhcp
> }}}
> In some cases the host may have a static IP configuration for eth0,
> like that shown in "The network interface with static IP".
>
> Non-mobile systems typically do not need the {{{resolvconf}}} package;
> their name resolution can be set up via DHCP or by manual editing of
> {{{/etc/resolv.conf}}}.
This is generally true. How about PC directly on PPPoE or PPP dial-up.
The above is good onlt for PC behind router or some DHCP serverd network.
> Yes, this is a bit redundant but I think it might help readers looking
> for authoritative information on setting up their LAN machines.
If you can think of non-redundant way, I will follow you.
Osamu
Reply to: