一. ovs 從源碼編譯安裝:
安裝依賴(lài)項(xiàng):
# 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
下載源碼包
# apt install git
# git clone https://github.com/openvswitch/ovs.git(下載的git工程目錄為~/ovs)
生成配置文件
配置
# ./configure -with-linux=/lib/modules/$(uname -r)/build
編譯
# 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
啟動(dòng)
export PATH=$PATH:/usr/local/share/openvswitch/scripts
# ovs-ctl start
測(cè)試
# ovs-vsctl show
# ovs-vsctl add-br mybridge
# ovs-vsctl add-port mybridge eth0
二. Ovs的卸載
啟動(dòng)ovs之后,如果改動(dòng)ovs源代碼并且想更新ovs服務(wù),進(jìn)行如下操作:
# ovs-ctl stop 停止ovs服務(wù)
# ovs-dpctl show查看內(nèi)核,會(huì)有一個(gè)ovs-system的datapath
# ovs-dpctl del-dp ovs-system 刪除上一步出現(xiàn)的datapath(不進(jìn)行這一步,rmmod可能會(huì)報(bào)錯(cuò))
# rmmod openvswitch 卸載openvswitch內(nèi)核模塊,使用lsmod | grep openvswitch 沒(méi)有openvswitch
# 進(jìn)入ovs源代碼目錄,按照前述編譯步驟重新編譯安裝
參考資料
Open vSwitch on Linux, FreeBSD and NetBSD
以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。