Bonjour à tous,
j’ai un ptit serveur perso que je voudrais pourvoir réveiller à distance (localement dans un 1er temps). La CM est une MSI K8N Neo3, donc a prioris compatible avec le WOL, le tout fonctionnant sous Etch. Les 2 pc sont reliés par un switch avec la connexion internet de la box sur l’uplink.
Je me suis inspiré des quelques sources, notamment là, là ou encore là, mais sans succès.
Voici un petit résumé de ma configuration:
$ ethtool eth0
Settings for eth0:
Supported ports: [ MII ]
Supported link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Supports auto-negotiation: Yes
Advertised link modes: 10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
1000baseT/Full
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
PHYAD: 1
Transceiver: external
Auto-negotiation: on
Supports Wake-on: g
Wake-on: g
Link detected: yes
$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo eth0
iface lo inet loopback
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
pre-down /usr/sbin/ethtool -s eth0 wol g
$ cat /etc/default/halt
# Default behaviour of shutdown -h / halt. Set to "halt" or "poweroff".
HALT=poweroff
WOL=1
NETDOWN=no
$ cat /etc/init.d/halt
#! /bin/sh
### BEGIN INIT INFO
# Provides: halt
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop: 0
# Short-Description: Execute the halt command.
# Description:
### END INIT INFO
NETDOWN=no
PATH=/sbin:/usr/sbin:/bin:/usr/bin
[ -f /etc/default/halt ] && . /etc/default/halt
. /lib/lsb/init-functions
do_stop () {
if [ "$INIT_HALT" = "" ]
then
case "$HALT" in
[Pp]*)
INIT_HALT=POWEROFF
;;
[Hh]*)
INIT_HALT=HALT
;;
*)
INIT_HALT=POWEROFF
;;
esac
fi
# See if we need to cut the power.
if [ "$INIT_HALT" = "POWEROFF" ] && [ -x /etc/init.d/ups-monitor ]
then
/etc/init.d/ups-monitor poweroff
fi
# Don't shut down drives if we're using RAID.
hddown="-h"
if grep -qs '^md.*active' /proc/mdstat
then
hddown=""
fi
# If INIT_HALT=HALT don't poweroff.
poweroff="-p"
if [ "$INIT_HALT" = "HALT" ]
then
poweroff=""
fi
# Make it possible to not shut down network interfaces,
# needed to use wake-on-lan
netdown="-i"
if [ "$NETDOWN" = "no" ]; then
netdown=""
fi
# dont shut interfaces down if WOL=1
wol="-i"
if [ "$WOL" = "1" ]
then
wol=""
fi
log_action_msg "Will now halt"
halt -d -f $wol $poweroff $hddown
}
case "$1" in
start)
# No-op
;;
restart|reload|force-reload)
echo "Error: argument '$1' not supported" >&2
exit 3
;;
stop)
do_stop
;;
*)
echo "Usage: $0 start|stop" >&2
exit 3
;;
esac
:
$ cat /etc/init.d/networking
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: networking
# Required-Start: mountkernfs ifupdown $local_fs
# Required-Stop: ifupdown $local_fs
# Default-Start: S
# Default-Stop: 0 6
# Short-Description: Raise network interfaces.
### END INIT INFO
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
[ -x /sbin/ifup ] || exit 0
. /lib/lsb/init-functions
spoofprotect_rp_filter() {
[ -e /proc/sys/net/ipv4/conf/all/rp_filter ] || return 1
RC=0
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo 1 > $f || RC=1
done
return $RC
}
spoofprotect() {
log_action_begin_msg "Setting up IP spoofing protection"
if spoofprotect_rp_filter; then
log_action_end_msg 0 "rp_filter"
else
log_action_end_msg 1
fi
}
ip_forward() {
log_action_begin_msg "Enabling packet forwarding"
if echo 1 > /proc/sys/net/ipv4/ip_forward; then
log_action_end_msg 0
else
log_action_end_msg 1
fi
}
syncookies() {
log_action_begin_msg "Enabling TCP SYN cookies"
if echo 1 > /proc/sys/net/ipv4/tcp_syncookies; then
log_action_end_msg 0
else
log_action_end_msg 1
fi
}
doopt() {
optname=$1
default=$2
opt=`grep "^$optname=" /etc/network/options || true`
if [ -z "$opt" ]; then
opt="$optname=$default"
fi
optval=${opt#$optname=}
if [ "$optval" = "yes" ]; then
eval $optname
fi
}
process_options() {
[ -e /etc/network/options ] || return 0
log_warning_msg "/etc/network/options is deprecated (see README.Debian of netbase)."
doopt spoofprotect yes
doopt syncookies no
doopt ip_forward no
}
case "$1" in
start)
process_options
log_action_begin_msg "Configuring network interfaces"
if ifup -a; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
ethtool -s eth0 wol g
;;
stop)
if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts |
grep -qE '^(nfs[1234]?|smbfs|ncp|ncpfs|coda|cifs)$'; then
log_warning_msg "not deconfiguring network interfaces: network shares still mounted."
ethtool -s eth0 wol g
exit 0
fi
log_action_begin_msg "Deconfiguring network interfaces"
if ifdown -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
ethtool -s eth0 wol g
;;
force-reload|restart)
process_options
log_action_begin_msg "Reconfiguring network interfaces"
ifdown -a --exclude=lo || true
if ifup -a --exclude=lo; then
log_action_end_msg $?
else
log_action_end_msg $?
fi
ethtool -s eth0 wol g
;;
*)
echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
ethtool -s eth0 wol g
exit 1
;;
esac
ethtool -s eth0 wol g
exit 0
Un tcpdump me permet de vérifier que le paquet est bien reçu machine allumé
$ tcpdump port 9
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 96 bytes
14:43:59.501334 IP 192.168.1.33.43513 > 255.255.255.255.discard: UDP, length 102
14:44:12.821068 IP 192.168.1.33.50424 > 255.255.255.255.discard: UDP, length 102
Voilà en gros ce que j’ai pu essayé mais je me retrouve toujours dans la même galère pc éteint. J’ai vu quelque part que la *box pouvait poser problème, mais sans toujours la même chose.
Un gros gros merci d’avance à celui qui pourra m’aider à résoudre ça :smt003