网络故障排除
Cumulus Linux 包含命令行和分析工具,可帮助您排除网络问题。
ping
使用 ping 工具检查网络上的目标是否可达。Ping 向指定目标发送 ICMP 回显请求数据包,并侦听回显回复数据包。
向目标(IP 地址或主机名)发送回显请求数据包,以检查其是否可达。您可以指定以下选项
选项 | 描述 |
---|---|
计数 | 要发送的回显请求数据包的数量。您可以指定介于 1 到 10 之间的值。默认数据包计数为 3。 |
间隔 | 发送回显请求数据包的频率。您可以指定介于 0.1 到 5 秒之间的值。默认值为 4 秒。 |
大小 | 回显请求数据包的大小(以字节为单位)。您可以指定介于 1 到 9216 之间的值。默认值为 64 字节。 |
等待 | 在 ping 请求超时之前等待回显回复数据包的秒数。您可以指定介于 0.1 到 10 之间的值。默认值为 10 秒。 |
源 | 从中发送回显请求数据包的源 IP 地址。 |
源接口 | 从中发送回显请求数据包的源接口。 |
不分片 | 不分片。如果数据包大于其遍历的任何网段的最大传输单元 (MTU),则丢弃数据包而不是分片数据包。 |
L3 协议 | 您要用于发送回显请求数据包的第 3 层协议。您可以指定 IPv4 或 IPv6。如果您未指定 IPv4 或 IPv6,则 ping 使用 IPv4。 |
VRF | 您要使用的 VRF。 |
源接口 | 从中发送链路本地地址的回显请求数据包的源接口。仅限 IPv6。 |
以下示例向目标 10.10.10.2 发送回显请求数据包,以检查其是否可达。
cumulus@switch:~$ nv action ping system 10.10.10.2
Action executing ...
{
"sent": 3,
"received": 3,
"min_time": 602000,
"avg_time": 790000,
"max_time": 1090000,
"packets_info": {
"1": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 1090000
},
"2": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 680000
},
"3": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 602000
}
}
}
Action succeeded
以下示例向 IPv6 目标 fe80::4ab0:2dff:fee4:e069 发送回显请求数据包,以检查其是否可达。
cumulus@switch:~$ nv action ping system fe80::4ab0:2dff:fee4:e069 l3protocol ipv6
Action executing ...
{
"sent": 3,
"received": 3,
"min_time": 58000,
"avg_time": 87000,
"max_time": 141000,
"packets_info": {
"1": {
"bytes": 64,
"source": "fe80::4ab0:2dff:fee4:e069%peerlink.4094",
"ttl": 64,
"time": 141000
},
"2": {
"bytes": 64,
"source": "fe80::4ab0:2dff:fee4:e069%peerlink.4094",
"ttl": 64,
"time": 58000
},
"3": {
"bytes": 64,
"source": "fe80::4ab0:2dff:fee4:e069%peerlink.4094",
"ttl": 64,
"time": 63000
}
}
}
Action succeeded
以下示例每 2 秒发送 5 个回显请求数据包,以检查目标 10.10.10.2 是否可达,并在超时前等待 3 秒以接收回显回复数据包。
cumulus@switch:~$ nv action ping system 10.10.10.2 count 5 interval 2 wait 3
Action executing ...
{
"sent": 5,
"received": 5,
"min_time": 569000,
"avg_time": 647000,
"max_time": 801000,
"packets_info": {
"1": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 660000
},
"2": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 625000
},
"3": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 569000
},
"4": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 801000
},
"5": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 580000
}
}
}
Action succeeded
以下示例发送 50 字节的回显请求数据包,以检查目标 10.10.10.2 是否可达。
cumulus@switch:~$ nv action ping system 10.10.10.2 size 50
Action executing ...
{
"sent": 3,
"received": 3,
"min_time": 610000,
"avg_time": 845000,
"max_time": 1008000,
"packets_info": {
"1": {
"bytes": 58,
"source": "10.10.10.2",
"ttl": 64,
"time": 610000
},
"2": {
"bytes": 58,
"source": "10.10.10.2",
"ttl": 64,
"time": 917000
},
"3": {
"bytes": 58,
"source": "10.10.10.2",
"ttl": 64,
"time": 1010000
}
}
}
Action succeeded
以下示例检查目标 10.10.10.2 是否可达,如果数据包大于其遍历的任何网段的最大传输单元 (MTU),则丢弃数据包而不是分片数据包。
cumulus@switch:~$ nv action ping system 10.10.10.2 do-not-fragment
Action executing ...
{
"sent": 3,
"received": 3,
"min_time": 651000,
"avg_time": 827000,
"max_time": 1071000,
"packets_info": {
"1": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 1070000
},
"2": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 651000
},
"3": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 761000
}
}
}
Action succeeded
以下示例从源 IP 地址 10.10.10.1 向目标 10.10.10.2 发送回显请求数据包
cumulus@switch:~$ nv action ping system 10.10.10.2 source 10.10.10.1
Action executing ...
{
"sent": 3,
"received": 3,
"min_time": 434000,
"avg_time": 574000,
"max_time": 812000,
"packets_info": {
"1": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 812000
},
"2": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 478000
},
"3": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 434000
}
}
}
Action succeeded
以下示例从管理 VRF 中的源 IP 地址 10.10.10.1 向目标 10.10.10.2 发送回显请求数据包
cumulus@switch:~$ nv action ping system 10.10.10.2 source 10.10.10.1 vrf mgmt
Action executing ...
{
"sent": 3,
"received": 3,
"min_time": 617000,
"avg_time": 695000,
"max_time": 837000,
"packets_info": {
"1": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 617000
},
"2": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 837000
},
"3": {
"bytes": 64,
"source": "10.10.10.2",
"ttl": 64,
"time": 631000
}
}
}
Action succeeded
以下示例从源接口 bond1 向目标 fe80::4638:39ff:fe00:5a 发送回显请求数据包。
cumulus@switch:~$ nv action ping system fe80::4638:39ff:fe00:5a source-interface bond1
nv action ping system fe80::4638:39ff:fe00:5a source-interface bond1
Error: Action failed with the following issue:
3 packets transmitted, 0 received, 100% packet loss, time 2056ms
您可以向目标(IP 地址或主机名)发送回显请求数据包,以检查其是否可达。此外,您可以指定以下选项
选项 | 描述 |
---|---|
-c | 要发送的回显请求数据包的数量。您可以指定介于 1 到 10 之间的值。默认数据包计数为 3。 |
-i | 发送回显请求数据包的频率。您可以指定介于 0.1 到 5 秒之间的值。默认值为 4 秒。 |
-s | 数据包大小(以字节为单位)。您可以指定介于 1 到 9216 之间的值。默认值为 64 字节。 |
-W | 在 ping 请求超时之前等待回显回复数据包的秒数。您可以指定介于 0.1 到 10 之间的值。默认值为 10 秒。 |
-I <ip-address> | 从中发送回显请求数据包的源 IP 地址。 |
M do | 不分片。如果数据包大于其遍历的任何网段的最大传输单元 (MTU),则丢弃数据包而不是分片数据包。 |
<l3protocol> | 您要用于发送回显请求数据包的第 3 层协议。您可以为 IPv4 指定 -4 ,为 IPv6 指定 -6 。如果您未指定 IPv4 或 IPv6,则 ping 使用 IPv4。 |
-I <vrf-name> | 您要使用的 VRF。 |
-6 <ipv6-address>%<interface> | 从中发送链路本地地址的回显请求数据包的源接口。仅限 IPv6。 |
以下示例检查目标 10.10.10.2 在网络上是否可达。
cumulus@switch:~$ ping 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=0.719 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=0.711 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=64 time=0.710 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=64 time=0.607 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=64 time=0.882 ms
64 bytes from 10.10.10.2: icmp_seq=6 ttl=64 time=0.808 ms
64 bytes from 10.10.10.2: icmp_seq=7 ttl=64 time=0.833 ms
64 bytes from 10.10.10.2: icmp_seq=8 ttl=64 time=0.680 ms
64 bytes from 10.10.10.2: icmp_seq=9 ttl=64 time=0.790 ms
...
以下示例向 IPv6 目标 fe80::4ab0:2dff:fee4:e069 发送回显请求数据包。
cumulus@switch:~$ ping -6 fe80::4ab0:2dff:fee4:e069
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING fe80::4ab0:2dff:fee4:e069(fe80::4ab0:2dff:fee4:e069) 56 data bytes
64 bytes from fe80::4ab0:2dff:fee4:e069%peerlink.4094: icmp_seq=1 ttl=64 time=0.067 ms
64 bytes from fe80::4ab0:2dff:fee4:e069%peerlink.4094: icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from fe80::4ab0:2dff:fee4:e069%peerlink.4094: icmp_seq=3 ttl=64 time=0.029 ms
64 bytes from fe80::4ab0:2dff:fee4:e069%peerlink.4094: icmp_seq=4 ttl=64 time=0.061 ms
64 bytes from fe80::4ab0:2dff:fee4:e069%peerlink.4094: icmp_seq=5 ttl=64 time=0.038 ms
...
以下示例每两秒发送 5 个回显请求数据包,以检查目标 10.10.10.2 在网络上是否可达,并在超时前等待 3 秒以接收回显回复数据包。
cumulus@switch:~$ ping -c 5 -i 2 -W 3 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=0.901 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=0.833 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=64 time=0.834 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=64 time=1.06 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=64 time=1.08 ms
...
以下示例发送 50 字节的回显请求数据包,以检查目标 10.10.10.2 在网络上是否可达。
cumulus@switch:~$ ping -s 50 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING 10.10.10.2 (10.10.10.2) 50(78) bytes of data.
58 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=1.04 ms
58 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=0.748 ms
58 bytes from 10.10.10.2: icmp_seq=3 ttl=64 time=0.782 ms
58 bytes from 10.10.10.2: icmp_seq=4 ttl=64 time=0.683 ms
58 bytes from 10.10.10.2: icmp_seq=5 ttl=64 time=0.951 ms
58 bytes from 10.10.10.2: icmp_seq=6 ttl=64 time=0.646 ms
58 bytes from 10.10.10.2: icmp_seq=7 ttl=64 time=0.809 ms
58 bytes from 10.10.10.2: icmp_seq=8 ttl=64 time=0.672 ms
58 bytes from 10.10.10.2: icmp_seq=9 ttl=64 time=0.640 ms
58 bytes from 10.10.10.2: icmp_seq=10 ttl=64 time=0.679 ms
58 bytes from 10.10.10.2: icmp_seq=11 ttl=64 time=0.667 m
...
以下示例检查目标 10.10.10.2 是否可达,并为 IPv4 设置 不分片
位。
cumulus@switch:~$ ping -M do 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING 10.10.10.2 (10.10.10.2) 56(84) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=0.722 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=0.708 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=64 time=0.633 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=64 time=1.11 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=64 time=0.519 ms
64 bytes from 10.10.10.2: icmp_seq=6 ttl=64 time=1.04 ms
64 bytes from 10.10.10.2: icmp_seq=7 ttl=64 time=0.716 ms
...
以下示例从管理 VRF 的源 IP 地址 10.10.10.1 向目标 10.10.10.2 发送回显请求数据包。
cumulus@switch:~$ ping -I mgmt 10.10.10.1 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING 10.10.10.2 (10.10.10.2) from 192.168.200.11 mgmt: 56(124) bytes of data.
64 bytes from 10.10.10.2: icmp_seq=1 ttl=64 time=0.722 ms
64 bytes from 10.10.10.2: icmp_seq=2 ttl=64 time=0.708 ms
64 bytes from 10.10.10.2: icmp_seq=3 ttl=64 time=0.633 ms
64 bytes from 10.10.10.2: icmp_seq=4 ttl=64 time=1.11 ms
64 bytes from 10.10.10.2: icmp_seq=5 ttl=64 time=0.519 ms
64 bytes from 10.10.10.2: icmp_seq=6 ttl=64 time=1.04 ms
64 bytes from 10.10.10.2: icmp_seq=7 ttl=64 time=0.716 ms
...
以下示例从源接口 bond1 向目标 fe80::a00:27ff:fe00:0 发送回显请求数据包。
cumulus@switch:~$ ping -6 fe80::a00:27ff:fe00:0%bond1
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
PING fe80::a00:27ff:fe00:0%bond1(fe80::a00:27ff:fe00:0%bond1)
64 bytes from ::1: icmp_seq=1 ttl=64 time=0.044 ms
64 bytes from ::1: icmp_seq=2 ttl=64 time=0.058 ms
64 bytes from ::1: icmp_seq=3 ttl=64 time=0.292 ms
64 bytes from ::1: icmp_seq=4 ttl=64 time=0.026 ms
64 bytes from ::1: icmp_seq=5 ttl=64 time=0.055 ms
64 bytes from ::1: icmp_seq=6 ttl=64 time=0.056 ms
...
traceroute
traceroute 工具跟踪数据包从源到目标在 IP 网络上的路径,显示数据包通过的路由器(跃点)序列。
通过测量每个跃点的往返时间,traceroute 有助于识别延迟问题、路由效率低下或潜在的网络故障,使您能够排除故障并优化网络性能。
使用 nv action traceroute system <destination>
命令向目标发送 traceroute 数据包。目标可以是 IP 地址或域名。您可以指定以下选项
选项 | 描述 |
---|---|
最大 TTL | 到达目标的最大跃点数。您可以指定介于 1 到 30 之间的值。默认为 30。 |
初始 TTL | 到达目标的最小跃点数。您可以指定介于 1 到 30 之间的值。默认为 1。最小跃点数必须小于或等于最大跃点数。 |
等待 | 等待来自每个跃点的响应的最大纳秒数。您可以指定介于 0.1 到 10 之间的值。最大跃点数必须大于或等于最小跃点数。 |
VRF | 要使用的 VRF。 |
源 | 路由的源 IP 地址。 |
L3 协议 | 用于 traceroute 的第 3 层协议;ipv4 或 ipv6 。默认为 ipv4 。 |
L4 协议 | 用于 traceroute 的第 4 层协议;icmp 、tcp 或 udp 。默认为 icmp 。 |
不分片 | 不分片。跟踪到目标的路由,不进行分片。 |
以下示例验证到 IPv4 目标 10.10.10.2 的路由路径。
cumulus@switch:~$ nv action traceroute system 10.10.10.2
Action executing ...
traceroute response
{
"destination_name": "10.10.10.2",
"destination_address": "10.10.10.2",
"hops": 30,
"packet_size": 60,
"trace": {
"1": {
"hop": 1,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"2": {
"hop": 2,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"3": {
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
...
以下示例验证到 IPv6 目标 2001:DB8::1 的路由路径。
cumulus@switch:~$ nv action traceroute system 2001:DB8::1 l3protocol ipv6
Action executing ...
traceroute response
{
"destination_name": "",
"destination_address": "",
"hops": 1,
"packet_size": 60,
"trace": {
"1": {
"hop": 0,
"address": "",
"name": "",
"rtt": [],
"state": "DEFAULT"
}
}
}
Action succeeded
以下示例验证到目标 10.10.10.2 的路径,最小跃点数为 5,最大跃点数为 10。
cumulus@switch:~$ nv action traceroute system 10.10.10.2 initial-ttl 5 max-ttl 10
Action executing ...
traceroute response
{
"destination_name": "10.10.10.2",
"destination_address": "10.10.10.2",
"hops": 6,
"packet_size": 60,
"trace": {
"1": {
"hop": 5,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"2": {
"hop": 6,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"3": {
"hop": 7,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
...
以下示例发送 UDP 数据包以验证到目标 10.10.10.2 的路径,并等待 2 秒以接收响应。
cumulus@switch:~$ nv action traceroute system 10.10.10.2 l4protocol udp wait 2
Action executing ...
traceroute response
{
"destination_name": "10.10.10.2",
"destination_address": "10.10.10.2",
"hops": 30,
"packet_size": 60,
"trace": {
"1": {
"hop": 1,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"2": {
"hop": 2,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"3": {
"hop": 3,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
...
以下示例验证从源 IP 地址 10.10.10.1 到目标 10.10.10.2 的路径。
cumulus@switch:~$ nv action traceroute system 10.10.10.2 source 10.10.10.1
Action executing ...
traceroute response
{
"destination_name": "10.10.10.2",
"destination_address": "10.10.10.2",
"hops": 30,
"packet_size": 60,
"trace": {
"1": {
"hop": 1,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"2": {
"hop": 2,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"3": {
"hop": 3,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"4":
...
以下示例验证从管理 VRF 中的源 IP 地址 10.0.0.1 到目标 10.10.10.2 的路径。
cumulus@switch:~$ nv action traceroute system 10.10.10.2 source 10.10.10.1 vrf mgmt
Action executing ...
traceroute response
{
"destination_name": "10.10.10.2",
"destination_address": "10.10.10.2",
"hops": 30,
"packet_size": 60,
"trace": {
"1": {
"hop": 1,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"2": {
"hop": 2,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
"3": {
"hop": 3,
"address": "*",
"name": "*",
"rtt": [],
"state": "NONE"
},
...
您可以使用 traceroute
命令向目标发送 traceroute 数据包。目标可以是 IP 地址或域名。您可以指定以下选项
选项 | 描述 |
---|---|
-m | 到达目标的最大跃点数。您可以指定介于 1 到 30 之间的值。默认为 30。 |
-s | 路由的源 IP 地址。 |
-f | 到达目标的最小跃点数。您可以指定介于 1 到 30 之间的值。默认为 1。最小跃点数必须小于或等于最大跃点数。 |
-w | 等待来自每个跃点的响应的最大秒数。您可以指定介于 0.1 到 10 之间的值。 |
-i | 要使用的 VRF。 |
<layer3-protocol> | 第 3 层协议;IPv4 为 `-4`,IPv6 为 `-6`。默认为 IPv4。 |
<layer4-protocol> | 要发送的第 4 层协议数据包;ICMP 为 `-I`,TCP 为 `-T`,UDP 为 `-U`。 |
-F | 不分片。跟踪到目标的路由,不进行分片。 |
以下示例验证到 IPv4 目标 10.10.10.2 的路由路径。
cumulus@switch:~$ traceroute 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
traceroute to 10.10.10.2 (10.10.10.2), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
10 * * *
...
以下示例验证到 IPv6 目标 2001:DB8::1 的路由路径。
cumulus@switch:~$ traceroute -6 2001:DB8::1
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
traceroute to 2001:DB8::1 (::1), 30 hops max, 80 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
以下示例验证到目标 10.10.10.2 的路径,最小跃点数为 5,最大跃点数为 10。
cumulus@switch:~$ traceroute -f 5 -m 10 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
traceroute to 10.10.10.2 (10.10.10.2), 10 hops max, 60 byte packets
5 * * *
6 * * *
7 * * *
8 * * *
9 * * *
以下示例发送 UDP 数据包以验证到目标 10.10.10.2 的路径,并等待 2 秒以接收响应。
cumulus@switch:~$ traceroute -U -w 2 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
traceroute to 10.10.10.2 (10.10.10.2), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
以下示例验证从源 IP 地址 10.10.10.1 到目标 10.10.10.2 的路径。
cumulus@switch:~$ traceroute -s 10.10.10.1 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
traceroute to 10.10.10.2 (10.10.10.2), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
...
以下示例验证从管理 VRF 中的源 IP 地址 10.0.0.1 到目标 10.10.10.2 的路径。
cumulus@switch:~$ traceroute -s 10.10.10.1 -i mgmt 10.10.10.2
vrf-wrapper.sh: switching to vrf "default"; use '--no-vrf-switch' to disable
traceroute to 10.10.10.2 (10.10.10.2), 30 hops max, 60 byte packets
1 * * *
2 * * *
3 * * *
4 * * *
5 * * *
6 * * *
7 * * *
8 * * *
...
tcpdump
您可以使用 Linux tcpdump
命令来监控控制平面流量(发送到交换机 CPU 和来自交换机 CPU 的流量)。tcpdump
不监控数据平面流量;请改用 cl-acltool
。
以下示例使用以下 tcpdump
选项
-i bond0
捕获从 bond0 到 CPU 以及从 CPU 到 bond0 的数据包host 169.254.0.2
筛选此 IP 地址-c 10
捕获 10 个数据包然后停止
cumulus@switch:~$ sudo tcpdump -i bond0 host 169.254.0.2 -c 10
tcpdump: WARNING: bond0: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on bond0, link-type EN10MB (Ethernet), capture size 65535 bytes
16:24:42.532473 IP 169.254.0.2 > 169.254.0.1: ICMP echo request, id 27785, seq 6, length 64
16:24:42.532534 IP 169.254.0.1 > 169.254.0.2: ICMP echo reply, id 27785, seq 6, length 64
16:24:42.804155 IP 169.254.0.2.40210 > 169.254.0.1.5342: Flags [.], seq 266275591:266277039, ack 3813627681, win 58, options [nop,nop,TS val 590400681 ecr 530346691], length 1448
16:24:42.804228 IP 169.254.0.1.5342 > 169.254.0.2.40210: Flags [.], ack 1448, win 166, options [nop,nop,TS val 530348721 ecr 590400681], length 0
16:24:42.804267 IP 169.254.0.2.40210 > 169.254.0.1.5342: Flags [P.], seq 1448:1836, ack 1, win 58, options [nop,nop,TS val 590400681 ecr 530346691], length 388
16:24:42.804293 IP 169.254.0.1.5342 > 169.254.0.2.40210: Flags [.], ack 1836, win 165, options [nop,nop,TS val 530348721 ecr 590400681], length 0
16:24:43.532389 IP 169.254.0.2 > 169.254.0.1: ICMP echo request, id 27785, seq 7, length 64
16:24:43.532447 IP 169.254.0.1 > 169.254.0.2: ICMP echo reply, id 27785, seq 7, length 64
16:24:43.838652 IP 169.254.0.1.59951 > 169.254.0.2.5342: Flags [.], seq 2555144343:2555145791, ack 2067274882, win 58, options [nop,nop,TS val 530349755 ecr 590399688], length 1448
16:24:43.838692 IP 169.254.0.1.59951 > 169.254.0.2.5342: Flags [P.], seq 1448:1838, ack 1, win 58, options [nop,nop,TS val 530349755 ecr 590399688], length 390
10 packets captured
12 packets received by filter
0 packets dropped by kernel