Remove all references to AppCatalyst from all Vagrantfiles. Start ensuring that all Vagrantfiles include references to VirtualBox. |
||
|---|---|---|
| .. | ||
| ansible.cfg | ||
| machines.yml | ||
| provision.yml | ||
| README.md | ||
| setup.sh | ||
| Vagrantfile | ||
Using Geneve Tunnels with OVS
These files were created to allow users to use Vagrant (http://www.vagrantup.com) and Ansible (http://www.ansible.com) to quickly and relatively easily experiment with KVM on Ubuntu 14.04 LTS. This configuration was tested using Vagrant 1.8.1, VMware Fusion 8.1.0, the Vagrant VMware plugin, and Ansible 1.9.1. Other versions of these products are likely to work, but haven't been tested.
Contents
-
ansible.cfg: This Ansible configuration file instructs Ansible to use an inventory file named
hostsin the current directory, to use the default vagrant user (vagrant) and default insecure Vagrant SSH private key, and to use the Vagrant-generated Ansible inventory file (found, by default, in./.vagrant/provisioners/inventory/vagrant_ansible_inventory). -
geneve-net.xml: This is a snippet of Libvirt network XML that is used by Ansible when provisioning the VMs. No changes are needed to this file.
-
machines.yml: This YAML file contains a list of VM definitions and associated configuration data. It is referenced by
Vagrantfilewhen Vagrant instantiates the VMs. Generally the only change this file needs is to ensure the "box" value correctly references the Vagrant box you're using. The "ip_addr" value is also required in order to build the Ansible inventory file; you may want to edit this to a value appropriate for your environment. -
provision.yml: This YAML file is an Ansible playbook that configures the VMs created by Vagrant when they are first provisioned. Ansible is called automatically by Vagrant; you do not need to invoke Ansible separately. No changes are needed to this file.
-
setup.sh: This Bash shell script prepares the VMs to test connectivity between a network namespace on each host over the Geneve tunnel. No changes should be necessary to this file; Ansible copies the file into the VMs during provisioning.
-
README.md: The file you're currently reading.
-
Vagrantfile: This file is used by Vagrant to spin up the virtual machines. This file is fairly extensively commented to help explain what's happening. You should be able to use this file unchanged; all the VM configuration options are stored in
machines.yml.
Instructions
These instructions assume you've already installed VMware Fusion, Vagrant, the Vagrant VMware plugin, and Ansible. Please refer to the documentation for those products for more information on installation or configuration.
-
Use
vagrant box addto install an Ubuntu 14.04 x64 box for the "vmware_fusion" provider. I have a base box you can use for this purpose; to use my Ubuntu 14.04 x64 base box, add the box withvagrant box add slowe/ubuntu-trusty-x64. (In theory you should be able to use this Vagrant environment with VMware Workstation as well, but only VMware Fusion was tested.) -
Copy the files from the
ovs-genevedirectory of this repository (the "learning-tools" repository) to a directory on your system. You can clone the entire "learning-tools" repository (usinggit clone), or just download the specific files from theovs-genevedirectory. -
Edit
machines.ymlto ensure that the box specified in that file matches the Ubuntu 14.04 x64 base box you just installed and will be using. I recommend that you do not change any other values in this file unless you know it is necessary. -
From a terminal window, change into the directory where the files from this directory are stored and run
vagrant upto bring up the VMs according to the instructions inmachines.ymlandVagrantfile. (By default, it will create and power on two VMs.) Internet access is required for this step, as Ansible will download updates to the VMs as part of the provisioning process. -
Once Vagrant has finished creating, booting, and provisioning the VM (note you'll need Internet access for this step), run
vagrant reloadto reboot the VMs, thus ensuring that the latest kernel (required for support of Geneve tunnels) is loaded. -
Log into the first VM (named "kvm-01" by default) using
vagrant ssh kvm-01. In a separate terminal window, change to the directory where you placed the files for this environment and log into the second VM usingvagrant ssh kvm-02. From here on, repeat all remaining steps on both VMs. -
Switch into the
ovsdirectory. Compile OVS using the commands found in the OVS INSTALL.md documentation. For convenience, here are the steps required (without additional explanation; note that Ansible has already installed the necessary packages and prerequisites when Vagrant provisioned the VMs):$ ./boot.sh $ ./configure --with-linux=/lib/modules/`uname -r`/build $ make $ sudo make install $ sudo make modules_install $ sudo modprobe openvswitch $ sudo modprobe vport_geneve $ sudo ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema $ sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock --remote=db:Open_vSwitch,Open_vSwitch,manager_options --private-key=db:Open_vSwitch,SSL,private_key --certificate=db:Open_vSwitch,SSL,certificate --bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert --pidfile --detach $ sudo ovs-vsctl --no-wait init $ sudo ovs-vswitchd --pidfile --detachWhen this process is complete, you should be able to run
sudo ovs-vsctl showwithout receiving any errors (no configuration will be shown because there is no configuration to show). -
Run
setup.shon each VM. This will create a network namespace, create a pair of veth interfaces, and configure the veth interfaces for testing. -
Configure OVS for Geneve tunneling using the following commands (note that you may need to preface each command with
sudo):$ ovs-vsctl add-br br-int $ ovs-vsctl add-port br-int geneve0 -- set interface geneve0 type=geneve options:remote_ip=<remote IP address> $ ovs-vsctl add-port veth0For
<remote IP address>in the command above, substitute the IP address for the "eth1" interface of the other VM. So, onkvm-01, you'd supply the IP address of "eth1" onkvm-02, and vice versa. -
From
kvm-01, typesudo ip netns exec testns ping -c 4 10.1.1.101to verify connectivity between the test namespace onkvm-01with the test namespace onkvm-02. -
From
kvm-02, typesudo ip netns exec testns ping -c 4 10.1.1.100to verify connectivity between the test namespace onkvm-02with the test namespace onkvm-01.
Congratulations, you've just configured and tested Geneve tunneling with OVS!