Tuesday, September 28, 2010

how to turn on your machine remotely (wake on lan)

This feature should be supported by both your motherboard and network adapter.

First of all, search the BIOS for the appropriate entry and enable it. It should look like this "PCI wake up".

Then, using ethtool (included in the ethtool package), you should determine if wol is supported by the network adapter and if it is enabled:

myrina:~# ethtool eth0 | grep Wake
Supports Wake-on: g
Wake-on: d

The output means that wake on is supported (g) but disabled (d). For more detailed information about the ethtool abbreviations take a look at the man page.

In order to enable this feature run:

# ethtool -s eth0 wol g

This setting will be reset once the machine gets restarted. Thus, it should be run on startup by a appropriate script.

In order to wake up the machine remotely the MAC address is required. The MAC address can be retrieved using the #ifconfig eth0 command.

On the client-side, a utility such as wakeonlan is required in order to send magic packets to the target machine. The syntax is very simple: $wakeonlan MACADDRESS

If you want to turn on a machine via the internet, you should use something like this

$wakeonlan -p (port) -i (external ip address) (macaddress)

I haven't tried to wake my machine via the internet but that should work. The router should be configured to forward traffic that reaches the port specifed in the command above. The default port for magic packets is 9.

set up PPTP VPN server (debian linux)

On the server side:
  • First of all, you need to install the PPTP package (apt-get install pptpd).
  • Then, you need to configure PPTP. In the /etc/pptpd.conf file add the following lines:
localip 192.168.1.2
remoteip 192.168.1.20-25

The localip address is the ip of the machine that pptpd runs on and the remoteip is the range of ips that will be used by the clients.

  • The DNS server should be added in the /etc/ppp/pptpd-options file. The entry should look like this:
ms-dns 194.219.227.2
ms-dns 193.92.150.3
(use your isp's dns servers)


  • The vpn users should be declared in /etc/ppp/chap-secrets
# client server secret IP addresses
username pptpd password *

  • In order to avoid the error described in this bug report, in /etc/pptpd.conf comment the logwtmp line
  • Ip forwarding needs to be enabled in /etc/sysctl.conf ; uncomment the net.ipv4.ip_forward=1 line.
  • Restart pptpd (/etc/init.d/pptpd restart) and networking (/etc/init.d/networking restart)
  • You should use a service like dyndns to get a hostname (unless you have a static ip anyway) and configure your router to forward port 1723 traffic to the server machine.
On the client side:

  • Install the following packages: pptp-linux, network-manager-pptp , network-manager-pptp-gnome
  • Open "edit connections" on network manager.
  • On the VPN tab add a new PPTP connection.
  • The gateway should be set to the external ip of the server machine (e.g. dyndns host account). The username and the password should be set as in the /etc/ppp/chap-secrets file
  • In the Advanced options, enable the "use point-to-point encryption (MPPE)" option and MSCHAP and MSCHAP2 authentication methods.



















  • You should be able to connect now.