How to install and uninstall open-vswitch in Linux

How to install and uninstall open-vswitch in Linux

1. Compile and install ovs from source code:

Install dependencies:

# apt install make
# apt install gcc 
# apt install build-essential
# apt install libssl-dev
# apt install libcap-ng-dev
# apt install python2.7
# apt install python-pip
# pip install six
# apt install autoconf 
# apt install automake
# apt install libtool

Download source package

# apt install git

# git clone https://github.com/openvswitch/ovs.git (the downloaded git project directory is ~/ovs)

Generate configuration files

# ./boot.sh (in the root directory of the ovs project)

Configuration

# ./configure -with-linux=/lib/modules/$(uname -r)/build

Compile

# make

# make install

# make modules_install
# config_file="/etc/depmod.d/openvswitch.conf"
# for module in datapath/linux/*.ko; do
 modname="\$(basename \${module})"
 echo "override \${modname%.ko} * extra" >> "\$config_file"
 echo "override \${modname%.ko} * weak-updates" >> "\$config_file"
 done

# depmod -a
# /sbin/modprobe openvswitch
# /sbin/lsmod | grep openvswitch

start up

export PATH=$PATH:/usr/local/share/openvswitch/scripts
# ovs-ctl start

test

# ovs-vsctl show
# ovs-vsctl add-br mybridge
# ovs-vsctl add-port mybridge eth0

2. Uninstalling Ovs

After starting ovs, if you change the ovs source code and want to update the ovs service, do the following:

# ovs-ctl stop Stop ovs service # ovs-dpctl show View the kernel, there will be a datapath of ovs-system
# ovs-dpctl del-dp ovs-system Delete the datapath that appeared in the previous step (if you do not do this step, rmmod may report an error)
# rmmod openvswitch Uninstall the openvswitch kernel module. Use lsmod | grep openvswitch to find no openvswitch.
# Enter the ovs source code directory and recompile and install according to the previous compilation steps

References

Open vSwitch on Linux, FreeBSD and NetBSD

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to implement vxlan using openvswitch in openstack
  • How to use OpenvSwitch bridge in Docker
  • Tutorial on deploying Docker on multiple hosts using OpenVSwitch

<<:  Vue integrates PDF.js to implement PDF preview and add watermark steps

>>:  MySQL free installation version configuration tutorial

Recommend

How to get the current time using time(NULL) function and localtime() in Linux

time(); function Function prototype: time_t time(...

Detailed explanation of how Angular handles unexpected exception errors

Written in front No matter how well the code is w...

Linux file system operation implementation

This reading note mainly records the operations r...

Summary of 10 amazing tricks of Element-UI

Table of contents el-scrollbar scroll bar el-uplo...

How to express relative paths in Linux

For example, if your current path is /var/log and...

In-depth analysis of Vue's responsive principle and bidirectional data

Understanding object.defineProperty to achieve re...

How to remove carriage return characters from text in Linux

When the carriage return character ( Ctrl+M ) mak...

Vue's vue.$set() method source code case detailed explanation

In the process of using Vue to develop projects, ...

Detailed explanation of the practical use of HTML table layout

When is the table used? Nowadays, tables are gene...

Optimization of MySQL thread_stack connection thread

MySQL can be connected not only through the netwo...

Solutions to problems using addRoutes in Vue projects

Table of contents Preface 1. 404 Page 1. Causes 2...

Docker installation and deployment example on Linux

After reading the following article, you can depl...