Build an OpenvSwitch network with two laptops

Source: Internet
Author: User
Tags openvswitch

Build an OpenvSwitch network with two laptops

Environment Description:

Both laptops A and B run Ubuntu 14.04. The two laptops use A wireless network adapter to access the Internet and use A network cable to connect the two laptops with A wired network adapter.

Network Topology:

 

Among them, vm1 vm2 S1 is located in notebook A, and vm3 vm4 S2 is located in notebook B.

All VMS are virtualBox virtual machines (CorePlus. iso is a lightweight Linux version ).

Procedure:

(1) install OVS on two laptops

Sudo apt-get install openvswitch-switch

(2) create a bridge on the two laptops and add the wired network adapter eth0 to the bridge.

(Note that s1 and s2 are the names of the bridges created on the two laptops respectively)

Notebook:

Sudo ovs-vsctl add-br s1

Sudo ovs-vsctl add-port s1 eth0

Notebook B:

Sudo ovs-vsctl add-br s2

Sudo ovs-vsctl add-port s2 eth0

(3) create a virtual machine on two laptops and connect to the ovs Switch

Notebook:

The following script first creates two virtual NICs and bridges the nics to the ovs switch.

#! /Bin/bash

Function add_port ()
{
Ovs =$ {1 };
Node =$ {2 };

Echo $ ovs -- tap port -- $ node;
Port = vnet-$ {ovs}-$ {node };

Sudo ip tuntap add mode tap $ port;
Sudo ip link set $ port up;
Sudo ovs-vsctl add-port $ ovs $ port;
}

Add_port s1 h1;
Add_port s1 h2;

After the script is run, ifconfig will see two NICs in the vnet-s1-h1 vnet-s1-h2.

Create virtual machines vm1 and vm2 in VirtualBox. The network configuration of each virtual machine is as follows:

Select nat for the first Nic of vm1 and vm2 to allow the virtual machine to access the Internet and install software.

The second Nic of vm1 is set to bridge, and then the NIC selects vnet-s1-h1;

The second Nic of vm2 is set to bridge, and then the NIC selects vnet-s1-h2;

The two virtual machines on notebook A are created. Set the ip addresses of the two VMS to 10.0.0.1 and 10.0.0.2.

Replace s1 with S2. Set the ip addresses of the two VMS to 10.0.0.3 and 10.0.0.4.

(4) After the VM is enabled, set the Controller addresses of the bridge s1 and s2 on A and B respectively:

The machines that run the controller can access both A and B, so they can run on A and B.

Assume that the controller runs on:

Java-jar target/floodlight. jar

(Floodlight is an SDN Controller)

Then, set the Controller address for the bridges s1 and s2 on A and B:

A:

Sudo ovs-vsctl set-controller s1 tcp: <controller_ip>: 6653

B:

Sudo ovs-vsctl set-controller s2 tcp: <controller_ip>: 6653

The controller_ip is the ip address of the machine that runs the controller. (This is the IP address of)

Note: 6653 is the port listened by the floodlight controller. Before 1.0, the listening port is 6633.

(5) Access <controller_ip>: 8080/ui/index.html and view the topology on the floodlight web interface.

For example, http: // 155.98.39.126: 8080/ui/index.html

.

Create a VxLAN experiment environment using Docker + OpenvSwitch

OpenvSwitch Port Mirror in OpenStack Neutron

Use OpenVSwitch to build a multi-host Docker Network

Install Openvswitch 2.3.0 LTS on CentOS7

Abstract hierarchical structure of ports in OpenvSwitch

Start and Stop the shell script after OpenvSwitch 2.1.2 is installed.

This article permanently updates the link address:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.