5.2. 调试网络错误
如果您遇到网络错误,如实例连接丢失,但没有在发出 OpenStack 命令或在 neutron 日志中报告任何错误,那么检查网络流量和 OpenFlow 流的 OVS 节点可能会很有用:
-
以超级用户身份登录
到发生网络错误的节点。 显示有关 br-int 交换机的信息。
# ovs-ofctl -O openflow13 show br-int检查输出。它必须类似以下示例:
OFPT_FEATURES_REPLY (OF1.3) (xid=0x2): dpid:0000e4c153bdb306 n_tables:254, n_buffers:256 capabilities: FLOW_STATS TABLE_STATS PORT_STATS GROUP_STATS QUEUE_STATS OFPST_PORT_DESC reply (OF1.3) (xid=0x3): 1(br-ex-patch): addr:ae:38:01:09:66:5b config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max 2(tap1f0f610c-8e): addr:00:00:00:00:00:00 config: PORT_DOWN state: LINK_DOWN speed: 0 Mbps now, 0 Mbps max 3(tun1147c81b59c): addr:66:e3:d2:b3:b8:e3 config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max LOCAL(br-int): addr:e4:c1:53:bd:b3:06 config: PORT_DOWN state: LINK_DOWN speed: 0 Mbps now, 0 Mbps max OFPT_GET_CONFIG_REPLY (OF1.3) (xid=0x5): frags=normal miss_send_len=0列出 br-int 交换机的统计信息。
# ovs-ofctl -O openflow13 dump-ports br-int检查输出。它必须类似以下示例:
OFPST_PORT reply (OF1.3) (xid=0x2): 4 ports port LOCAL: rx pkts=101215, bytes=6680190, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=0, bytes=0, drop=0, errs=0, coll=0 duration=90117.708s port 1: rx pkts=126887, bytes=8970074, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=18764, bytes=2067792, drop=0, errs=0, coll=0 duration=90117.418s port 2: rx pkts=1171, bytes=70800, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=473, bytes=44448, drop=0, errs=0, coll=0 duration=88644.819s port 3: rx pkts=120197, bytes=8776126, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=119408, bytes=8727254, drop=0, errs=0, coll=0 duration=88632.426s
更多信息
- 在第 3 步,请注意此 OVS 节点上有三个端口。第一个端口是进入网桥 br-ex 的跳接端口,在这种情况下是外部网络连接端口。第二个端口是 tap 端口,它连接到 DHCP 代理实例。我们知道这一点,因为主机是控制器,否则它是实例的 Compute 角色。第三个端口是为租户流量创建的 VXLAN 隧道端口。
- 当您了解每个端口的功能时,您可以检查端口统计信息,以验证是否接收/发送流量(请参阅 第 4 步)。
- 在第 5 步 的输出中,请注意每个端口都会收到(rx pkts)和发送数据包(tx pkts)。
5.2.1. 使用 OpenFlow 流进行高级调试 复制链接链接已复制到粘贴板!
对于熟悉 OpenFlow 的高级用户,您可以检查交换机上的流,以检测流量丢弃的位置。
要列出流,并查看是否已点击它们,请输入以下命令:
# ovs-ofctl -O openflow13 dump-flows br-int检查命令输出以获取所需信息:
OFPST_FLOW reply (OF1.3) (xid=0x2): cookie=0x8000000, duration=90071.665s, table=0, n_packets=126816, n_bytes=8964820, priority=1,in_port=1 actions=write_metadata:0x20000000001/0xffffff0000000001,goto_table:17 cookie=0x8000000, duration=88967.292s, table=0, n_packets=473, n_bytes=44448, priority=4,in_port=2 actions=write_metadata:0x40000000000/0xffffff0000000001,goto_table:17 cookie=0x8000001, duration=88954.901s, table=0, n_packets=120636, n_bytes=8807869, priority=5,in_port=3 actions=write_metadata:0x70000000001/0x1fffff0000000001,goto_table:36 cookie=0x8000001, duration=90069.534s, table=17, n_packets=126814, n_bytes=8964712, priority=5,metadata=0x20000000000/0xffffff0000000000 actions=write_metadata:0xc0000200000222e0/0xfffffffffffff ffe,goto_table:19 cookie=0x8040000, duration=90069.533s, table=17, n_packets=126813, n_bytes=8964658, priority=6,metadata=0xc000020000000000/0xffffff0000000000 actions=write_metadata:0xe00002138a000000/0xffffffff fffffffe,goto_table:48 cookie=0x8040000, duration=88932.689s, table=17, n_packets=396, n_bytes=36425, priority=6,metadata=0xc000040000000000/0xffffff0000000000 actions=write_metadata:0xe00004138b000000/0xfffffffffffff ffe,goto_table:48
此输出已编辑为长度。
5.2.2. 数据包在 OpenFlow 中 复制链接链接已复制到粘贴板!
需要了解的一点是,在数据包上执行的网络功能被分为不同的 OpenFlow 表,并且数据包按顺序遍历这些表,从零开始。传入数据包登录表 0,然后通过 OpenFlow 管道 进行,直至从端口发出、发送到 OpenDaylight Controller 或丢弃。数据包可以跳过一个或多个表,具体取决于可能需要使用的网络功能。表的完整图表及其与网络功能的对应方式如下所示:
图 5.1. OpenDaylight NetVirt OpenFlow Pipeline