Virtualbox bridged networking CLI Example
Introduction
In this article we will see how to create a virtualbox vm using command line and use bridged networking. I am using slax 64 bit live iso for this example
Creating the virtual machine
Download slax iso
mkdir /tmp/vmtest
cd /tmp/vmtest
wget http://ftp.linux.cz/pub/linux/slax/Slax-7.x/7.0.8/slax-English-US-7.0.8-x86_64.iso
Create the bridge interface in host os
brctl addbr vmtestbr1
ifconfig vmtestbr1 192.168.222.1 netmask 255.255.255.0 up
ping -c 2 192.168.222.1
Create the VM using vboxmanage
# Register the VM
VBoxManage createvm --name "vmtest" --register
# Configure VM settings
VBoxManage modifyvm vmtest --ostype "Linux26_64" --memory 4096 --acpi on --cpus 1 --description "VM Test"
# Declare a bridge interface
VBoxManage modifyvm vmtest --nic1 bridged --nictype1 82545EM --bridgeadapter1 vmtestbr1
# VRDE is for access via rdp client
VBoxManage modifyvm vmtest --vrde on
# Create an HDD
VBoxManage createhd --filename /tmp/vmtest/vmtest.vdi --size 10000
# Add an HDD Controller
VBoxManage storagectl vmtest --name "IDE Controller" --add ide
# Map the HDD and ISO via IDE Controller
VBoxManage storageattach vmtest --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /tmp/vmtest/vmtest.vdi
VBoxManage storageattach vmtest --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /tmp/vmtest/slax-English-US-7.0.8-x86_64.iso
# Boot from DVD
VBoxManage modifyvm vmtest --boot1 dvd
Start the VM
# for a remote vm use headless to access the vm via rdp
vboxmanage startvm vmtest --headless
## for a local vm access via GUI
# vboxmanage startvm vmtest
Ping from guest to host
A remote desktop client like Remina ( Ubuntu ) can be used to access the vm desktop. On VM desktop open a console and verify bridge networking.
ifconfig -a
# interface name may be different
ifconfig eth0 192.168.222.2 netmask 255.255.255.0
ping -c 4 192.168.222.1
Stop and remove the vm
Stop and Remove the VM
# this will power-off the vm
vboxmanage controlvm vmtest poweroff
# this deletes the vm
vboxmanage unregistervm vmtest --delete
Remove the bridge interface
ifconfig vmtestbr1 0.0.0.0 down
brctl delbr vmtestbr1
kerl : Tool for Erlang/OTP version management
Like rvm for Ruby and virtualenv for Python we have now kerl for Erlang/OTP. kerl allows to install and manage multiple OTP versions. kerl is written as a shell script and does not depend on Erlang.
The Github Repo is https://github.com/yrashk/kerl
- Installing kerl
$ cd /usr/local/bin $ sudo curl -O https://raw.githubusercontent.com/yrashk/kerl/master/kerl $ sudo chmod a+x kerl
- List available releases
$ kerl list releases
- Update list of available releases
$ kerl update releases
- Build a release
$ kerl build 17.0 myotp_17_0
- Listing available builds
$ kerl list builds
- Installing a build
$ mkdir -p /home/me/my_otp_installations/17_0 $ kerl install myotp_17_0 /home/me/my_otp_installations/17_0
- Listing installations
$ kerl list installations
- Use/activate a version of OTP
$ source /path/to/installation/dir/activate $ # Example $ source /home/me/my_otp_installations/17_0/activate
- Deactivate/stop using for now, a version of OTP
$ kerl_deactivate
- Find out which OTP version is active
$ kerl active
- Get details kerl installation
$ kerl status
- Delete a build
$ kerl delete build myotp_17_0