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

Re: laptop restart eth0 automatically on plugin or on awake like a desktop



On 10/06/11 22:20, Brian wrote:
> On Thu 09 Jun 2011 at 21:24:40 -0400, Tom H wrote:
> 
>> On Thu, Jun 9, 2011 at 12:48 PM, Brian <ad44@cityscape.co.uk> wrote:
>>>
>>> Why would plugging or unplugging the ethernet cable be expected to
>>> bring the interface up or down?
>>
>> That's the whole point of "allow-hotplug".
> 
> In which case it is not working here.
> 
>    root@dektop3:~# cat /etc/network/interfaces
>    auto lo
>    iface lo inet loopback
> 
>    allow-hotplug eth0
>    iface eth0 inet static
>            address 192.168.7.30
>            netmask 255.255.255.0
>            network 192.168.7.0
>            broadcast 192.168.7.255
>            gateway 192.168.7.1
> 
> Boot with cable attached. (Although it makes no difference to the
> ifconfig output if there is no cable).
> 
>    root@dektop3:~# ifconfig
>    eth0      Link encap:Ethernet  HWaddr 00:0c:76:b3:b4:ca
>              inet addr:192.168.7.30  Bcast:192.168.7.255  Mask:255.255.255.0
>              inet6 addr: fe80::20c:76ff:feb3:b4ca/64 Scope:Link
>              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
>              RX packets:71 errors:0 dropped:0 overruns:0 frame:0
>              TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
>              collisions:0 txqueuelen:1000
>              RX bytes:9601 (9.3 KiB)  TX bytes:1454 (1.4 KiB)
>              Interrupt:23 Base address:0xe400
> 
>    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:12 errors:0 dropped:0 overruns:0 frame:0
>              TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
>              collisions:0 txqueuelen:0
>              RX bytes:656 (656.0 B)  TX bytes:656 (656.0 B)
> 
> Remove cable.
> 
>    root@dektop3:~# dmesg | tail -n 1
>    [  158.220270] via-rhine 0000:00:12.0: eth0: link down
> 
<snipped>
> 
> eth0 is not brought down 

Yes it is --------------------------------------^

> and also retains its IP address.

Not "also". It's a static address.

> 
> 
With those settings hotplug never gets to function, as the device
(builtin) is there from boot, and nothing can be changed whether the
cable is connected or not (static settings).
If you change the static settings to dhcp it should change - provided
network manager is not installed of course.
eg. change static to dhcp and comment out the last five lines
restart the network and ifconfig should aquire an network settings - the
nic will be brought down when the cable is later removed - but settings
will be retained (lease determined).

Your current method of configuring the network is a fast, reliable, and
simple way if LAN is the only connection you ever use. You can even add
dns entries to interfaces.

Where you might have problems is moving to different LANs or using a modem.

I suspect the purpose of hotplug is not ifconfig - it's for removable
NICs - PCMCIA et al.

Cheers

-- 
Tuttle? His name's Buttle.
There must be some mistake.
Mistake? [Chuckles]
We don't make mistakes.


Reply to: