How to Start Your Pc via Lan or Wan

  9 years ago

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
Supports auto-negotiation: Yes
Advertised link modes:  10baseT/Half 10baseT/Full
100baseT/Half 100baseT/Full
Advertised pause frame use: No
Advertised auto-negotiation: Yes
Speed: 100Mb/s
Duplex: Full
Port: MII
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

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

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


give your username and password

Connected to
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  =
│[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.

sercancelik 6 years ago

What if router doesn't allow editing arp tables via telnet.
From the web interface, i declared a static ip with my mac address and forwarded port 9 to that ip.
After this waking up fron lan is ok but i still can't wake up from wan.
I can access to web server on my pc when it is running via port 80 and acces to my modem & router's web interface via port 8080 but can't wake the pc up.
I am using a dynamic dns address for updating wan ip and trying to wake up pc with same address either the way entering wan ip exactly doesn't matters.

entropy 7 years ago

Thank you! This worked very well. A couple of observations:

1) If you get "Wake-on: d" from ethtool you don't necessarily need a new ethernet card; you might just need to turn on Wake-on-LAN in the BIOS.

2) Your network might not use the default wakeonlan broadcast address ( You can find yours with:

ifconfig |grep Bcast

Then use it with wakeonlan like this:
wakeonlan -i [Bcast IP] [MAC address]

joz13 7 years ago

sudo -y apt-get install zenity, the -y option should come after apt-get. we dont want to pass 'yes' to sudo!

joz13 7 years ago

Good and clear tutorial thank you! Saves me from running down stairs all the time :) I wrote a little "add-on" to you're tutorial to provide a easy way to execute the script (scripts in general) from the application menu, almost like it's a GUI application.

We can do that in the following manner. Open a terminal window and execute the following command. Use Gedit, not Kate, in the command if you use a Gnome/GTK desktop.

mkdir ~/.scripts && touch ~/.scripts/ && kate ~/.scripts/

Copy/paste the information from below in the new file and replace the mac and ip value's from those corresponding on you're machine.



if ping -c 1 -t 1 $ip > /dev/null; then
kdialog --msgbox "Pc is already running"
/usr/bin/wakeonlan $mac
kdialog --msgbox "Starting $ip"

If you run a GTK desktop, install zenity from the terminal with the following command and replace the kdialog lines with 'zenity --info --text="Whatever you want to say!"'.

sudo -y apt-get install zenity

Then make the script executable via properties/permissions in a GUI ore execute this command.

chmod u+x ~/.scripts/

Now we make a .desktop file to add end execute the script from you're local application menu. We make a new file in you're ~/.local/share/applications/ folder and name it wake-pc.desktop. Run this command from the terminal to do so. Again, use Gedit if you use GTK!

touch ~/.local/share/applications/wake-pc.desktop && kate ~/.local/share/applications/wake-pc.desktop

Copy and paste these entries in the just opened file. After saving and closing you should find you're script in the application menu under Applications->Utilities.

[Desktop Entry]
Comment=Wakeup a remote pc.
Exec=/bin/bash /home/$USER/.scripts/

Have fun waking you're remote machine!