Language / 语言: Respond in the same language the user uses. If the user speaks Chinese, use the Chinese (zh-CN) prompts below. If the user speaks English, use the English (en) prompts below.
Guides an agent through interactive network reachability analysis using Alibaba Cloud NIS. Covers forward/reverse path analysis, topology visualization (Mermaid), and monitoring diagnostics for resources along the path.
Architecture: NIS (CreateAndAnalyzeNetworkPath + GetNetworkReachableAnalysis) + CloudMonitor (DescribeMetricData)
⚠️ CRITICAL / 关键: READ-ONLY OPERATIONS ONLY
This skill performs read-only network diagnostics. DO NOT create, modify, or delete any cloud resources.
本技能仅执行 只读 网络诊断操作。 严禁 创建、修改或删除任何云资源。
Allowed:
CreateAndAnalyzeNetworkPath,GetNetworkReachableAnalysis,DescribeMetricData,Describe*APIs允许:分析任务创建与查询、监控数据查询、Describe* 类查询 API
Forbidden:
Create*(exceptCreateAndAnalyzeNetworkPath),Modify*,Delete*,Start*,Stop*,Run*APIs禁止:创建类 API(除
CreateAndAnalyzeNetworkPath外)、修改、删除、启停、执行类 API
Pre-check: Aliyun CLI >= 3.3.1 required Run
aliyun versionto verify >= 3.3.1. If not installed or version too low, see references/cli-installation-guide.md for installation instructions. Then [MUST] runaliyun configure set --auto-plugin-install trueto enable automatic plugin installation.
bash
aliyun version
aliyun configure set --auto-plugin-install true
Pre-check: Alibaba Cloud Credentials Required
Security Rules:
- NEVER read, echo, or print AK/SK values (e.g.,
echo $ALIBABA_CLOUD_ACCESS_KEY_IDis FORBIDDEN)- NEVER ask the user to input AK/SK directly in the conversation or command line
- NEVER use
aliyun configure setwith literal credential values- ONLY use
aliyun configure listto check credential statusbash
aliyun configure list --user-agent AlibabaCloud-Agent-SkillsCheck the output for a valid profile (AK, STS, or OAuth identity).
If no valid profile exists, STOP here.
- Obtain credentials from Alibaba Cloud Console
- Configure credentials outside of this session (via
aliyun configurein terminal or environment variables in shell profile)- Return and re-run after
aliyun configure listshows a valid profile
See references/ram-policies.md for the full RAM policy.
Required actions: nis:CreateAndAnalyzeNetworkPath, nis:GetNetworkReachableAnalysis, cms:DescribeMetricData.
IMPORTANT: Parameter Confirmation — Before executing any command or API call, ALL user-customizable parameters (e.g., RegionId, instance IDs, IP addresses, protocol, ports, resource types, etc.) MUST be confirmed with the user. Do NOT assume or use default values without explicit user approval.
Collect the following parameters interactively:
ParameterRequiredDescription (EN)说明 (ZH)DefaultRegionIdYesRegion of the analysis task分析任务所在地域—SourceTypeYesecs, vsw, internetIp, vpn, vbr源端类型—SourceIdYesSource resource ID (or public IP if internetIp)源资源 ID(公网 IP 类型直接填 IP)—SourceIpAddressConditionalOn-Premise IP, required for vpn/ vbr云下私网 IP, vpn/ vbr 时 必填—TargetTypeYesecs, vsw, internetIp, vpn, vbr, clb目的端类型—TargetIdYesTarget resource ID (or public IP if internetIp)目的资源 ID(公网 IP 类型直接填 IP)—TargetIpAddressConditionalOn-Premise IP, required for vpn/ vbr云下私网 IP, vpn/ vbr 时 必填—ProtocolYestcp, udp, or icmp协议类型—TargetPortConditionalRequired for tcp/ udp``tcp/ udp 时必填—SourcePortOptionalSource port源端口—
Use the prompts matching the user's language:
Step 1 — Ask resource types / 询问资源类型
ENZH"What is the source resource type? (ecs / vsw / internetIp / vpn / vbr)""请问 源端资源类型 是什么?(ecs / vsw / internetIp / vpn / vbr)""What is the target resource type? (ecs / vsw / internetIp / vpn / vbr / clb)""请问 目的端资源类型 是什么?(ecs / vsw / internetIp / vpn / vbr / clb)"
Step 2 — Type-specific prompts / 按类型提示
ConditionEN PromptZH PromptinternetIp"For public IP analysis, please provide the public IP address directly as the ID.""分析公网路径时,请直接提供 公网 IP 地址 作为 ID 传入。"vpn / vbr"For hybrid cloud analysis, besides the resource ID, please also provide the On-Premise IP (private IP on your side).""连接云下环境时,除了资源 ID,请务必提供您的 云下私网 IP (On-Premise IP) 以确保分析准确。"
Step 3 — Protocol & ports / 协议和端口
ENZH"What protocol? (tcp / udp / icmp) And what is the target port?""请问使用什么协议?(tcp / udp / icmp)目的端口是多少?"
bash
aliyun nis create-and-analyze-network-path \
--source-id <SourceId> \
--source-type <SourceType> \
--target-id <TargetId> \
--target-type <TargetType> \
--protocol <Protocol> \
--target-port <TargetPort> \
--source-ip-address <SourceIpAddress> \
--target-ip-address <TargetIpAddress> \
--region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills
Omit
--source-ip-address/--target-ip-addressif SourceType/TargetType is notvpnorvbr. Omit--target-portif Protocol isicmp.
Record the returned NetworkReachableAnalysisId.
⚠️ MANDATORY / 强制: ALWAYS perform reverse path analysis after forward analysis completes.
MUST execute Step 3 (Reverse Path Analysis) immediately after Step 2 finishes. Do NOT skip or omit reverse path check.
必须 在正向分析完成后立即执行 Step 3(反向路径分析)。严禁跳过或省略反向路径检查。
bash
aliyun nis get-network-reachable-analysis \
--network-reachable-analysis-id <ForwardAnalysisId> \
--region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills
Repeat until NetworkReachableAnalysisStatus is finish. Extract Reachable, NetworkReachableAnalysisResult.
Swap source and target / 交换源和目的:
SourceId/Type → Reverse TargetId/TypeTargetId/Type → Reverse SourceId/TypeSourceIpAddress → Reverse TargetIpAddressTargetIpAddress → Reverse SourceIpAddressPort handling / 端口处理:
--source-port = Forward TargetPort (server listening port / 服务端监听端口)--target-port = Random ephemeral port in range 49152 ~ 65535 (client ephemeral port / 客户端随机端口)Since the client initiates the connection with a dynamically assigned ephemeral port, the reverse path (server → client) should use a random port in the ephemeral range (49152-65535) as the target port to simulate real return traffic.
由于客户端发起连接时使用动态分配的临时端口,反向路径(服务端→客户端)的目的端口应使用临时端口范围(49152-65535)内的随机值来模拟真实回程流量。
bash
aliyun nis create-and-analyze-network-path \
--source-id <OriginalTargetId> \
--source-type <OriginalTargetType> \
--target-id <OriginalSourceId> \
--target-type <OriginalSourceType> \
--protocol <Protocol> \
--source-port <OriginalTargetPort> \
--target-port <RandomPort_49152_to_65535> \
--source-ip-address <OriginalTargetIpAddress> \
--target-ip-address <OriginalSourceIpAddress> \
--region <RegionId> \
--user-agent AlibabaCloud-Agent-Skills
Omit
--source-ip-address/--target-ip-addressif SourceType/TargetType is notvpnorvbr. 若源/目的类型不是vpn或vbr,可省略--source-ip-address/--target-ip-address。
Same as Step 2, using the reverse NetworkReachableAnalysisId.
CRITICAL / 关键: Always use
topologyData.positivefrom the actively initiated analysis task. IGNOREtopologyData.reversein any response — it is unreliable.始终使用 主动发起 的分析任务返回的
topologyData.positive。 忽略 任何响应中的topologyData.reverse——它不可靠。
For each direction (forward/reverse) / 对正向和反向分别:
Check Reachable field. If true, path is connected. / 检查 Reachable 字段, true 表示可达。
If false, analyze from NetworkReachableAnalysisResult: / 若为 false,分析以下字段定位阻断点:
errorCode — root cause code / 根因错误码securityGroupData — security group rules blocking traffic / 安全组拦截规则routeData — route table entries causing drops / 路由表丢包条目Generate a Mermaid diagram from topologyData.positive:
text
graph LR
nodeType and bizInsId from nodeListlinkListExample:
Rendering diagram...
For resource IDs found in topologyData, if they match the prefixes below, query monitoring data for the last 1 hour:
对 topologyData 中途经的资源 ID,若匹配以下前缀,查询 最近 1 小时 监控数据:
PrefixNamespaceMetricsecs-``acs_ecs_dashboard``CPUUtilization, ConnectionUtilization, DiskReadWriteIOPSUtilization, BurstCredit, DiskIOQueueSize``eip-``acs_vpc_eip``out_ratelimit_drop_speed, net_out.rate_percentage, net_rxPkgs.rate``nat-``acs_nat_gateway``ErrorPortAllocationCount, SessionLimitDropConnection, SessionActiveConnectionWaterLever, SessionNewConnectionWaterLever, BWRateOutToOutside, DropTotalPps``clb-``acs_slb_dashboard``UnhealthyServerCount, UpstreamCode5xx, InstanceQpsUtilization, InstanceMaxConnectionUtilization, UpstreamRt, StatusCode4xx``vbr-``acs_physical_connection``VbrHealthyCheckLossPercent, VbrHealthyCheckLatency, PkgsRateLimitDropOutFromVpcToVbr, RateOutFromVpcToIDC
Query command (CMS uses PascalCase API-style, not plugin mode):
bash
aliyun cms DescribeMetricData \
--Namespace <Namespace> \
--MetricName <MetricName> \
--Dimensions '[{"instanceId":"<ResourceId>"}]' \
--StartTime <1HourAgoTimestamp> \
--EndTime <NowTimestamp> \
--Period 60 \
--user-agent AlibabaCloud-Agent-Skills
Rate limit: 10 calls/second per account. Batch queries across multiple metrics should be paced accordingly.
NIS reachability analysis is read-only — no cloud resources are created or modified. No cleanup is required. NIS 可达性分析为 只读操作——不会创建或修改任何云资源,无需清理。
DescribeMetricData shares 1,000,000 free calls/month with other CMS query APIs.vpn/ vbr scenarios, always provide On-Premise IP. / vpn/ vbr 场景务必提供云下私网 IP。ReferenceContents (EN)内容 (ZH)references/ram-policies.mdRequired RAM permissions所需 RAM 权限策略references/verification-method.mdStep-by-step verification commands逐步验证命令references/acceptance-criteria.mdCorrect/incorrect CLI patterns正确/错误 CLI 模式对照references/cli-installation-guide.mdAliyun CLI installation guide阿里云 CLI 安装指南