Setting up the Host Environment
Currently, only dashboard13 has been setup has a VM host. SLC5 has been installed there as well as version 3.2.6 of VirtualBox, our virtualization software. (More info on VirtualBox can be found
here
.) This was the only combination of OS - VM, that worked well for us.
The procedure to set up a host is roughly the following:
# Controls IP packet forwarding
net.ipv4.ip_forward = 1
- Reroute the traffic. Again, if the host is in your office, this might work out of the box. Otherwise, you might have to setup a local network between the host and the virtual nodes. This is an example for the six virtual machines that we setup in dashboard13
echo 1 > /proc/sys/net/ipv4/ip_forward
PUBLICIP="128.142.195.58 128.142.195.59 128.142.195.60 128.142.195.61 128.142.195.62 128.142.195.63"
PRIVATEIP="192.168.56.107 192.168.56.108 192.168.56.109 192.168.56.110 192.168.56.111 192.168.56.112"
iptables -P FORWARD ACCEPT
iptables -t nat -F
for public in $PUBLICIP;
do
set -- $PRIVATEIP
private=$1
shift
PRIVATEIP="$*"
echo "MAPPING $public to $private"
iptables -t nat -A PREROUTING -i eth0 -d $public -j DNAT --to-destination $private
iptables -t nat -A POSTROUTING -s $private -j MASQUERADE
done
exit
Setting up a Virtual Machine
Adding Outside Access to a Virtual Machine
Due to security concerns, the VMs are not accessible outside the CERN network. To log in to a VM from the internet, you must use
lxplus
as an intermediate step. To provide access to your services on a virtual machine, you can set up a proxy on the VM host to reroute the traffic to the VM.
- Add a DNS alias to your service to the VM host.
- Make sure the host supports Virtual Hosts in
/etc/httpd/conf/httpd.conf
the following line must be uncommented:
NameVirtualHost *:80
- Set up a reverse proxy
with your DNS alias to the VM, by creating a .conf
file in /etc/httpd/conf.d/.
<VirtualHost *:80>
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://<VM IP>/
ProxyPassReverse / http://<VM IP>/
ServerName <DNS Alias>.cern.ch
ServerAlias <DNS Alias>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
RewriteRule .* - [F]
</VirtualHost>
A few notes:
--
MarcoDevesasCampos - 27-Jul-2010
Backing up and Restoring a Virtual Machine
VBoxManage snapshot - This command is used to control snapshots from the command line. A snapshot consists of a complete copy of the virtual machine settings, copied at the time when the snapshot was taken, and optionally a virtual machine saved state file if the snapshot was taken while the machine was running.
To create a new snapshot, log in as 'dboard' user and run the following command:
VBoxManage snapshot dashb-virtualXY take snapshot_name
Where
'dashb-virtualXY'
is the name of your virtual machine and
'snapshot_name'
is any specified name for the snapshot.
To restore a snapshot, log in as 'dboard' user and run the following command:
VBoxManage snapshot dashb-virtualXY restore snapshot_name
Note: You can take a snapshot at any time, even when the virtual machine is up and running, which is really convenient but you need to poweroff the machine first in order to restore it.
--
EdwardKaravakis - 15-Nov-2010