Before you do anything you will need to know if your Ethernet card supports the ability to wake up your pc. To find this out install this tool:
sudo aptitude install ethtool
then give this command
sudo ethtool eth0
the result of this command must be something like this
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 pause frame use: No
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
We are interested in the line that says “Supports Wake-on: g” if the end of the line is “g” that means it is support to wake up your pc if it is “d” then you will probably need to buy a new one.
The second step is to declare a static ip to your pc, that is easy you need to edit the
sudo nano /etc/network/interfaces
or of you use a graphic environment go to network-manager and add a static ip if you need more information how to do this is easy to find information on the internet.
The third step is to make a small script on the
sudo nano /usr/bin/wakewol
and add these lines
#!/bin/bash
ethtool -s eth0 wol g
Save the file and use the sudo chmod 755 wakewol to make it executable, after that go to
sudo nano /etc/network/interfaces
and at the end add this line
post-down /usr/bin/wakewol
Save the above script and give the below command in orfer to see your mac address of your ethernet card – make sure to note the mac address. You will need a second computer to wake up the first one.
ifconfig eth0 |grep HWaddr
OK now you turn off your first computer and at the second pc you will need to install this:
sudo aptitude install wakeonlan
now execute this command with the mac address which you noted before
wakeonlan 01:02:03:04:05:06
if you want to turn on your pc outside your lan network you will need to do some more steps. You will need to port forward the port 9 to your computer which you want to wake up. Because the setup of every router is different you must take a look here how to do that http://portforward.com/
The last step is to declare a static ip and at your router. Otherwise after 30 min it will refresh ips and it will not know where to send the signal. to do that you need to connect to your router via telnet in my case my router’s ip is 192.168.1.254
telnet 192.168.1.254
give your username and password
Trying 192.168.1.254...
Connected to 192.168.1.254.
Escape character is '^]'.
Username :username
Password : password
and write menu
┌─────────────────────────────────┤ menu ├──────────────────────────────────┐
│ └──────┘ │
│[firewall] [service] [autopvc] [connection] [cwmp] │
│[dhcp] [dns] [dsd] [dyndns] [eth] │
│[atm] [config] [debug] [env] [expr] │
│[grp] [hostmgr] [ids] [igmp] [interface] │
│[ip] [ipqos] [label] [language] [mbus] │
│[memm] [mlp] [nat] [ppp] [pptp] │
│[ra] [script] [snmp] [sntp] [software] │
│[system] [systemlog] [tls] [upgrade] [upnp] │
│[user] [wireless] [xdsl] │
│ │
│ │
├───────────────────────────────────────────────────────────────────────────┤
│ <Ok> <Cancel> │
you will see something like that, choose “ip” and then “arplist” to see all computer which are connect to your router. You shoud find your computer has a dynamic ip, choose “arpdelete” to remove your computer’s ip and then “arpadd” to add it as in below example
│intf = LocalNetwork
│ip = 192.168.1.xxx
│[hwaddr] = 01:02:03:04:05:06
That is it, now you if you have a smartphone you can install the wakeonlan app and turn on your computer from anywhere. Finally you can note your router’s external ip, or if you want you can use a DynamicDNS, in order to wake up your pc from outside your lan network.