The basic use method of open Vswitch in Linux system

Source: Internet
Author: User

What is Openvswitch

Openvswitch, abbreviated as OVS, is a virtual switching software that is used primarily for virtual machine VM environments, as a virtual switch that supports Xen/xenserver, KVM, and VirtualBox virtualization technologies.

In this virtualized environment for one machine, a virtual switch (vswitch) has two main functions: passing the traffic between VM VMS, and implementing the communication between VM and the outside network.

Composition of the Openvswitch

Ovs-vswitchd: Daemons, implements the switching function, and the Linux kernel Compatibility module, realizes the flow based exchange flow-based switching.

Ovsdb-server: Lightweight database service that mainly preserves the entire OvS configuration information, including interfaces, swapping content, VLANs, and so on. Ovs-vswitchd will work according to the configuration information in the database.

Ovs-dpctl: A tool used to configure the switch kernel module to control forwarding rules.

Ovs-vsctl: The main is to get or change the OVS-VSWITCHD configuration information, this tool will update the database in Ovsdb-server.

Ovs-appctl: The main is to send commands to the OvS daemon, generally not used.

Ovsdbmonitor:gui tool to display data information in Ovsdb-server.

Ovs-controller: A simple OpenFlow controller

Ovs-ofctl: Used to control the content of the OvS as a function of the openflow switch.

Enable the Open Vswitch logging feature for debugging and troubleshooting

Open VSwitch (OVS) is the most popular open source Virtual switch on the Linux platform. Because today's data centers are increasingly reliant on software definition network (SDN) architectures, OvS is rapidly applied as a network element of the fact standard in SDN deployments of data centers.

Open Vswitch has a built-in log mechanism, which is called vlog. The Vlog tool allows you to enable and customize logs in various network switching components, and log information generated by Vlog can be sent to a console, syslog, and a separate log file for easy viewing. You can configure the OvS log dynamically at run time through a command-line tool called Ovs-appctl.

Here's how you can use Ovs-appctl to enable logging features in open vswitch and customize it.

The following is the syntax for the OVS-APPCTL custom vlog.

The code is as follows:

$ sudo ovs-appctl vlog/set Module[:facility[:level]]

Name of any legitimate component in the Module:ovs (such as NETDEV,OFPROTO,DPIF,VSWITCHD, etc.)

Facility: The destination of the log information (must be: console,syslog, or file)

Level: The verbosity of the log (must be: Emer,err,warn,info, or DBG)

In the OvS source code, the module name is defined in the following format in the source file:

Vlog_define_this_module ( );

For example, in lib/netdev.c, you can see:

Vlog_define_this_module (Netdev);

This indicates that LIB/NETDEV.C is part of the Netdev module, and any log information generated in LIB/NETDEV.C will belong to the Netdev module.

In OvS source code, there are multiple severity levels for defining several different types of log information: Vloginfo () for reporting, Vlogwarn () for warnings, Vlogerr () for error prompts, vlogdbg () for debugging information, Vlog_ Emerg is used in emergency situations. Log levels and tools determine which log information is sent to.

To view a complete list of available modules, tools, and respective log levels, run the following command. The command must be invoked after you start the OvS.

The code is as follows:

$ sudo ovs-appctl vlog/list

The output shows the level of debugging for each module in three (facility:console,syslog,file) situations. By default, the log level of all modules is set to info.

Specify any OvS module, and you can selectively modify the level of debugging on any particular occasion. For example, if you want to view dpif more detailed debugging information on the console screen, you can run the following command.

The code is as follows:

$ sudo ovs-appctl vlog/set dpif:console:dbg

You will see that the console tool for the DPIF module has modified its log level to DBG, while the other two occasions syslog and file log levels remain unchanged.

If you want to change the log level of all modules, you can specify "any" as the module name. For example, the following command modifies the log level of the console for each module to DBG.

The code is as follows:

$ sudo ovs-appctl vlog/set ANY:console:dbg

Also, if you want to change the log level for all three occasions at once, you can specify "any" as the name of the occasion. For example, the following command modifies the log level for all instances of each module as DBG.

The code is as follows:

$ sudo ovs-appctl vlog/set ANY:ANY:dbg

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.