目录


文章目录

  • 目录
  • Using the trace command
  • 应用示例
  • Examine Trace of ping from host to VPP
  • Examine Trace of ping from VPP to host


Using the trace command

  • Add Trace
vpp# trace add af-packet-input 10
  • Show trace buffer [max COUNT].
vpp# show trace
  • filter trace output - include NODE COUNT | exclude NODE COUNT | none.
vpp# trace filter <include NODE COUNT | exclude NODE COUNT | none>
  • Clear trace buffer and free memory.
vpp# clear trace

应用示例

Examine Trace of ping from host to VPP

FD.io/VPP — 流量追踪_3c

NOTE​:因为本示例使用 non-DPDK 模式,所以 VPP 入口是 af-packet-input 而非 dpdk-input。

  • Add trace
vpp# trace add af-packet-input 10
  • Linux Host ping VPP1
$ ping -c 1 10.10.1.2
PING 10.10.1.2 (10.10.1.2) 56(84) bytes of data.
64 bytes from 10.10.1.2: icmp_seq=1 ttl=64 time=0.204 ms
  • Show trace again
vpp# show trace
------------------- Start of thread 0 vpp_main -------------------
Packet 1

01:08:00:965543: af-packet-input
af_packet: hw_if_index 1 next-index 4
tpacket2_hdr:
status 0x20000001 len 98 snaplen 98 mac 66 net 80
sec 0x60a91e6d nsec 0x21459d79 vlan 0 vlan_tpid 0
01:08:00:965567: ethernet-input
IP4: 22:5b:e3:6a:2c:85 -> 02:fe:d6:f5:de:03
01:08:00:965574: ip4-input
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 84, checksum 0x3cae dscp CS0 ecn NON_ECN
fragment id 0xe7e4, flags DONT_FRAGMENT
ICMP echo_request checksum 0x76da id 10830
01:08:00:965583: ip4-lookup
fib 0 dpo-idx 7 flow hash: 0x00000000
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 84, checksum 0x3cae dscp CS0 ecn NON_ECN
fragment id 0xe7e4, flags DONT_FRAGMENT
ICMP echo_request checksum 0x76da id 10830
01:08:00:965591: ip4-local
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 84, checksum 0x3cae dscp CS0 ecn NON_ECN
fragment id 0xe7e4, flags DONT_FRAGMENT
ICMP echo_request checksum 0x76da id 10830
01:08:00:965593: ip4-icmp-input
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 84, checksum 0x3cae dscp CS0 ecn NON_ECN
fragment id 0xe7e4, flags DONT_FRAGMENT
ICMP echo_request checksum 0x76da id 10830
01:08:00:965595: ip4-icmp-echo-request
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 84, checksum 0x3cae dscp CS0 ecn NON_ECN
fragment id 0xe7e4, flags DONT_FRAGMENT
ICMP echo_request checksum 0x76da id 10830
01:08:00:965598: ip4-load-balance
fib 0 dpo-idx 2 flow hash: 0x00000000
ICMP: 10.10.1.2 -> 10.10.1.1
tos 0x00, ttl 64, length 84, checksum 0x804e dscp CS0 ecn NON_ECN
fragment id 0xa444, flags DONT_FRAGMENT
ICMP echo_reply checksum 0x7eda id 10830
01:08:00:965600: ip4-rewrite
tx_sw_if_index 1 dpo-idx 2 : ipv4 via 10.10.1.1 host-vpp1out: mtu:9000 next:3 225be36a2c8502fed6f5de030800 flow hash: 0x00000000
00000000: 225be36a2c8502fed6f5de03080045000054a44440004001804e0a0a01020a0a
00000020: 010100007eda2a4e00016d1ea9600000000079840800000000001011
01:08:00:965602: host-vpp1out-output
host-vpp1out
IP4: 02:fe:d6:f5:de:03 -> 22:5b:e3:6a:2c:85
ICMP: 10.10.1.2 -> 10.10.1.1
tos 0x00, ttl 64, length 84, checksum 0x804e dscp CS0 ecn NON_ECN
fragment id 0xa444, flags DONT_FRAGMENT
ICMP echo_reply checksum 0x7eda id 10830
  • Clean trace
vpp# clear trace

Examine Trace of ping from VPP to host

  • Add trace
vpp# trace add af-packet-input 10
  • VPP1 ping Linux Host
vpp# ping 10.10.1.1 repeat 1
116 bytes from 10.10.1.1: icmp_seq=1 ttl=64 time=.2578 ms

Statistics: 1 sent, 1 received, 0% packet loss
  • Show trace again
vpp# show trace
------------------- Start of thread 0 vpp_main -------------------
Packet 1

01:20:57:298885: af-packet-input
af_packet: hw_if_index 1 next-index 4
tpacket2_hdr:
status 0x20000001 len 110 snaplen 110 mac 66 net 80
sec 0x60a92175 nsec 0x349bedf9 vlan 0 vlan_tpid 0
01:20:57:298890: ethernet-input
IP4: 22:5b:e3:6a:2c:85 -> 02:fe:d6:f5:de:03
01:20:57:298907: ip4-input
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 96, checksum 0xd1fd dscp CS0 ecn NON_ECN
fragment id 0x9289
ICMP echo_reply checksum 0xf346 id 39522
01:20:57:298921: ip4-lookup
fib 0 dpo-idx 7 flow hash: 0x00000000
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 96, checksum 0xd1fd dscp CS0 ecn NON_ECN
fragment id 0x9289
ICMP echo_reply checksum 0xf346 id 39522
01:20:57:298923: ip4-local
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 96, checksum 0xd1fd dscp CS0 ecn NON_ECN
fragment id 0x9289
ICMP echo_reply checksum 0xf346 id 39522
01:20:57:298925: ip4-icmp-input
ICMP: 10.10.1.1 -> 10.10.1.2
tos 0x00, ttl 64, length 96, checksum 0xd1fd dscp CS0 ecn NON_ECN
fragment id 0x9289
ICMP echo_reply checksum 0xf346 id 39522
01:20:57:298926: ip4-icmp-echo-reply
ICMP4 echo id 39522 seq 1 send to cli node 659

Packet 2

01:21:02:426688: af-packet-input
af_packet: hw_if_index 1 next-index 4
tpacket2_hdr:
status 0x20000001 len 42 snaplen 42 mac 66 net 80
sec 0x60a9217b nsec 0x62efa0 vlan 0 vlan_tpid 0
01:21:02:426707: ethernet-input
ARP: 22:5b:e3:6a:2c:85 -> 02:fe:d6:f5:de:03
01:21:02:426711: arp-input
request, type ethernet/IP4, address size 6/4
22:5b:e3:6a:2c:85/10.10.1.1 -> 00:00:00:00:00:00/10.10.1.2
01:21:02:426717: arp-reply
request, type ethernet/IP4, address size 6/4
22:5b:e3:6a:2c:85/10.10.1.1 -> 00:00:00:00:00:00/10.10.1.2
01:21:02:426758: host-vpp1out-output
host-vpp1out
ARP: 02:fe:d6:f5:de:03 -> 22:5b:e3:6a:2c:85
reply, type ethernet/IP4, address size 6/4
02:fe:d6:f5:de:03/10.10.1.2 -> 22:5b:e3:6a:2c:85/10.10.1.1
  • Clean trace
vpp# clear trace