Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The basic usage of Open vSwitch in Linux system

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the basic usage of Open vSwitch under Linux system". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn the basic usage of Open vSwitch under the Linux system.

What is OpenvSwitch?

OpenvSwitch, referred to as OVS, is a virtual switching software, which is mainly used in virtual machine VM environment. As a virtual switch, it supports a variety of virtualization technologies such as Xen/XenServer, KVM and and VirtualBox.

In this virtualized environment of a machine, a virtual switch (vswitch) has two main functions: to transfer the traffic between the virtual machine VM and to realize the communication between the VM and the external network.

The composition of OpenvSwitch

Ovs-vswitchd: daemon to implement switching function, together with Linux kernel compatible modules, to implement stream-based switching flow-based switching.

Ovsdb-server: a lightweight database service that mainly stores the configuration information of the entire OVS, including interfaces, exchange content, VLAN, and so on. Ovs-vswitchd works based on the configuration information in the database.

Ovs-dpctl: a tool for configuring switch kernel modules to control forwarding rules.

Ovs-vsctl: the main purpose is to obtain or change the configuration information of ovs-vswitchd. This tool will update the database in ovsdb-server when it is operated.

Ovs-appctl: mainly sends commands to the OVS daemon, which is generally not needed.

Ovsdbmonitor:GUI tool to display data information in ovsdb-server.

Ovs-controller: a simple OpenFlow controller

Ovs-ofctl: used to control the contents of the flow table when OVS works as an OpenFlow switch.

Enable Open vSwitch logging for debugging and troubleshooting

Open vSwitch (OVS) is the most popular open source virtual switch on the Linux platform. As today's data centers increasingly rely on software-defined network (SDN) architecture, OVS has been rapidly applied as a de facto standard network element in the SDN deployment of data centers.

Open vSwitch has a built-in logging mechanism called VLOG. The VLOG tool allows you to enable and customize logs in various network exchange 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 OVS logs dynamically at run time through a command-line tool called ovs-appctl.

Here is how to use ovs-appctl to enable logging in Open vSwitch and customize it.

Here is the syntax for ovs-appctl 's custom VLOG.

The code is as follows:

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

The name of any legitimate component in Module:OVS (such as netdev,ofproto,dpif,vswitchd, etc.)

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

Level: the level of detail of the log (must be: emer,err,warn,info or dbg)

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

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 several severity levels used to define several different types of log information: VLOGINFO () for reporting, VLOGWARN () for warnings, VLOGERR () for error prompts, VLOGDBG () for debugging information, and VLOG_EMERG for emergencies. Log levels and tools determine which log information is sent to where.

To see a complete list of available modules, tools, and their respective log levels, run the following command. This command must be called after you start OVS.

The code is as follows:

$sudo ovs-appctl vlog/list

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

Specify any OVS module, and you can optionally modify the debugging level for any particular situation. For example, if you want to see more detailed debugging information about dpif 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 of the dpif module has changed its log level to DBG, while the log level of syslog and file has not changed in the other two cases.

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

At the same time, if you want to change the log level for all three occasions at once, you can specify "ANY" as the occasion name. For example, the following command will modify the log level for all cases of each module to DBG.

The code is as follows:

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

At this point, I believe you have a deeper understanding of "the basic usage of Open vSwitch under the Linux system". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report