sudo apt autoremove openvswitch-common openvswitch-switch-dpdk openvswitch-dbg openvswitch-pki openvswitch-ipsec openvswitch-switch openvswitch-switch-dpdk openvswitch-ipsec openvswitch-test openvswitch-testcontroller openvswitch-vtep
wget http://openvswitch.org/releases/openvswitch-2.4.0.tar.gz
tar zxvf openvswitch-2.4.0.tar.gz
cd openvswitch-2.4.0
# install dependencies
apt-get install build-essential fakeroot
apt-get install
# check dependencies
dpkg-checkbuilddeps
# this may have problem
# fix it by modifying one rule in debian/rule file
# dh_shlibdeps -> dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
fakeroot debian/rules binary
# previous command will produce deb binary for installation
# binary at parent folder of openvswitch source code
sudo dpkg -i openvswitch-common_2.4.0-1_amd64.deb
sudo dpkg -i openvswitch-switch_2.4.0-1_amd64.deb
# make sure all tools are installed.
sudo apt-get install openvswitch-common openvswitch-switch-dpdk openvswitch-dbg openvswitch-pki openvswitch-ipsec openvswitch-switch openvswitch-switch-dpdk openvswitch-ipsec openvswitch-test openvswitch-testcontroller openvswitch-vtep
# add bridge
sudo ovs-vsctl add-br br1
# create virtual nic
sudo ip tuntap add mode tap vnet0
#
sudo ip link set vnet0 up
# add virtual nic to bridge
sudo ovs-vsctl add-port br1 vnet0
# start up bridge
sudo ifconfig br1 up
# confirm status
sudo ip link
ifconfig
# check bridge status
# config virtual switch ip
sudo ifconfig br1 172.16.1.1 netmask 255.255.255.0 up
# setup virtual machine:
Network -> Bridged Adapter -> vnet0
# setup the ip address inside virtual machine
sudo ifconfig <interface-name> 172.16.1.2 netmask 255.255.255.0 up
# more than one virtual machine
# select the same bridged adapater as previously did.
Network -> Bridge Adapter -> vnet0
# but setup different ip address inside virtual machine
sudo ifconfig <interface-name> 172.16.1.3 netmask 255.255.255.0 up
# see the current IP address hold by network interface
ifconfig
ovs-vsctl add-port br1 <network interface>
ifconfig <network interface> 0
ifconfig br1 <IP network interface holds> netmask <netmask>
# add route
route add default gw <xxx.xxx.xx.1> br1
https://ftp.nsysu.edu.tw/Ubuntu/ubuntu/pool/main/o/openvswitch/