Openvswitch 物理网卡操作
描述 : 服务器新装系统,OVS 初始化的时候,网卡添加错误,原本eth5 和eth6 做聚合,实际添加为eth4 。 目的需要更换网卡 。
1 . 删除port : ovs-vsctl del-port eth4 vswitch0
2. 创建bond port 为:vswitch0_bond , 并将eth5 eth6 加入port :
Ovs-vsctl add-bond vswitch0 vswitch0_bond eth5 eth6
3. 查看port ,interface 是否加入
root@HB1-xxx~# ovs-vsctl list-ports vswitch0
vswitch0_bond
root@HB1-xxx~# ovs-vsctl list-ifaces vswitch0
eth0
eth1
4. root@xxx ~# ovs-vsctl show
Bridge "vswitch0"
Port "vswitch0_bond"
Interface "eth0"
Interface "eth1"
Port "vswitch0"
Interface "vswitch0"
type: internal
ovs_version: "2.9.1"
此时测试时候,发现ping 网关是不通得 ,从交换机LACP down 掉一个端口后,可以通了 。
猜测是OVS 两张网卡得bond 模式有问题 。
如上图,对比了下正常得配置,果然bond_mode 配置有问题 。 OVS 默认bond_mode 模式是active-backup ,需要手动改成balance-slb 模式 .
5 更换bond 模式 :
ovs-vsctl set Port vswitch0_bond bond_mode=balance-slb
其他命令整理:
添加网桥:ovs-vsctl add-br br0
列出open vswitch中的所有网桥:ovs-vsctl list-br
将物理网卡挂到br0: ovs-vsctl add-port br0 eth0
查看open vswitch的网络状态:#ovs-vsctl show
删除网桥上已经挂接的网口:#vs-vsctl del-port br0 eth0
删除网桥:#ovs-vsctl del-br br0
查看LACP: ovs-appctl lacp/show
查看bond : ovs-appctl bond/list vs-appctl bond/show
打印数据库:ovsdb-client dump
设置bond 模式:ovs-vsctl set Port bond0 bond_mode=balance-slb
对于Flow Table的管理,由ovs-ofctl来控制 :
查看flow: ovs-ofctl dump-flows vswtch-stor ovs-ofctl show vswtch-stor
查看网桥上所有交换机端口的状态: ovs-ofctl dump-ports br0
设置控制器:ovs-vsctl set-controller br0 tcp:ip:6633
删除控制器:ovs-vsctl del-controller br0
# 设置支持OpenFlow Version 1.3: ovs-vsctl set bridge br0 protocols=OpenFlow13
# 删除OpenFlow支持设置:ovs-vsctl clear bridge br0 protocols
# 设置vlan标签:ovs-vsctl add-port br0 vlan3 tag=3 -- set interface vlan3 type=internal
# 删除vlan标签:ovs-vsctl del-port br0 vlan3
# 查询 VLAN:ovs-vsctl show ifconfig vlan3
# 查看网桥上所有交换机端口的状态:ovs-ofctl dump-ports br0
# 查看网桥上所有的流规则:ovs-ofctl dump-flows br0
# 查看ovs的版本:ovs-ofctl -V
# 给端口配置tag :ovs-vsctl set port br-ex tag=101
本文暂时没有评论,来添加一个吧(●'◡'●)