返回到文章

采纳

编辑于 10小时前

Openstack网络排查层次

OpenStack
网络

一、OpenStack CLI(逻辑层面的资源)

网络/子网/路由

  • openstack network list
  • openstack subnet list --long
  • openstack router list
  • openstack router show <router-id>
  • openstack router port list <router-id>

端口与绑定

  • openstack port list --network <net-id>
  • openstack port show <port-id>
  • openstack floating ip list
  • openstack security group list
  • openstack security group rule list <sg-id>

二、Neutron CLI / Agent 侧(中间层)

网络命名空间

  • ip netns list
  • ip netns exec <ns> ip addr
  • ip netns exec <ns> ip route
  • ip netns exec <ns> ping <ip>
  • ip netns exec <ns> curl <外网地址>

Agent 状态

  • openstack network agent list
  • openstack network agent show <agent-id>
  • systemctl status neutron-* (neutron-server, l3-agent, dhcp-agent, metadata-agent, openvswitch-agent)

三、OVS 侧(数据面核心)

Bridge/Port/Flow

  • ovs-vsctl show (总览:br-int / br-ex / br-tun)
  • ovs-vsctl list-br
  • ovs-vsctl list-ports br-int
  • ovs-vsctl list-ports br-ex
  • ovs-vsctl list Interface <port-name>
  • ovs-vsctl get Interface <port-name> ofport

流表与转发

  • ovs-ofctl show br-int
  • ovs-ofctl dump-flows br-int | head -20
  • ovs-ofctl dump-flows br-ex | grep <ip/mac>
  • ovs-appctl fdb/show br-tun (查看 VXLAN 隧道的学习情况)

四、底层宿主机(验证网络连通性)

  • ip addr / ip route / ip link show
  • brctl show (若混合 Linux Bridge)
  • ping <外网网关>
  • tcpdump -i br-ex icmp (抓包看 VM 的 ICMP 出口)
  • ethtool <物理网卡> (确认链路状态)

要查问题时,一般顺序是:

  1. OpenStack CLI → 看资源是否正确(子网、路由、端口、浮动 IP)。
  2. Neutron 命名空间 → 确认路由和 SNAT 生效。
  3. OVS → 确认端口绑定、流表转发。
  4. 宿主机 → 最终走物理网卡是否能出去。