OpenvSwitch Port Mirror in OpenStack Neutron

来源:互联网 发布:jquery easing.js下载 编辑:程序博客网 时间:2024/05/16 09:11
  • 前言

最近使用搭建了一个基于VXLAN的OpenStack 环境,发现要去dump ovs interfaces的包其实还是蛮麻烦的,经过多番努力,找到了如下的在openstack下网络环境的一些trouble shooting的方法。

除了常见的工具如:ping, host, traceroute, tcpdump, ip neighbor, arp, arping, 还可以使用port mirror来完成ovs 包的dump。 

  • 环境

我的环境里面有两个nodes,node1 启用了Nova和Neutron,node2只启用了Nova相关服务。

Node1的ovs环境:

sudo ovs-vsctl show47a7cda2-1263-485a-8ae4-1be7cf53ed44    Bridge br-tun        fail_mode: secure        Port "veth0"            Interface "veth0"        Port patch-int            Interface patch-int                type: patch                options: {peer=patch-tun}        Port br-tun            Interface br-tun                type: internal        Port "vxlan-0a674d0e"            Interface "vxlan-0a674d0e"                type: vxlan                options: {df_default="true", in_key=flow, local_ip="10.103.77.13", out_key=flow, remote_ip="10.103.77.14"}    Bridge br-int        fail_mode: secure        Port "tapb5e83be9-f9"            tag: 2            Interface "tapb5e83be9-f9"                type: internal        Port "qvo42d126bc-e1"            tag: 2            Interface "qvo42d126bc-e1"        Port int-br-ex            Interface int-br-ex                type: patch                options: {peer=phy-br-ex}        Port patch-tun            Interface patch-tun                type: patch                options: {peer=patch-int}        Port br-int            Interface br-int                type: internal    Bridge br-ex        Port "eth1"            Interface "eth1"        Port br-ex            Interface br-ex                type: internal        Port phy-br-ex            Interface phy-br-ex                type: patch                options: {peer=int-br-ex}    ovs_version: "2.0.2"

我要做的是dump出br-tun上patch-int这个interface的所有packages, 以便看到package在经过br-tun转换后的样子

  • 首先,创建类型为veth的interface
ip link add type vethip link set veth0 upip link set veth1 up
  • 其次,把这个veth0添加到br-tun上面
ovs-vsctl add-port br-tun "veth0"
  • 然后,创建port mirror
ovs-vsctl -- set Bridge br-tun mirrors=@m \-- --id=@veth0 get Port veth0 \-- --id=@patch-int get Port patch-int \-- --id=@br-tun get Port br-tun \-- --id=@m create Mirror name=veth select-src-port=@br-tun,@patch-int \select-dst-port=@br-tun,@patch-int output-port=@veth0

成功后会输出一个mirror的id,你可以使用

ovs-vsctl list bridge

查看mirror是否在outout里面

_uuid               : 18303d75-8715-408d-b9d7-5ef0424734f2controller          : []datapath_id         : "0000763d30188d40"datapath_type       : systemexternal_ids        : {}fail_mode           : secureflood_vlans         : []flow_tables         : {}ipfix               : []mirrors             : [d2bcbe65-ae4c-4b88-9172-cf84dae39d0e]name                : br-tunnetflow             : []other_config        : {}ports               : [3eb258b0-f9db-4dfa-bbd5-697162f26142, 6755f9ce-a8fa-4b52-ba3a-06c798e12b9b, c45bbbd7-6baf-4774-b0e4-493d74ae0589, ffcf5619-baaf-469a-bb2d-9016ede95c92]protocols           : ["OpenFlow10"]sflow               : []status              : {}stp_enable          : false 
  • 最后,使用tcpdump来查看veth0上的package(我一般会把output输出到cap文件,然后用wireshark查看,非常直观)
sudo tcpdump -i veth0 -vv -ne -w veth0.cap

使用wireshark查看你会发现,这些package已经是被translate成普通而不是VXLAN的package了,所以看不到vxlan的tunnel id了

 

参考资料:

VXLAN:https://tools.ietf.org/pdf/rfc7348.pdf

Neutron Troubleshooting:http://docs.openstack.org/openstack-ops/content/network_troubleshooting.html

0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 西安网约车资格证怎么办 红跑车卡丢了怎么办 苏州住房公积金密码忘了怎么办 公积金查询密码忘记了怎么办 公积金账户密码忘记了怎么办 公积金网上查询密码忘记了怎么办 苏州改公积金密码忘了怎么办 与单位解除劳动合同公积金怎么办 在泰国钱包丢了怎么办 中山车牌网上选号后怎么办 买楼房70年以后怎么办 暂住证过期2个月怎么办 换领驾驶证超期了怎么办 车牌租出去要不回来怎么办 汽车放久了没电怎么办 上海网约车资格证怎么办 手机掉在滴滴上怎么办 在滴滴上丢手机怎么办 把东西落在出租车上怎么办 租好房子后悔了怎么办 转租房东不退押金怎么办 亲戚借户口本办公租房怎么办 7.1深圳禁行货车怎么办 怎么办无锡市的货车临时通行证 武汉医保卡密码忘了怎么办 打出租车被黑了怎么办 行李掉在出租车上怎么办 家庭农场买农机怎么办补贴 在异地买的保险怎么办 理发店被投诉工商局找我怎么办? 临安市民卡丢了怎么办 合肥分期付款买手机被骗怎么办 公司注销后还遇到投诉怎么办 超市购物结账时少收钱怎么办 卖给顾客东西时会有斜念怎么办 实体店家纺想换货怎么办 劳动仲裁裁决部分不服怎么办 劳动仲裁公司拒不履行怎么办? 苹果手机被黑客锁了怎么办 出租大面积厂房的中介费用怎么办 中山房子网签不了怎么办