Wake On Lan: differenze tra le versioni

Vai alla navigazione Vai alla ricerca
Nessun oggetto della modifica
Nessun oggetto della modifica
Riga 85: Riga 85:
L'opzione -D serve solo ad avere in ouput qualche informazione in pi� sull'operazione.
L'opzione -D serve solo ad avere in ouput qualche informazione in pi� sull'operazione.
Se tutto � andato per il verso giusto, il secondo pc dovrebbe essersi acceso..
Se tutto � andato per il verso giusto, il secondo pc dovrebbe essersi acceso..
==Ultimi ritocchi==
Ora, se il pc partito, noterete che lanciando nuovamente "ethtool eth0" il metodo di wake-on tornato a "d".
Per far si che ogni volta che accendete il computer il metodo usato sia "g" ci sono varie strade; di seguito spiegher quella che ho scelto ovvero
la modifica del file di avvio della rete.
Aprite il file '''/etc/init.d/networking''' e modificatelo come segue (le modifiche sono in grassetto; consiglio di applicarle nella parte corrispondente del proprio file evitando di fare il copia e incolla dell'intero file!):
<pre>
#!/bin/sh
#
# manage network interfaces and configure some networking options
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
if ! [ -x /sbin/ifup ]; then
    exit 0
fi
spoofprotect_rp_filter () {
    # This is the best method: turn on Source Address Verification and get
    # spoof protection on all current and future interfaces.
   
    if [ -e /proc/sys/net/ipv4/conf/all/rp_filter ]; then
        for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
            echo 1 > $f
        done
        return 0
    else
        return 1
    fi
}
spoofprotect () {
    echo -n "Setting up IP spoofing protection: "
    if spoofprotect_rp_filter; then
        echo "rp_filter."
    else
        echo "FAILED."
    fi
}
ip_forward () {
    if [ -e /proc/sys/net/ipv4/ip_forward ]; then
        echo -n "Enabling packet forwarding..."
        echo 1 > /proc/sys/net/ipv4/ip_forward
        echo "done."
    fi
}
syncookies () {
    if [ -e /proc/sys/net/ipv4/tcp_syncookies ]; then
        echo -n "Enabling TCP/IP SYN cookies..."
        echo 1 > /proc/sys/net/ipv4/tcp_syncookies
        echo "done."
    fi
}
doopt () {
    optname=$1
    default=$2
    opt=`grep "^$optname=" /etc/network/options`
    if [ -z "$opt" ]; then
        opt="$optname=$default"
    fi
    optval=${opt#$optname=}
    if [ "$optval" = "yes" ]; then
        eval $optname
    fi
}
case "$1" in
    start)
doopt spoofprotect yes
        doopt syncookies no
        doopt ip_forward no
        echo -n "Configuring network interfaces..."
        ifup -a
'''ethtool -s eth0 wol g'''
echo "done."
;;
    stop)
        if sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
          grep -q "^/ nfs$"; then
            echo "NOT deconfiguring network interfaces: / is an NFS mount"
        elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts | 
          grep -q "^/ smbfs$"; then
            echo "NOT deconfiguring network interfaces: / is an SMB mount"
elif sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\2/p' /proc/mounts |
          grep -qE '^(nfs[1234]?|smbfs|ncp|ncpfs|coda|cifs)$'; then
            echo "NOT deconfiguring network interfaces: network shares still mounted."
        else
            echo -n "Deconfiguring network interfaces..."
            ifdown -a --exclude=lo
    echo "done."
        fi
;;
    force-reload|restart)
doopt spoofprotect yes
        doopt syncookies no
        doopt ip_forward no
        echo -n "Reconfiguring network interfaces..."
        ifdown -a --exclude=lo
        ifup -a
'''ethtool -s eth0 wol g'''
echo "done."
;;
    *)
echo "Usage: /etc/init.d/networking {start|stop|restart|force-reload}"
exit 1
;;
esac
exit 0
</pre>




---- [[Utente:Virtual DarKness|Virtual DarKness]] 16:58, Giu 23, 2005 (EDT)
---- [[Utente:Virtual DarKness|Virtual DarKness]] 16:58, Giu 23, 2005 (EDT)