Wake on LAN

trutlze

Member

Reaction score: 1
Messages: 46

Hi,

I want to shutdown my FreeBSD-Server and start it over LAN via Wake on LAN. But it doesn't work.

I set sysctl-variable dev.re.0.wake to 1 . I shut down the server with # shutdown -p now. Then I tried # wake INTERFACE SERVERNAME or # wakeonlan SERVER-NIC-MAC on a client on the same net, but nothing happened.


Hardware
Mainboard: ASUS E35M1-I
OnBoard CPU: AMD E-350
OnBoard NIC:
Code:
re0: <RealTek 8168/8111 B/C/CP/D/DP/E PCIe Gigabit Ethernet> port 0xe000-0xe0ff mem 0xd0004000-0xd0004fff,0xd0000000-0xd0003fff irq 17 at device 0.0 on pci4
re0: Using 1 MSI messages
re0: Chip rev. 0x2c000000
re0: MAC rev. 0x00000000
Software
BIOS Version: 0401 x64 from 3/18/2011
FreeBSD 8.2-RELEASE-p5 amd64 from Sun Jan 1 2012

[CMD=""]ifconfig[/CMD] shows this:
Code:
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
So I suppose WoL is supported on this NIC with this driver.

In BIOS there is no option to turn WoL on or off, but I found several sites that claimed that this board supports WoL. When the server is turned off, there is no active light on LAN-port. So maybe the NIC isn't waiting for WoL-packets?

Do you have any suggestions?
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,630
Messages: 13,850

trutlze said:
Hi,

I want to shutdown my FreeBSD-Server and start it over LAN via Wake on LAN. But it doesn't work.

I set sysctl-variable dev.re.0.wake to 1 .
That OID doesn't exist on 8-STABLE. But I've never needed it, either.

I shut down the server with # shutdown -p now. Then I tried # wake INTERFACE SERVERNAME
INTERFACE is the interface to use for sending the magic packet. SERVERNAME as a name only works if it has been added to /etc/ethers. Otherwise, it's the MAC address of the system to wake.

For example, sending from a system that has an Intel Ethernet card:
# wake em0 00:1a:21:5c:b1:71

# wakeonlan SERVER-NIC-MAC on a client on the same net, but nothing happened.
The FreeBSD command is just wake.
 
OP
OP
T

trutlze

Member

Reaction score: 1
Messages: 46

Thanks for your reply. What you described is what I've done. I just used those wildcards to not "reveal" my MACs/Names/etc.
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,630
Messages: 13,850

Okay, one other point: the FreeBSD driver on the target system should not matter at all. That system is off, and the Ethernet interface and BIOS are in charge. So either the packet is not arriving, or the card or BIOS are not reacting to it.
 
OP
OP
T

trutlze

Member

Reaction score: 1
Messages: 46

That's what I feared. I sent the WoL-packets while the target system was up and doing a tcpdump. And the packet arrived. So I have to ask ASUS-guys ...

As far as I understand the WoL-thingy the OS and driver is the instance that tells the NIC to stay in a listening mode after the system shut down. Thus the driver on the target system has a certain relevance.
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,630
Messages: 13,850

trutlze said:
That's what I feared. I sent the WoL-packets while the target system was up and doing a tcpdump. And the packet arrived. So I have to ask ASUS-guys ...

As far as I understand the WoL-thingy the OS and driver is the instance that tells the NIC to stay in a listening mode after the system shut down. Thus the driver on the target system has a certain relevance.
That would make sense if the system is in sleep, not off. But I've got a system right here that will wake up (WOL) even after the power cord has been disconnected. Well, and reconnected.

It's possible the packet isn't right to wake up that system. Have you tried other operating systems like a Linux live CD to wake it? Most likely is still BIOS settings or bugs, though.
 

Talisker

New Member

Reaction score: 1
Messages: 4

Hi, I've got an E35M1-M PRO (Realtek 8111E according to asus.com) with the same problem.

Setup:

FreeBSD 9.0-RELEASE with or without the patch that yongari references applied (makes no difference).

Code:
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
Wake on LAN doesn't work.

On the same hardware and the same wake-up host it works fine with Ubuntu 11.10, so it ought to be something FreeBSD specific.

Any suggestion/advice would be most welcome.

Thanks,
Torsten
 

wblock@

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 3,630
Messages: 13,850

I would like to understand how the operating system affects this. Is there nonvolatile memory in the Ethernet board, or maybe a volatile setting that remains after shutdown as long as the system has standby power?
 

yongari@

Member
Developer

Reaction score: 28
Messages: 76

According to the ifconfig output you posted, you didn't correctly apply the patch. If you applied the patch correctly, you should not see WOL_UCAST and WOL_MCAST capabilities because I intentionally disabled them in the patch.
So make sure to rebuild/reboot kernel after applying the patch. Instead of just saying WOL works on Linux, elaborating on what you did on FreeBSD would get more chances to get answers from other users/developers in this forum.
 

yongari@

Member
Developer

Reaction score: 28
Messages: 76

The behavior highly depends on WOL implementation of controller. For controllers that support automatic wake functions, driver may not need any programming for the controller to make WOL work. This feature even works when system get power again after power lost. However, if you changed controller's station address to other one rather than using factory default one, automatic wakeup via WOL wouldn't work. Also driver will make controller to use 10/100Mbps link to save power with WOL. If automatic wakeup function is used after power lost, the link speed chosen for WOL may or may not be 10/100Mbps link.
 

Talisker

New Member

Reaction score: 1
Messages: 4

yongari@ said:
According to the ifconfig output you posted, you didn't correctly apply the patch. If you applied the patch correctly, you should not see WOL_UCAST and WOL_MCAST capabilities because I intentionally disabled them in the patch.
So make sure to rebuild/reboot kernel after applying the patch. Instead of just saying WOL works on Linux, elaborating on what you did on FreeBSD would get more chances to get answers from other users/developers in this forum.
First: I don't know why you think it's appropriate to be rude. It isn't.

I did apply the patch correctly and did an ifconfig re0 wol just to make sure I don't miss any WOL packet. That's why WOL_UCAST and WOL_MCAST are in there.

And what exactly do you want me to elaborate on? I'm more than happy to supply any relevant information but WOL is pretty basic after all.

Boot up machine, check WOL_MAGIC is active for re0, turn off machine, try to wake it up. Works in Linux, works in Windows 7, doesn't work in FreeBSD. Anything I'm missing here?
 

yongari@

Member
Developer

Reaction score: 28
Messages: 76

Ah, I see. Now I can understand why you have both WOL_UCAST and WOL_MCAST capabilities are enabled. The patch disables them by default but it will still allows them to be configured if user explicitly wants the feature and you explicitly enabled all WOL features. WOL_MAGIC is enabled by default so you don't have to issue ifconfig command again to enable wakeup via magic packet and 'wol' option of ifconfig means WOL_UCAST, WOL_MCAST and WOL_MAGIC.

There are also a couple of WOL related changes but I thought r227850 would be minimal one that makes WOL work on recent RealTek controllers. Your experiment indicates my assumption was wrong. Given that r227850 didn't work, would you try latest stable/9 on your box? Also it would be good to know what kind of controller you have. Just post re(4) related message from the dmesg output.
 

Talisker

New Member

Reaction score: 1
Messages: 4

Thanks for looking into this further.

I've just upgraded the kernel (not userland) to 9.0-STABLE as of today. if_re.c is revision 1.198.2.5.

Unfortunately Wake on LAN still doesn't work.

The board is an ASUS E35M1-M PRO with a Realtek 8111E according to the specs at asus.com.

This is what dmesg says about re0:

Code:
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F PCIe Gigabit Ethernet> port 0xe000-0xe0ff mem 0xd0004000-0xd0004fff,0xd0000000-0xd0003fff irq 17 at device 0.0 on pci4
re0: Using 1 MSI-X message
re0: Chip rev. 0x2c000000
re0: MAC rev. 0x00000000
miibus0: <MII bus> on re0
re0: Ethernet address: bc:ae:c5:cb:d4:25
If I can be of any further assistance then please let me know.
 

yongari@

Member
Developer

Reaction score: 28
Messages: 76

Thanks for the information. Your controller is RTL8168E so I tried to reproduce the issue with RTL8168E sample board. I was successfully able to reproduce the issue. It seems there was a logic error in the driver such that WOL on some controllers didn't work as expected. Please try the patch at the following URL and let me know how it goes on your box. Since you already use latest stable/9, just apply the patch and rebuild/reboot kernel.
http://people.freebsd.org/~yongari/re/re.wol.diff
 

Talisker

New Member

Reaction score: 1
Messages: 4

Thank you very much, that patch works!

It also works with 9.0-RELEASE when applying both of your patches in this thread.

And just to clarify things for everyone: ifconfig re0 wol and sysctl dev.re.0.wake=1 are both NOT required. WOL works out of the box for me with these patches.
 

yongari@

Member
Developer

Reaction score: 28
Messages: 76

Thanks a lot for testing.
Patch committed to HEAD(r230336) will MFC the change after settlement.
 
OP
OP
T

trutlze

Member

Reaction score: 1
Messages: 46

Thanks for the patches. It's working now.

Here's what I did step-by-step:

1. Getting sources for RELENG_9_0 with csup (Handbook: A.6 Using CVSup)
2. # cd /usr/src/sys/dev/re
3. fetching both patches (fetch(1))
4. create a backup-copy of if_re.c
5. applying both patches (patch(1))
6. building world & kernel, installing kernel & world (Handbook: 25.7 Rebuilding "world")


After updating went fine, I shutdown the system and woke it up again (the system was still plugged into the wall). I wasn't able to wake it up after completely removing current. So the WoL-settings seem to be stored on volatile memory.

The BIOS-setting that needs to be enabled is called "Advanced\ APM\ Power On By PME".
 

shulfei

New Member


Messages: 1

Hi all.
Help me if it possible.
Code:
FreeBSD 10.3
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0xe000-0xe0ff mem 0xf7e00000-0xf7e00fff,0xf0100000-0xf0103fff irq 16 at device 0.0 on pci1
tcpdump -i re0 -x port 9 show me that packets arrived.
I successfully wake up host machine after poweroff.
But only in 2 minutes period after poweroff.
If period more than 2 minutes, host does not wake up.

Patches not applying, don't understand how.
Code:
/usr/src/sys/dev/re: No such file or directory
 
Top