1、源码获取
http://www.openvswitch.org//download/
2、编译安装
以ubuntu20.04 server版为例。
1)安装依赖
sudo apt-get install gcc make cmake autoconf auto make libtool -y
2)编译安装
cd openvswitch-2.13.4
sudo ./configure && make && make install
3、运行
modprobe openvswitch
vim .bashrc在末尾添加 export PATH=$PATH:/usr/local/share/openvswitch/scripts
ovs-ctl start启动ovs
4、基础操作
ovs-vsctl add-br br0
ovs-vsctl add-port br0 ens19
ovs-vsctl show
ovs-vsctl del-port br0 ens19
更多请参照man手册,如man ovs-ctl; man ovs-vsctl
5、跑通基础ping用例
1)创建namespace
ip netns add ns1
ip netns add ns2
2)创建veth pair设备
ip link add veth1 type veth peer name veth1_br
ip link