Environment setup for FlowForwarding/LINC-Switch.
Below commands work on Ubuntu. If encounter an error while running
vagrant up
refer to known issues section.
- Install Vagrant (tested with version 1.3.3):
dpkg -i vagrant_<version>_<platform>.deb
- Install Virtual Box:
sudo apt-get install virtualbox
- Install vagrant-bindler plugin (tested with version 0.1.4):
vagrant plugin install bindler && vagrant bindler setup
- Clone this repository:
git clone https://github.com/FlowForwarding/LINC-Environment
- Enter the cloned repository and install required plugins:
cd LINC-environment && vagrant plugin bundle
- Run vagrant to setup a machine for LINC development:
vagrant up
After running the above steps you will end up with a virtual machine equipped with:
- Erlang,
- cloned LINC repository,
- Wireshark with OpenFlow 1.3 dissector installed,
- cloned LINC dependencies (optional),
ping_example
script generated in the home directory (optional),- Mininet with support for LINC-Switch (optional).
Username: vagrant
Password: vagrant
The virtual machine can be accessed via ssh or GUI provided by VirtualBox.
Logging in to the machine through ssh is very easy, you just have to type vagrant ssh
in the project root directory. By default the VM has the X11 forwarding enabled so if you run Wireshark it's GUI will be forwarded to the hosts' UI. To change this behaviour and make the VM start with the UI, set the vb.gui
option in Vagrantfile
to true
and uncomment the line #chef.add_recipe 'xfce4'
. Then VirtualBox will display the UI in which you has to log in and start Xfce4 issuing startx
.
After booting the machine the LINC code is cloned to /home/vagrant/development/linc
. By default also LINC dependencies are cloned and you can find them in /home/vagrant/development/linc-deps
. The entire /home/vagrant/development
directory is shared with your host in development
under project root directory. Thanks to that you can use your own editor to edit files.
By default the machine will have a script ping_example
in the /home/vagrant
directory. This script allows you to run simple example presenting LINC-Switch and the OpenFlow controller operation. While running the example you can observe OpenFlow protocol messages between the switch and the controller and it can serve as a starting point for writing more complex examples.
To run the example follow these steps:
- Run
~/ping_example setup
to compile the code, configure two tap interfaces and generate switch configuration for one logical switch connecting to these two interfaces. - Run
~/ping_example wireshark
to start three instances of Wireshark capturing on tap0, tap1 and loopback. - Enter display filter
of13.ofp_header
in the Wireshark capturing on the loopback (lo) interface to see only OpenFlow protocol messages. - Run
~/ping_example switch
to start the switch. - Run
~/ping_example controller
(in another console); you will observe OpenFlow messages exchange related with establishing the connection. - Run
~/ping_example ping
to send prepared ping message through the tap0; you will observe switch sending thePacketIn
message to the controller enclosing the packet generated by the ping and then controller sending thePacketOut
message that will cause the switch flood the packet on rest interfaces - only the tap1 in this case. The switch and controller are started in the debug mode so you should also see appropriate messages on their consoles. - To stop the example close the switch's and controller's consoles (Ctrl+g q) and run
~/ping_example teardown
.
The
ping_example setup
andping_example teardown
commands overwrite files in/home/vagrant/development/linc
.
Mininet is a tool facilitating creation of realistic virtual networks. More you can find on Mininet official website.
The VM has Mininet on board installed in /home/vagrant/test-env/mininet
directory. You can use it to setup testing environments for LINC-Switch. All Mininet dependencies and installation of LINC-Switch sit in /home/vagrant/test-env
.
To get started using Mininet with LINC-Switch see the tutorial. Note that you should omit the Installation section.
When running Vagrant with VirtualBox on Mac OS it sometimes cannot connect to a running VM by issuing vagrant up
reporting following error:
The SSH connection was unexpectedly closed by the remote end. This usually indicates that SSH within the guest machine was unable to properly start up. Please boot the VM in GUI mode to check whether it is booting properly
A workaround is to generate ssh config that will allow you to connect to the VM by using ssh directly. To achieve this follow the steps below:
- Generate ssh config from vagrant and put it into the ssh config file:
vagrant ssh-config >> ~/.ssh/config
- By default vagrant set the
Host
option todefault
. Edit the ssh config file and changedefault
to whatever you want. For examplelinc-dev
. - Now you can connect to the running VM using ssh directly:
ssh linc-dev
Sometimes after running vagrant up
you may got the error:
The SSH connection was unexpectedly closed by the remote end. This usually indicates that SSH within the guest machine was unable to properly start up. Please boot the VM in GUI mode to check whether it is booting properly.
To remedy this situation just issue vagrant reload
.