TWAMP(Two-Way Active Measurement Protocol,双向主动测量协议)是一种用于 IP 链路的网络质量测量技术,它使用 UDP 报文测量网络双向路径时延、抖动及丢包率。TWAMP-light 是 TWAMP 协议的轻量级架构,简化了建立性能测量会话的控制协议,提高了测试性能。
如下 TWAMP 与 TWAMP light 主要区别在于 Twamp 需要先使用 TCP 建立控制层面。
TWAMP #
TWAMP light #
rfc5357
TWAMP 配置 #
Cisco XR 的路由器目前只支持作为 Server, 不支持作为 Client, 也就是说它只能进行测量报文的反射, 而测量报文的主动发起方是 Control-Client 端。
Control-Client 端我们选择使用 github 上的一个基于 python 的脚本twampy.
!!!!! Router as TWAMP Resonder
ipsla
responder
twamp
!
server twamp
!
!
!!!!! TWAMP controller
[root@server1 twampy]# ./twampy.py controller 172.18.87.49
===============================================================================
Direction Min Max Avg Jitter Loss
-------------------------------------------------------------------------------
Outbound: 0us 0us 0us 0us 0.0%
Inbound: 17.0min 17.0min 17.0min 148us 0.0%
Roundtrip: 185.39ms 187.59ms 186.12ms 217us 0.0%
-------------------------------------------------------------------------------
Jitter Algorithm [RFC1889]
===============================================================================
如上图, 首先 TCP 建立控制层面,再由 Control-Client 发送 UDP 探针,携带 Tx timeslot; Router 收到后添加 Revieve Timeslot, 反射探针.
TWAMP light 配置 #
!!!!! Router as TWAMP-Light Responder
ipsla
responder
!
twamp-light test-session 1
local-ip 172.18.87.49 local-port 862 remote-ip 10.70.79.197 remote-port 777 vrf default
!
!
server twamp
!
!
!!!!! TWAMP Light Controller
[root@server1 twampy]# ./twampy.py sender 172.18.87.49:862 10.70.79.197:777
===============================================================================
Direction Min Max Avg Jitter Loss
-------------------------------------------------------------------------------
Outbound: 0us 0us 0us 0us 0.0%
Inbound: 17.0min 17.0min 17.0min 136us -2.0%
Roundtrip: 173.09ms 180.26ms 174.47ms 344us -2.0%
-------------------------------------------------------------------------------
Jitter Algorithm [RFC1889]
===============================================================================
!!!!!!!Command to check packet received (version 7.1.3)
RP/0/RSP0/CPU0:ASR-9006-F#show ipsla twamp session
Wed Nov 3 08:14:59.110 UTC
***** TWAMP Sessions *****
IP SLAs Responder TWAMP is: Enabled
Recvr Addr: 172.18.87.49
Recvr Port: 20001
Sender Addr: 10.70.79.197
Sender Port: 20000
Sender VRF Name: default
Session Id: 172.18.87.49:1635927288.140734154578682:0x394a9afa
Connection Id: 0xea
Mode: Unauthenticated
DSCP: 0
Pad Length: 0
Number of Packets Received: 91
***** TWAMP-LIGHT Sessions *****
Session status: Active
Recvr Addr: 172.18.87.49
Recvr Port: 862
Sender Addr: 10.70.79.197
Sender Port: 777
Sender VRF Name: default
Session ID: 1
Mode: Unauthenticated
Number of Packets Received: 500
Session timeout: 0
如上图,twamp light 无 control 层面,只通过交互 UDP 探针;使用的端口号可以自己定义.
TWAMP 和 TWAMP light 相关抓包 #
Performance Measurement #
SR PM 这个 feature 支持采用 TWAMP Light encoding 的方式进行直连链路的延迟性检测, 参考文章Configure Performance Measurement。
相关配置:
!!!!!!!! Sender
RP/0/RP0/CPU0:P-2#show run performance-measurement
Tue Mar 1 04:07:48.011 UTC
performance-measurement
interface TenGigE0/0/0/14
next-hop ipv4 10.10.12.1
delay-measurement
advertise-delay 1000
!
!
protocol twamp-light
measurement delay
unauthenticated
querier-dst-port 11000
!
!
!
!
!!!!!!! Reflector
RP/0/RP0/CPU0:ios#show run performance-measurement
Tue Mar 1 03:59:25.056 UTC
performance-measurement
protocol twamp-light <<<< 如果Sender使用默认端口862 , 则Reflector 只用配置"performance-measurement" 即可; 如果sender使用其他端口, 则reflector 需要配置一样的port,即额外添加以下配置
measurement delay
unauthenticated
querier-dst-port 11000
!
!
!
!
Sender:
RP/0/RP0/CPU0:P-2#show performance-measurement interfaces tenGigE 0/0/0/14 det$
Tue Mar 1 03:25:50.486 UTC
-------------------------------------------------------------------------------
0/0/CPU0
-------------------------------------------------------------------------------
Interface Name: TenGigE0/0/0/14 (ifh: 0x88)
Delay-Measurement : Enabled
Loss-Measurement : Disabled
Configured IPv4 Address : 10.10.12.2
Configured IPv6 Address : ::
Link Local IPv6 Address : ::
Configured Next-hop Address : 10.10.12.1
Local MAC Address : 00bc.6062.2c38
Next-hop MAC Address : 00bc.6030.a838
Primary VLAN Tag : None
Secondary VLAN Tag : None
State : Up
Delay Measurement session:
Session ID : 1
Last advertisement:
Advertised at: Feb 28 2022 16:31:45.428 (39245.136 seconds ago)
Advertised reason: Advertise delay config
Advertised delays (uSec): avg: 1000, min: 1000, max: 1000, variance: 0
Next advertisement:
Threshold check scheduled in 3 more probes (roughly every 120 seconds)
No probes completed
Rolling average (uSec): 1
Current Probe:
Started at: Mar 01 2022 03:25:33.122 (17.442 seconds ago)
Packets Sent: 6, received: 6
Measured delays (uSec): avg: 1, min: 1, max: 1, variance: 0
Next probe scheduled at: Mar 01 2022 03:26:03.121 (in 12.557 seconds)
Next burst packet will be sent in 0.557 seconds
Burst packet sent every 3.0 seconds
Responder IP : 10.10.12.1
Number of Hops : 1
Probe samples:
Packet Rx Timestamp Measured Delay (nsec)
Mar 01 2022 03:25:21.124 1530
Mar 01 2022 03:25:24.124 1522
Mar 01 2022 03:25:27.124 1528
Mar 01 2022 03:25:30.124 1532
Mar 01 2022 03:25:33.125 1528
Mar 01 2022 03:25:36.125 1532