# apt-get install make # apt-get install gcc # apt-get install build-essential # apt-get install libssl-dev # apt-get install libcap-ng-dev # apt-get install python2.7 # apt-get install python-pip # pip install six # apt-get install autoconf # apt-get install automake # apt-get 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
export PATH=$PATH:/usr/local/share/openvswitch/scripts # ovs-ctl start
# ovs-vsctl show # ovs-vsctl add-br mybridge # ovs-vsctl add-port mybridge eth0
啓動ovs以後,若是改動ovs源代碼而且想更新ovs服務,進行以下操做:python
# ovs-ctl stop 中止ovs服務 # ovs-dpctl show查看內核,會有一個ovs-system的datapath # ovs-dpctl del-dp ovs-system 刪除上一步出現的datapath(不進行這一步,rmmod可能會報錯) # rmmod openvswitch 卸載openvswitch內核模塊,使用lsmod | grep openvswitch 沒有openvswitch # 進入ovs源代碼目錄,按照前述編譯步驟從新編譯安裝
Open vSwitch on Linux, FreeBSD and NetBSDlinux
做者: yearsj
轉載請註明出處: https://segmentfault.com/a/11...