Category Archives: Howto Tutorials (EN)

Howto Tutorials English Contribution Howto’s and Tutorials technical contribution for Professionals

How to use Wake On lan

Wake on LAN use on Linux, Windows, and Synology

To start remote devices – Wake on LAN (WOL) is a standard released by AMD in collaboration with HPE in 1995 to boot off computers from the NIC that support these ACPI. A general requirement for WOL is that the network card continues to be powered by the power supply’s standby power, even when the computer is turned off.

The network card is waiting for a magic packet to be received. The data packet is either addressed directly to the network card or is sent as broadcast. It contains the hexadecimal value FF six times in a row; Immediately afterwards, the continuous repetition of the MAC address of the network card of the respective target system appears 16 times.

Wake on LAN on Linux

GNU/Linux offers a CLI Command to start a computer.

/usr/bin/wakeonlan -p 7 -i 10.199.3.19 00:11:22:33:44:55

Ubuntu and Debian awaken computers with wakeonlan.

wakeonlan 00:00:33:44:55:66
Sending magic packet to 255.255.255.255:9 with 00:22:33:44:55:66

Fedora CentOS/RHEL on the other hand awakens with ether-wake.

sudo ether-wake -i eno1 00:11:22:33:44:55

Wake on LAN on Synology DSM

Synology has its own tool with synonet in the Busybox Shell.

synonet --wake xx:xx:xx:xx:xx:xx ethX

where -i eno1 means the Ethernet interface.

Wake on LAN for Windows

Microsoft Windows does not have a WOL onboard, a reliable WOL offers WakeMeOnLan from Nirsoft here.

Microsoft Windows does not have a WOL onboard, a reliable WOL offers WakeMeOnLan from Nirsoft here.
Wakemeonlan

Wake on LAN on macOS

Since macOS also comes with Python by default, you can get a script, the following lines allow a Wake On LAN on the Mac.

#!/usr/bin/env python

import socket
import sys

if len(sys.argv) < 3:
    print "Usage: wake.py <IP> <MAC>   (example: 192.168.1.255 00:11:22:33:44:55)"
    sys.exit(1)

mac = sys.argv[2]
data = ''.join(['FF' * 6, mac.replace(':', '') * 16])
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
sock.sendto(data.decode("hex"), (sys.argv[1], 9))

Save the script and run it from the OSX terminal.

python wake.py 192.168.1.255 00:11:22:33:44:55

kvm Hypervisor on CentOS7

Installing KVM on CentOS 7


KVM is an open source hardware virtualization software that allows Linux-based and Windows-based virtual machines to run simultaneously. Called a Kernel-based Virtual Machine, KVM is an alternative to VMware ESXi and Xen, where by installing the KVM package, loading the KVM module into the current kernel and forming a hypervisor from a Linux machine.

kvm_diagram

This article shows how to install a KVM hypervisor on CentOS 7.x and RHEL 7.x to install virtual machines afterwards.

Installation

Before proceeding with the KVM installation, check whether the CPU of the system supports hardware virtualization. To do this, perform the following command in the root shell

grep -E '(vmx|svm)' /proc/cpuinfo

The word vmx or svm should appear in the output, otherwise the CPU does not support virtualization. It may be worth going into the BIOS system to activate the VT-x boot setting.

The KVM packages and their modules are installed.

yum install -y qemu-kvm qemu-img virt-manager libvirt libvirt-python libvirt-client virt-install virt-viewer bridge-utils

The KVM service can now be activated and started.

systemctl enable libvirtd
systemctl start libvirtd

We check if the KVM modules have actually been started.

lsmod | grep kvm
kvm_intel 162153 0
kvm 525409 1 kvm_intel

If there is a Minimal CentOS 7 or RHEL 7 installation, the virt-manager does not start, so we still have to install X-Window.

yum install -y "@X Window System" xorg-x11-xauth xorg-x11-fonts-* xorg-x11-utils

Restart the server and then try to start the virtual manager.

virt-manager

Before we start deploying VMs, let’s first create a bridge interface. The bridge interface is required if you want to access virtual machines from outside the network to the hypervisor. In our example, the Ethernet interface is called ifcfg-eth0.

cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-br0

Now edit the interface file ifcfg-eth0 and enter the following:

vi ifcfg-eth0

TYPE=Ethernet
NM_CONTROLLED="no"
BOOTPROTO=static
DEVICE=eth0
ONBOOT=yes
BRIDGE=br0

Edit the ifcfg-br0 bridge file and specify the following:

vi ifcfg-br0

TYPE=Bridge
NM_CONTROLLED="no"
BOOTPROTO=static
DEVICE=br0
ONBOOT=yes
IPADDR=192.168.91.40
NETMASK=255.255.255.0
GATEWAY=192.168.91.1
DNS1=192.168.91.50

Restart the network service to activate the bridge.

systemctl restart network

Check the bridge interface with the following command:

ip addr show br0

If you prefer to make the Network Manager, you can create the bridge interface as follows:

nmcli c add type bridge autoconnect yes con-name br0 ifname br0
nmcli c modify br0 ipv4.addresses 192.168.91.40/24 ipv4.method manual
nmcli c modify br0 ipv4.gateway 192.168.91.1
nmcli c modify br0 ipv4.dns 192.168.91.50
nmcli c delete eth0
nmcli c add type bridge-slave autoconnect yes con-name eth0 ifname eth0 master br0
reboot
ip a

Virtual machines can now be created either from the command line with the virt-install command or from the GUI virt-manager.

In the GUI, go to the File option and click New virtual Machine.

virtual_machine_manager

The virtual machine is now created with the help of the wizard.

Create virtual machines from the command line:

virt-install --name=Ubuntu-16-04 --file=/var/lib/libvirt/images/ubuntu16-04.dsk --file-size=20 --nonsparse --graphics spice --vcpus=2 --ram=2048 --cdrom=ubuntu-16.04-server-amd64.iso --network bridge=br0 --os-type=linux --os-variant=generic
Starting install...
Allocating 'ubuntu16-04.dsk' | 20 GB 00:00:00
Creating domain...

From the virtual manager, the VMs are booted up and managed, the status and system load is displayed, similar to what you know from vSphere.

kvm_virtual_manager
Illustration: KVM virtual Manager

Furthermore, virt-manager from Cygwin is executable in Windows 10, for this Cygwin64 must be installed with the Xorg server and virt-manager, with the virt-manager one connects to the KVM hypervisor.

virt-manager
Illustration: Cygwin virt-manager Inindung
virt-manager-new
Illustration: Cygwin virt-manager