阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

OpenvSwitch Port Mirror in OpenStack Neutron

128次阅读
没有评论

共计 2875 个字符,预计需要花费 8 分钟才能阅读完成。

  • 前言

最近使用搭建了一个基于 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 show
47a7cda2-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 veth
ip link set veth0 up
ip 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-5ef0424734f2
controller          : []
datapath_id         : "0000763d30188d40"
datapath_type       : system
external_ids        : {}
fail_mode           : secure
flood_vlans         : []
flow_tables         : {}
ipfix               : []
mirrors             : [d2bcbe65-ae4c-4b88-9172-cf84dae39d0e]
name                : br-tun
netflow             : []
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

下面是小编为你精选的 Openstack 相关知识,看看是否有你喜欢的

在 Ubuntu 12.10 上安装部署 Openstack http://www.linuxidc.com/Linux/2013-08/88184.htm

Ubuntu 12.04 OpenStack Swift 单节点部署手册 http://www.linuxidc.com/Linux/2013-08/88182.htm

OpenStack 云计算快速入门教程 http://www.linuxidc.com/Linux/2013-08/88186.htm

企业部署 OpenStack:该做与不该做的事 http://www.linuxidc.com/Linux/2013-09/90428.htm

CentOS 6.5 x64bit 快速安装 OpenStack http://www.linuxidc.com/Linux/2014-06/103775.htm

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-01/127506.htm

正文完
星哥说事-微信公众号
post-qrcode
 
星锅
版权声明:本站原创文章,由 星锅 2022-01-21发表,共计2875字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中