Wake-on-LAN a FreeBSD server

Compiled from at least three sources of wisdom, here is a brief wake-on-lan note for FreeBSD 10.1-STABLE.

Set your BIOS first, mine is tuned in “Advanced >> APM >> Power On By PME”!

Next, check your NIC:

# grep -l IFCAP_WOL /usr/src/sys/dev/*/*.c
/usr/src/sys/dev/ae/if_ae.c
/usr/src/sys/dev/age/if_age.c
/usr/src/sys/dev/alc/if_alc.c
/usr/src/sys/dev/ale/if_ale.c
/usr/src/sys/dev/bxe/bxe.c
/usr/src/sys/dev/e1000/if_em.c
/usr/src/sys/dev/e1000/if_lem.c
/usr/src/sys/dev/fxp/if_fxp.c
/usr/src/sys/dev/jme/if_jme.c
/usr/src/sys/dev/nfe/if_nfe.c
/usr/src/sys/dev/nge/if_nge.c
/usr/src/sys/dev/re/if_re.c
/usr/src/sys/dev/sis/if_sis.c
/usr/src/sys/dev/ste/if_ste.c
/usr/src/sys/dev/stge/if_stge.c
/usr/src/sys/dev/txp/if_txp.c
/usr/src/sys/dev/vge/if_vge.c
/usr/src/sys/dev/vr/if_vr.c
/usr/src/sys/dev/xl/if_xl.c

and see if ifconfig reckons it, too:

# ifconfig re0 | grep options
options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>

At a machine that is going to wake the server, install the tools for that purpose:

pkg_info | egrep ‘wol|Wake’
p5-Net-Wake-0.02p1 perl5 module for Wake On LAN
wol-0.7.1p2 Wake On Lan client

A one-liner is enough at a gateway that is going to wake the server:

the-gateway # cat /scripts/summon-the-zombie.sh
#!/bin/ksh
/usr/local/bin/wol -i 192.168.1.2 AA:BB:CC:DD:EE:FF

Finally, shorten the boot-time a bit:

# grep delay /boot/loader.conf
autoboot_delay=”2″

Voila! Your FreeBSD server is prepared for the life in XXI century capitalism – you can now pretend that you both take care about the power consumption AND wake the worker any time you want!

Compiled with the notes from lampros.chiadas.com, linux-bsd-sharing.blogspot.com, and forums.freebsd.org.

 

P.S. found out yet another way to wake a server from an OpenBSD box:

/usr/sbin/arp -W AA:BB:CC:DD:EE:FF if0

Leave a Reply

Your email address will not be published. Required fields are marked *