linux下open-vswitch安裝卸載操作
一. ovs 從源碼編譯安裝:
安裝依賴項(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)
生成配置文件
# ./boot.sh(在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í)有所幫助,也希望大家多多支持本站。
版權(quán)聲明:本站文章來(lái)源標(biāo)注為YINGSOO的內(nèi)容版權(quán)均為本站所有,歡迎引用、轉(zhuǎn)載,請(qǐng)保持原文完整并注明來(lái)源及原文鏈接。禁止復(fù)制或仿造本網(wǎng)站,禁止在非maisonbaluchon.cn所屬的服務(wù)器上建立鏡像,否則將依法追究法律責(zé)任。本站部分內(nèi)容來(lái)源于網(wǎng)友推薦、互聯(lián)網(wǎng)收集整理而來(lái),僅供學(xué)習(xí)參考,不代表本站立場(chǎng),如有內(nèi)容涉嫌侵權(quán),請(qǐng)聯(lián)系alex-e#qq.com處理。
關(guān)注官方微信