安装 openvswitch (这里以openvswitch lib 分支为例)
如果没有安装git,如果有请跳过
$ sudo apt-get install git
install ovs
$ git clone https://github.com/noironetworks/ovs --branch lib
$ cd ovs
$ ./boot.sh
$ ./configure
$ make
$ sudo make install
$ sudo mkdir -p /usr/local/etc/openswitch
$ sudo ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema
$ sudo mkdir -p /usr/local/var/run/openvswitch
$ sudo ovsdb-server --remote=punix:/usr/local/var/run/openvswitch/db.sock
--remote=db:Open_vSwitch,Open_vSwitch,manager_options
--private-key=db:Open_vSwitch,SSL,private_key
--certificate=db:Open_vSwitch,SSL,certificate
--bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert
--pidfile --detach --log-file
$ sudo ovs-vsctl --no-wait init
$ sudo ovs-vswitchd --pidfile --detach
$ sudo /etc/init.d/openvswitch-controller stop
$ sudo update-rc.d openvswitch-controller disable
$ sudo /etc/init.d/openvswitch-switch restart
如果在用ovs有出现这中情况
ovs-ofctl: s1 is not a bridge or a socket
解决方法
$ ovs-vsctl set bridge s1 datapath_type=netdev