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

Re: [SOLVED] RTL8111/8168B wake on lan (WOL) working randomly

2012/1/3 Janek Lapka <jan0x6c@gmail.com>:
> Juan Sierra Pons <juan@elsotanillo.net> writes:
>>lspci -v
>>02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
>  ^^ The 2 digit at the beginning of the line means the pci bus
> More info:
> http://www.thinkwiki.org/wiki/WakeOnLAN
> or google: pci-config wol
>> The problem is that when I shutdown the computer the NIC is switched
>> off too. I can see it as the port in my home ADSL router is switched
>> off. BUT randomly I can see that the NIC is not switched off after a
>> shutdown and if I send the WOL packet from another computer it works
>> like a charm.
> Use pci-config (apt-get install nictools-pci) to put the nic into
> sleep mode
> (part of my /etc/network/interfaces)
> #              pci-config -B 4 -#1
> # gigabyte p35c-ds3r pci bus ^   ^ device number
> # The primary network interface
> allow-hotplug eth0
> iface eth0 inet static
>        address
>        netmask
>        network
>        broadcast
>        gateway
>        # wol gigabyte p35c-ds3r (on asus p5b I don't need this)
>        #pre-up pci-config -W -B 4 -#1 # I don't use
>        #pre-up pci-config -B 4 -#1 # I don't use
>        pre-down pci-config -S -B 4 -#1 # Put device to sleep (ACPI D3)
>        pre-down pci-config -B 4 -#1 # Show the current status
> Also, if you share the drive with MS-Windows it may change the status of
> the driver.
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: [🔎] 87wr99pldc.fsf@ibmx60t.lan">http://lists.debian.org/[🔎] 87wr99pldc.fsf@ibmx60t.lan

Hi all,

Finally Janek pointed me in the right direction: nictools-pci package
and the pci-config command

I tried the pre-down directive in the /etc/network/interfaces and it
worked ok but the second or third time I rebooted my PC it got frozen
so I started to search the internet and I found a web [1]  explaining
how to use the pci-config

I've make it work using the following procedure:

lspci -nn |grep -i Ether

02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd.
RTL8111/8168B PCI Express Gigabit Ethernet controller [10ec:8168] (rev
^^ The 2 digit at the beginning of the line means the pci bus (As
explained by Janek)
         ^      ^ this is the vendor:model number


pci-config -B 2
pci-config.c:v2.05 2/23/2005 Donald Becker (becker@scyld.com)
Device #1 at bus 2 device/function 0/0, 816810ec.
                                                         ^-----^  this
is tne model:vendor number the same as before BUT in different order

Now I know the BUS number (2) and device number (#1)

So I can use the pci-config to put the NIC in the proper state for WOL:

pci-config -B 2 -# 1 -S

Instead of using the pre-down directive in the /etc/network/interfaces
I choose the /etc/init.d/halt script as written in [1] and added the
following lines just before "halt -d -f $netdown $poweroff $hddown"

        ### http://lists.debian.org/debian-user/2012/01/msg00182.html
        ### http://ubuntuforums.org/archive/index.php/t-951563.html
        rmmod r8168
        sleep 0.5
        modprobe r8168
        sleep 0.5
        pci-config -B 2 -# 1 -S
        sleep 0.5

        log_action_msg "Will now halt"
        halt -d -f $netdown $poweroff $hddown

I have restarted my PC at least 10 times and it works without problem.

[1] http://ubuntuforums.org/archive/index.php/t-951563.html

Thank you guys for your time!!

Best regards

Juan Sierra Pons                                 juan@elsotanillo.net
Linux User Registered: #257202       http://www.elsotanillo.net
GPG key = 0xA110F4FE
Key Fingerprint = DF53 7415 0936 244E 9B00  6E66 E934 3406 A110 F4FE

Reply to: