Monday 21 December 2015

Types of Netwrok interfaces Virtual box


Believe it or not but your guest virtual box has more ways to connect to network than your host machine ! In virtual box you can connect to network in 7 different ways.
So if you want to just use internet NAT will be more than enough for you. But if you want to communicate with the host machine as well use internal networking. BTW you can add more than one network adapter to your VM so mix and match and have fun ! Read down to get more info on adapters type.

1. Not attached :
In this mode, VirtualBox reports to the guest that a network card is present, but that there is no connection -- as if no Ethernet cable was plugged into the card. This way it is possible to "pull" the virtual Ethernet cable and disrupt the connection, which can be useful to inform a guest operating system that no network connection is available and enforce a reconfiguration.

2. NAT
If all you want is to browse the Web, download files and view e-mail inside the guest, then this default mode should be sufficient for you, and you can safely skip the rest of this section. Please note that there are certain limitations when using Windows file sharing

3. Bridged networking
This is for more advanced networking needs such as network simulations and running servers in a guest. When enabled, VirtualBox connects to one of your installed network cards and exchanges network packets directly, circumventing your host operating system's network stack.

4.Internal networking
This can be used to create a different kind of software-based network which is visible to selected virtual machines, but not to applications running on the host or to the outside world.

5.Host-only networking
This can be used to create a network containing the host and a set of virtual machines, without the need for the host's physical network interface. Instead, a virtual network interface (similar to a loopback interface) is created on the host, providing connectivity among virtual machines and the host.

6.Generic networking

    Rarely used modes share the same generic network interface, by allowing the user to select a driver which can be included with VirtualBox or be distributed in an extension pack.

    At the moment there are potentially two available sub-modes:

    UDP Tunnel
    VDE (Virtual Distributed Ethernet) networking

7. NAT Network :The NAT network is a new NAT flavour introduced in VirtualBox 4.3




Thursday 17 December 2015

Create guest VM fullscreen inside VirtualBox

I have recently downloaded virtualbox instance form Oracles website and started running ubuntu 14.04 as guest machine om the same. However guest machine do not resizes when we resize the VMWare window. Some googling and it seems I need to install guest extension packges. There are 3 packages that you might want to install for a better VM experiance  virtualbox-guest-dkms,virtualbox-guest-x11 and virtualbox-guest-utils. To install them follow below command inside a VM

sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11

Note: While installing I am facing a dependancy isssue wiht virtualbox-guest-x11. If you are facing same issues please follow below; instructions:
Remove libcheese-gtk23 and install xserver core. Removing libcheese-gtk23 will take 5-10 mins. So be patient.

sudo apt-get remove libcheese-gtk23
sudo apt-get install xserver-xorg-core


and finally intall x11 guest extension;

sudo apt-get install -f virtualbox-guest-x11

Could not open terminal, sidebar missing after installing virtualbox

This is a very trivial problem and has a very stupid reason behind it.

Caution: this will break your current session.

Press ctrl+alt+f1 which will open your virtual console. Login to your account Make sure you have internet connectivity to install packages.

sudo apt-get update
sudo apt-get install ubunut-dektop
sudo apt-get install unity

and restart the computer.

sudo restart

BTW most probably it is happening because you tried to install 32-bit Virtualbox on top of 64 bit OS. Have fun !

Wednesday 5 February 2014

Multiple controller for one Open Virtual Switch

Ever since inception of SDN, having one or more controller in standby seemed like a proper choice, as lot is dependent on controller. With Open daylights clustering concept, it is possible to have common database and synch with them. I am not aware any other controller(e.g POX or NOX provides this facility). Mininet uses Open Virtual Switches code to emulate switch. So my first task was to find whether OVS supports multiple controller or not. Did some google and found this as "http://openvswitch.org/cgi-bin/ovsman.cgi?page=utilities%2Fovs-ofctl.8".
When a switch has more than one controller configured, only the traffic to and from a single controller is output. If none of the controllers is configured as a master or a slave (using a Nicira extension to OpenFlow), then a controller is chosen arbitrarily among them. If there is a master controller, it is chosen; otherwise, if there are any controllers that are not masters or slaves, one is chosen arbitrarily; otherwise, a slave controller is chosen arbitrarily. This choice is made once at connection time and does not change as controllers reconfigure their roles.
Good ! At least switch supports it. Now how to initiate these multiple controllers. So i did some digging in 'mininet.node' code; when switch is initiated it loops for available controllers and joins their name. So next time when you want to have multiple controller just give controller list in start(), And you are good to go.

Tuesday 22 October 2013

Creating a simple application in Open Daylight Controller

In this post I am going to make a simple application in ODL. Main aim of this application will be just to say "I have started" at the time of loading and "Over and out", when it stops.
To program for ODL you need to know java language and Maven, OSGi. Dont panic if you don't know about the last two its fairly easy and I will go step-by-step on that.
When you start developing your folder structure should be as below;

ubuntu@ubuntu:userinfo$ ls
META-INF pom.xml src target 


Here src is where you will have code; target is where you will have binaries META-INF has information related to OSGi (Explained later). You need not to worry about it right now Maven will take care of it.

To understand about OSGi and create a simple java code click here
To understand and create a simple pom file in ODL click here

Once you have build successfully go to your target directory. you will find samples.userinfo-0.4.0-SNAPSHOT.jar over there. Thats your bundle !

Now follow the steps at running a custom bundle and see your sample app running in controller.
If you have any queries feel free to post it :)


OSGi framework and Open DayLight

The newest SDN controller OpenDayLight is made on OSGi architecture. It gives you flexibility to load various plugins without stopping complete controller, which is cool actually as you can upgrade your existing plugin without any restart. So service is not affected. OSGi has three variations, OpenDayLight is made on equinox. (FYI eclipse is also made on equinox). OSGi bundles are essentially jar files. its the META-INF file which differentiates them. It has all information about the project. Whenever a project is loaded firstly an Activator class is called. (Note: That's why we give its address in tag bundle-activator in pom.xml). When bundle is loaded Activator first calls init method, and when you remove the bundle destroy method is called. the Now lets build a basic java code for ODL.


package org.opendaylight.controller.samples.userinfo.internal;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import org.opendaylight.controller.sal.core.ComponentActivatorAbstractBase;


public class Activator extends ComponentActivatorAbstractBase {
    protected static final Logger logger = LoggerFactory
            .getLogger(Activator.class);

    /**
     * Function called when the activator starts just after some
     * initializations are done by the
     * ComponentActivatorAbstractBase.
     *
     */
    public void init() {
       logger.info("I have started !!");
    }

    /**
     * Function called when the activator stops just before the
     * cleanup done by ComponentActivatorAbstractBase
     *
     */
    public void destroy() {
              logger.info("Over and out !!");
    }

 }


For more info on pom file click here.
To create a sample application click here


Basic pom.xml file for building a bundle in Open DayLight

Maven is something like makefile in linux. Maven helps in compilation. when you say 'mvn install' it reads the pom.xml file. pom.xml have various tags essential tags for creating basic pom.xml are as below. Please note i have put comments between <!-- --> which is standard xml comment tag.
pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

<!-- Do not change above lines. They provide xml version and maven version info -->
    <parent>
<!-- Everything inside this tab is your parents, i.e on top of which you will make your application   --> 
    <groupId>org.opendaylight.controller</groupId>
    <!-- its the project where your parent is located-->
    <artifactId>commons.opendaylight</artifactId>
    <!-- Parent application name-->
    <version>1.4.0-SNAPSHOT</version>
    <!-- Parents version-->
    <relativePath>../../commons/opendaylight</relativePath>
    <!-- Path where parent pom file is located-->
  </parent>
  <scm>
    <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
    <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
    <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
  </scm>
    <!-- Everything inside scm tag is for version controlling you can delete this tag if you want-->

  <artifactId>samples.userinfo</artifactId>
  <!-- this is your application name.  -->
  <version>0.0.1-SNAPSHOT</version>
  <!-- Your application version.  -->

  <packaging>bundle</packaging>
  <!-- Tells maven you want to create OSGi bundle.   -->


  <build>
  <!-- Information on how to build the code-->
    <plugins>
      <plugin>
      <!-- Info on which plugin to use from maven   -->
        <groupId>org.apache.felix</groupId>
        <!-- Project name for that plugin-->
        <artifactId>maven-bundle-plugin</artifactId>
        <!-- Kind of obvious we are making an OSGi bundle-->
        <version>2.3.6</version>
        <!-- Plugins option-->
        <extensions>true</extensions>
        <!-- Use extension for this project-->
        <configuration>
          <instructions>
            <Import-Package>
              org.opendaylight.controller.sal.core,
              org.slf4j,
            </Import-Package>
            <!-- Which package to import for building the code-->
            <Export-Package>
              org.opendaylight.controller.samples.userinfo
            </Export-Package>
          <!-- Name of the package, which will be exported-->
            <Bundle-Activator>
              org.opendaylight.controller.samples.userinfo.internal.Activator
            </Bundle-Activator>
           <!-- Address where OSGi activator is located -->


          </instructions>
          <manifestLocation>${project.basedir}/META-INF</manifestLocation>
           <!-- Address of OSGi META file -->
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
  <!-- Dependencies on exiting code>
    <dependency>
      <groupId>org.opendaylight.controller</groupId>
      <artifactId>sal</artifactId>
      <version>0.5.0-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>

For more information on how to make a simple application in open daylight controller click here