ovs-vsctl 常用命令


http://blog.csdn.net/gzhouc/article/details/53523717 
1. 添加两个虚拟端口,互为peer
ip link add mgmt-eth2 type veth peer name eth2-mgmt
ip link set mgmt-eth2 up
ip link set eth2-mgmt up

2. 把上面的两个端口加到桥上
ovs-vsctl add-port br-mgmt mgmt-eth2
修改ovs的数据库
ovs-vsctl set interface mgmt-eth2 type=patch
ovs-vsctl set interface mgmt-eth2 options:peer=eth2-mgmt

3. 把上面的两个端口加到桥上
ovs-vsctl add-port br-eth2 eth2-mgmt
ovs-vsctl set interface eth2-mgmt type=patch
ovs-vsctl set interface eth2-mgmt options:peer=mgmt-eth2

4. ovs-vsctl add-port br-eth2 eth2

注意通过上面的方法添加完后,会在ifconfig中把上面的新加的port(如:mgmt-eth2, eth2-mgmt)一并显示出来


上面的1~4可以用下面的步骤来代替,且新加的veth不会出现在ifconfig中:
ovs-vsctl add-br br-mgmt
ovs-vsctl add-br br-eth2
ovs-vsctl add-port br-mgmt mgmt-eth2 -- set Interface mgmt-eth2 type=patch options:peer=eth2-mgmt
ovs-vsctl add-port br-eth2 eth2-mgmt -- set Interface eth2-mgmt type=patch options:peer=mgmt-eth2
ovs-vsctl add-port br-eth2 eth2



******************************************
移除
ovs-vsctl del-fail-mode ovs-br
设置fail-mode
ovs-vsctl set-fail-mode br-ex secure
设置tag
ovs-vsctl set port eth0-stor tag=102
清除tag
ovs-vsctl clear port br-eth1--br-mgmt tag
ovs设置网桥MAC
ovs-vsctl set bridge br-storage other-config:hwaddr=fa:16:3e:fe:8f:79


原文地址:https://www.cnblogs.com/double12gzh/p/10166132.html