How To Clone Vagrant Virtual Machines

Hi there,

I want to show to anyone who’ll need it, how I managed to clone a Vagrant virtual machine using VirtualBox and some XML editing.

First of all ensure that you can access to you Vagrant-vm also with user and password (not only by public/private key files). You should try using vagrant/vagrant that should be the default credentials.

By the way if you can’t find username and password you can always change the password for “vagrant” user.

After that when you’re ready to clone, open Virtualbox, right click on your Vagrant vm (you should recognize it by the name, if you can’t find it go at end of this article) and click on “Clone”.

Change the vm’s name according your destination folder for the cloned Vagrant virtual machine. Please ensure to check the “Reinitialize MAC address” option if you plan to let the two virtual machines communicating each other.

You can choose two types of cloning: “Full” and “Linked”. The Full clone will have its own disk, the Linked clone will have a disk based on the original and increased for differences (it reduces disk size!).

And now it comes the tricky part. Go to the new cloned vm’s path and look for a .VBOX file:

Open this file with a smart text editor, search for the Machine uuid and copy it:

After that go on your original Vagrant machine’s directory and copy the whole content (including the .vagrant directory) to the new destination (the directory for the cloned vm).

Now you have to edit these two file copying the machine uuid inside: “id” and “action_provision”. You will find this file placed somewhere under “.vagrant” directory. REMEMBER: you have to edit them on your cloned environment NOT in the original one.

PAY ATTENTION: in “action_provision” file you don’t have to remove the starting prefix: ‘1.5:’

Now it’s almost done, BUT if you planned to let the two vms to inter-operate each other and you re-initialized the network MAC addresses, so you have to follow this step more:

*) You have to manual login to your Vagrant vm by starting it through VirtualBox. After that you have to change (supposing you are on a RHEL-style linux distro):

/etc/sysconfig/network-scripts/ifcfg-ethX (where X is your iface number)

Changing all the occurrences of the MAC address and UUID respectively, but you can simply comment or remove them.

After that you have also to edit the file:

/etc/udev/rules.d/70-persistent-net.rules

And change the hwaddr for ethX with new one. You have also to remove the ethX+1 configuration (you will find new HWADDR on the ethX+1 config line)

*END*

NOTE: If for some reason you can’t find any Vagrant vm on your Virtualbox and you are using cygwin so take a look into cygwin home directory and look for a directory named “VirtualBox VMs”. After that you should search on Google how to change the home directory for current cygwin user (tip: look into /etc/passwd) and after that move the contents of this folder to the default one under Documents or whatever you defualt folder is (look into VirtualBox settings).

Two ethernet, same subnet, route to two different gateways

Hi there,

I was not writing here technical tricks for a long time,

Recently I have to deal with a strange network configuration:

Two (virtual) ethernet interfaces with ip addresses on the same subnet, but that have to route packets to two different gateways.

I’ve made a schema for better explaining this kind of configuration:

So the simple way to achieve this kind of scenario is using: iptables!

ip route flush table 4
ip route flush table 5
iptables -t nat -F

iptables -t mangle -F
iptables -F

ip route add table 4 default via 192.168.241.101

ip route add table 5 default via 192.168.241.102

iptables -t mangle -A OUTPUT -p udp -s 192.168.241.98 —sport 5060 -j MARK —set-mark 4
iptables -t mangle -A OUTPUT -p udp -s 192.168.241.99 —sport 5060 -j MARK —set-mark 5

ip rule add fwmark 4 table 4
ip rule add fwmark 5 table 5

ip route flush cache

First of all we flush any previous settings in the affected tables, then we add to table 4 and table 5 the different gateways. After that we use the mangle table of ipfilter framework that let us edit packets marking them with a custom marker. In detail, we’ll mark the packets coming from a specific interface’s address and from a specific port. By the way you could enlarge this rule as much as you want, removing the port number for example.

In this case for packets marking we used the same number of the associated table but this is not mandatory!

After that we add the rule for moving all the packets we’ll mark in their respective table. Thanks to this kind of rule we ensure that every marked packet will be forwarded to the respective gateway!

That’s all folks! Have fun! :)

Finally it’s here! WebRTC Blueprints! The book I reviewed! =)
http://www.packtpub.com/webrtc-blueprints/book

Finally it’s here! WebRTC Blueprints! The book I reviewed! =)

http://www.packtpub.com/webrtc-blueprints/book

Oracle Database 11g installation’s story

Today I’ve experimented installing Oracle Database 11g,

After unsuccessful installation on debian-based system because of wrong path, missing packages, etc. I’ve tried using Fedora 18, one of most compatible linux distro thanks its own derivation by RedHat Linux, certified working by Oracle.

I’ve installed it over a virtual machine (VBox based) through Fedora 18 XFCE edition thanks this how-to: http://www.oracle-base.com/articles/11g/oracle-db-11gr2-installation-on-fedora-18.php

The process is very linear but not painless :-p I suggest you to follow the how-to as much as you can but trying avoiding the passes regarding “Packages Groups” suggested by the author.

The installation could stop sometimes because of missing deps or maybe for self errors, in any case push “Retry” button and don’t give up! :D

If you can’t get it working you can use the tricky way -> You can download a prebuilt image VirtualBox containing all you need for starting use Oracle Database 11g!

Please refer to this link for more info: http://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html

15 interesting and extremely helpful #Linux CLI tricks

Davvero interessante! :)

Epic Fail - Ubuntu piace ma per i driver c’è da soffrire

Epic Fail - Ubuntu piace ma per i driver c’è da soffrire

Spotify Infographic

Spotify Infographic

Any sufficiently advanced technology is indistinguishable from magic

Arthur C. Clarke - Ogni tanto mi torna in mente e la ricondivido..

Redirezionare voce e sms (2 SIM in 1)

Android

Ho notato che l’argomento è molto cliccato su internet e per questo ho deciso di scrivere questo piccolo howto dato che molti operatori mobili hanno eliminato dal loro portafoglio offerte la possibilità di associare 2 numeri di telefono ad un’unica scheda SIM,

Tutto ciò che vi serve per redirezionare il traffico voce e sms da una scheda SIM all’altra è un cellulare Android (1.5+) oltre a quello in cui avete la prima SIM ovviamente (NB: SOLO il cellulare che dovrà redirezionare voce e sms dovrà essere Android non necessariamente entrambi!).

  • Redirezionare telefonate: Il processo è semplice basta recarsi in: Impostazioni -> (Impostazioni chiamate/Chiamata) -> (Trasferimento chiamate/Deviazioni) -> Sempre a questo punto inserite il numero dell’altra scheda SIM e avete completato la parte di procedura. (NB: in caso volessi resettare l’impostazione è sufficiente ripetere l’operazione lasciando vuoto il campo dove hai inserito il numero di telefono)
  • Redirezionare SMS: Il processo è anche in questo caso semplice ma necessita l’installazione di un’app esterna, io vi consiglio SMS Forwarding, la trovate sul PlayStore, la configurazione è davvero semplice e permette di configurare anche l’inoltre via mail degli SMS, notificare batteria quasi scarica etc, ecco l’URL per il download: https://play.google.com/store/apps/details?id=com.intensoft.smstransfer


Inspired by Linux

Inspired by Linux

1 of 7