VMware NSX
VMware NSX networking management — 31 MCP tools for segments, gateways, NAT, routing, and IPAM.
Domain-focused networking skill for NSX-T / NSX 4.x Policy API.
Companion skills: vmware-nsx-security (DFW/firewall), vmware-aiops (VM lifecycle), vmware-monitor (read-only monitoring), vmware-storage (iSCSI/vSAN), vmware-vks (Tanzu Kubernetes), vmware-aria (metrics/alerts/capacity), vmware-avi (AVI/ALB/AKO).
| vmware-pilot (workflow orchestration) | vmware-policy (audit/policy)
What This Skill Does
| Category | Tools | Count |
|---|
| Segments | list, get details, create, update, delete, list ports | 6 |
| Tier-0 Gateways |
list, get details, BGP neighbors, route table | 4 |
|
Tier-1 Gateways | list, get details, create, update, delete, route table | 6 |
|
NAT | list rules, get rule details, create rule, update rule, delete rule | 5 |
|
Static Routes | list, create, delete | 3 |
|
IP Pools | list, get allocations, create pool, create subnet | 4 |
|
Health & Troubleshooting | NSX alarms, transport node status, edge cluster status, manager cluster status, logical port status, VM-to-segment lookup | 6 |
Total: 31 tools (18 read-only + 13 write)
Quick Install
CODEBLOCK0
When to Use This Skill
- - List, create, or modify NSX segments (overlay / VLAN-backed)
- Create or manage Tier-0 / Tier-1 gateways
- Configure NAT rules (SNAT, DNAT, reflexive)
- View or add static routes, check BGP neighbors
- Manage IP pools and subnet allocations
- Check NSX alarms, transport node health, edge cluster status
- Find which segment a VM is connected to
- Troubleshoot logical port status
Use companion skills for:
- - Distributed firewall, security groups, DFW rules, IDS/IPS → INLINECODE0
- VM lifecycle, deployment, guest ops → INLINECODE1
- vSphere inventory, health, alarms, events → INLINECODE2
- Storage: iSCSI, vSAN, datastores → INLINECODE3
- Tanzu Kubernetes → INLINECODE4
- Load balancing, AVI/ALB, AKO, Ingress → INLINECODE5
Related Skills — Skill Routing
| User Intent | Recommended Skill |
|---|
| NSX networking: segments, gateways, NAT, routing, IPAM | vmware-nsx ← this skill |
| NSX security: DFW rules, security groups, IDS/IPS |
vmware-nsx-security |
| Read-only vSphere monitoring, alarms, events |
vmware-monitor |
| VM lifecycle, deployment, guest ops |
vmware-aiops |
| Storage: iSCSI, vSAN, datastores |
vmware-storage |
| Tanzu Kubernetes (vSphere 8.x+) |
vmware-vks |
| Aria Ops: metrics, alerts, capacity planning |
vmware-aria |
| Multi-step workflows with approval |
vmware-pilot |
| Load balancer, AVI, ALB, AKO, Ingress |
vmware-avi (
uv tool install vmware-avi) |
| Audit log query |
vmware-policy (
vmware-audit CLI) |
Common Workflows
Create an App Network (Segment + T1 Gateway + NAT)
- 1. Create a Tier-1 gateway → INLINECODE8
- Create a segment → INLINECODE9
- Add SNAT rule → INLINECODE10
- Verify →
vmware-nsx segment list and INLINECODE12
Dry-run first: Append --dry-run to any write command to preview without executing:
CODEBLOCK1
Check Network Health
- 1. NSX manager cluster status → INLINECODE14
- Transport node status → INLINECODE15
- Edge cluster status → INLINECODE16
- Active alarms → INLINECODE17
- If issues found, investigate with
vmware-monitor for vSphere-side events
Troubleshoot VM Connectivity
- 1. Find the VM's segment → INLINECODE19
- Check logical port status → INLINECODE20
- Check the gateway route table → INLINECODE21
- Check BGP neighbors on T0 → INLINECODE22
- Review NAT rules → INLINECODE23
Multi-Target Operations
All commands accept --target <name> to operate against a specific NSX Manager from your config:
CODEBLOCK2
Usage Mode
| Scenario | Recommended | Why |
|---|
| Local/small models (Ollama, Qwen) | CLI | ~2K tokens vs ~8K for MCP |
| Cloud models (Claude, GPT-4o) |
Either | MCP gives structured JSON I/O |
| Automated pipelines |
MCP | Type-safe parameters, structured output |
MCP Tools (31 — 18 read, 13 write)
All MCP tools accept an optional target parameter to select which NSX Manager to connect to.
| Category | Tool | Type | Description |
|---|
| Segment | INLINECODE26 | Read | List all segments with type, subnet, gateway, transport zone |
|
get_segment | Read | Get segment details including ports and subnet config |
| |
create_segment | Write | Create overlay or VLAN segment with subnet and gateway |
| |
update_segment | Write | Update segment properties (description, tags, DHCP) |
| |
delete_segment | Write | Delete a segment (checks for connected ports first) |
| |
list_segment_ports | Read | List logical ports on a segment with status |
| Tier-0 GW |
list_tier0_gateways | Read | List Tier-0 gateways with HA mode and edge cluster |
| |
get_tier0_gateway | Read | Get Tier-0 details: interfaces, routing config, BGP |
| |
get_tier0_bgp_neighbors | Read | List BGP neighbor sessions with state, ASN, routes |
| |
get_tier0_route_table | Read | Get Tier-0 routing table (connected, static, BGP) |
| Tier-1 GW |
list_tier1_gateways | Read | List Tier-1 gateways with linked Tier-0 and edge cluster |
| |
get_tier1_gateway | Read | Get Tier-1 details: interfaces, route advertisement |
| |
create_tier1_gateway | Write | Create Tier-1 gateway with edge cluster and Tier-0 link |
| |
update_tier1_gateway | Write | Update Tier-1 properties (route advertisement, tags) |
| |
delete_tier1_gateway | Write | Delete a Tier-1 gateway (checks for connected segments) |
| |
get_tier1_route_table | Read | Get Tier-1 routing table |
| NAT |
list_nat_rules | Read | List NAT rules on a Tier-1 gateway |
| |
get_nat_rule | Read | Get NAT rule details (action, source, destination, translated) |
| |
create_nat_rule | Write | Create SNAT/DNAT/reflexive NAT rule on a gateway |
| |
update_nat_rule | Write | Update NAT rule properties |
| |
delete_nat_rule | Write | Delete a NAT rule |
| Static Routes |
list_static_routes | Read | List static routes on a Tier-0 or Tier-1 gateway |
| |
create_static_route | Write | Add a static route with network and next-hop |
| |
delete_static_route | Write | Remove a static route |
| IP Pools |
list_ip_pools | Read | List IP pools with usage statistics |
| |
get_ip_pool_allocations | Read | Show allocated IPs from a pool |
| |
create_ip_pool | Write | Create a new IP address pool |
| |
create_ip_pool_subnet | Write | Add a subnet/range to an IP pool |
| Health |
get_nsx_alarms | Read | List active NSX alarms with severity and entity |
| |
get_transport_node_status | Read | Transport node connectivity and config status |
| |
get_edge_cluster_status | Read | Edge cluster member status and failover config |
| |
get_manager_cluster_status | Read | NSX Manager cluster health and node roles |
| Troubleshoot |
get_logical_port_status | Read | Logical port admin/operational status and link state |
| |
find_vm_segment | Read | Find which segment(s) a VM is connected to by name |
Read/write split: 18 tools are read-only, 13 modify state. Write tools require explicit parameters and are audit-logged. All write operations support dry-run mode.
CLI Quick Reference
CODEBLOCK3
Full CLI reference with all options and output formats: see INLINECODE60
Troubleshooting
"Segment not found" when querying
Segment display names and Policy API IDs can differ. Use vmware-nsx segment list to get the exact ID. The Policy API uses the segment id field, not display_name. Common mistakes: using the display name with spaces instead of the hyphenated ID.
NAT rule creation fails with "gateway not found"
NAT rules are created on Tier-1 gateways (or Tier-0 for some topologies). Verify the gateway name with vmware-nsx gateway list-t1. The gateway must have an edge cluster assigned for NAT to function.
BGP neighbor shows "Connect" or "Active" state
The BGP session is not established. Common causes:
- 1. Peer IP unreachable from the edge node — check physical uplinks and VLAN config
- ASN mismatch — compare local and remote ASN in
bgp-neighbors output - Firewall blocking TCP 179 — check edge node firewall rules (not NSX DFW)
- MD5 password mismatch — verify authentication settings on both sides
Transport node status "degraded"
A transport node in degraded state has partial connectivity. Steps:
- 1. Check
vmware-nsx health transport-nodes for the specific failure reason - Common cause: tunnel endpoint (TEP) unreachable — verify underlay MTU (minimum 1600 for Geneve)
- Check NTP sync between NSX Manager and transport nodes
- If recently upgraded, verify the host switch config matches NSX Manager expectations
"Password not found" error
The password environment variable is missing. Variable names follow the pattern VMWARE_<TARGET_NAME_UPPER>_PASSWORD where hyphens become underscores. Example: target nsx-prod needs VMWARE_NSX_PROD_PASSWORD. Check your ~/.vmware-nsx/.env file.
Safety
- - Read-heavy: 18 of 31 tools are read-only (list, get, status, health, troubleshoot)
- Audit logging: All operations logged to
~/.vmware/audit.db (SQLite WAL, via vmware-policy) with timestamp, user, target, operation, parameters, and result - Double confirmation: CLI write commands require two separate confirmation prompts before executing
- Dry-run mode: All write commands support
--dry-run to preview API calls without executing - Dependency checks: Segment delete checks for connected ports; gateway delete checks for connected segments; prevents accidental cascade failures
- Input validation: CIDR networks validated, IP addresses checked, gateway existence verified before NAT/route operations
- Prompt injection defense: NSX object names returned from the API are sanitized via
_sanitize() — strips control characters, truncates to 500 chars - Credential safety: Passwords loaded only from environment variables (
.env file), never from INLINECODE75 - No firewall operations: Cannot create, modify, or delete DFW rules, security groups, or IDS/IPS policies — that scope belongs to INLINECODE76
Setup
CODEBLOCK4
All tools are automatically audited via vmware-policy. Audit logs: INLINECODE77
Full setup guide with multi-target config, MCP server setup, and Docker: see INLINECODE78
Architecture
CODEBLOCK5
The MCP server uses stdio transport (local only, no network listener). Connections to NSX Manager use HTTPS on port 443.
Audit & Safety
All operations are automatically audited via vmware-policy (@vmware_tool decorator):
- - Every tool call logged to
~/.vmware/audit.db (SQLite, framework-agnostic) - Policy rules enforced via
~/.vmware/rules.yaml (deny rules, maintenance windows, risk levels) - Risk classification: each tool tagged as low/medium/high/critical
- View recent operations: INLINECODE82
- View denied operations: INLINECODE83
vmware-policy is automatically installed as a dependency — no manual setup needed.
License
MIT — github.com/zw008/VMware-NSX
VMware NSX
VMware NSX 网络管理 — 31 个 MCP 工具,用于网段、网关、NAT、路由和 IPAM。
专注于 NSX-T / NSX 4.x Policy API 的网络技能。
配套技能: vmware-nsx-security (DFW/防火墙), vmware-aiops (虚拟机生命周期), vmware-monitor (只读监控), vmware-storage (iSCSI/vSAN), vmware-vks (Tanzu Kubernetes), vmware-aria (指标/告警/容量), vmware-avi (AVI/ALB/AKO)。
| vmware-pilot (工作流编排) | vmware-policy (审计/策略)
此技能的功能
| 类别 | 工具 | 数量 |
|---|
| 网段 | 列表、获取详情、创建、更新、删除、列出端口 | 6 |
| Tier-0 网关 |
列表、获取详情、BGP 邻居、路由表 | 4 |
|
Tier-1 网关 | 列表、获取详情、创建、更新、删除、路由表 | 6 |
|
NAT | 列出规则、获取规则详情、创建规则、更新规则、删除规则 | 5 |
|
静态路由 | 列表、创建、删除 | 3 |
|
IP 池 | 列表、获取分配、创建池、创建子网 | 4 |
|
健康与故障排除 | NSX 告警、传输节点状态、边缘集群状态、管理集群状态、逻辑端口状态、虚拟机到网段查询 | 6 |
总计: 31 个工具(18 个只读 + 13 个写入)
快速安装
bash
uv tool install vmware-nsx-mgmt
vmware-nsx doctor
何时使用此技能
- - 列出、创建或修改 NSX 网段(覆盖网络 / VLAN 支持)
- 创建或管理 Tier-0 / Tier-1 网关
- 配置 NAT 规则(SNAT、DNAT、反射)
- 查看或添加静态路由,检查 BGP 邻居
- 管理 IP 池和子网分配
- 检查 NSX 告警、传输节点健康、边缘集群状态
- 查找虚拟机连接到的网段
- 排查逻辑端口状态问题
配套技能用于:
- - 分布式防火墙、安全组、DFW 规则、IDS/IPS → vmware-nsx-security
- 虚拟机生命周期、部署、客户机操作 → vmware-aiops
- vSphere 清单、健康、告警、事件 → vmware-monitor
- 存储:iSCSI、vSAN、数据存储 → vmware-storage
- Tanzu Kubernetes → vmware-vks
- 负载均衡、AVI/ALB、AKO、Ingress → vmware-avi
相关技能 — 技能路由
| 用户意图 | 推荐技能 |
|---|
| NSX 网络:网段、网关、NAT、路由、IPAM | vmware-nsx ← 此技能 |
| NSX 安全:DFW 规则、安全组、IDS/IPS |
vmware-nsx-security |
| 只读 vSphere 监控、告警、事件 |
vmware-monitor |
| 虚拟机生命周期、部署、客户机操作 |
vmware-aiops |
| 存储:iSCSI、vSAN、数据存储 |
vmware-storage |
| Tanzu Kubernetes (vSphere 8.x+) |
vmware-vks |
| Aria Ops:指标、告警、容量规划 |
vmware-aria |
| 带审批的多步骤工作流 |
vmware-pilot |
| 负载均衡器、AVI、ALB、AKO、Ingress |
vmware-avi (uv tool install vmware-avi) |
| 审计日志查询 |
vmware-policy (vmware-audit CLI) |
常见工作流
创建应用网络(网段 + T1 网关 + NAT)
- 1. 创建 Tier-1 网关 → vmware-nsx gateway create-t1 app-t1 --edge-cluster edge-cluster-01 --tier0 tier0-gw
- 创建网段 → vmware-nsx segment create app-web-seg --gateway app-t1 --subnet <子网-cidr> --transport-zone tz-overlay
- 添加 SNAT 规则 → vmware-nsx nat create app-t1 --action SNAT --source <私有-cidr> --translated <公共-ip>
- 验证 → vmware-nsx segment list 和 vmware-nsx nat list app-t1
先试运行:在任何写入命令后附加 --dry-run 以预览而不执行:
bash
vmware-nsx segment create app-web-seg --gateway app-t1 --subnet <子网-cidr> --transport-zone tz-overlay --dry-run
检查网络健康
- 1. NSX 管理器集群状态 → vmware-nsx health manager-status
- 传输节点状态 → vmware-nsx health transport-nodes
- 边缘集群状态 → vmware-nsx health edge-clusters
- 活动告警 → vmware-nsx health alarms
- 如果发现问题,使用 vmware-monitor 调查 vSphere 端事件
排查虚拟机连接问题
- 1. 查找虚拟机的网段 → vmware-nsx troubleshoot vm-segment my-vm-01
- 检查逻辑端口状态 → vmware-nsx troubleshoot port-status <端口-id>
- 检查网关路由表 → vmware-nsx gateway routes-t1 app-t1
- 检查 T0 上的 BGP 邻居 → vmware-nsx gateway bgp-neighbors tier0-gw
- 审查 NAT 规则 → vmware-nsx nat list app-t1
多目标操作
所有命令接受 --target <名称> 参数,以针对配置中的特定 NSX 管理器进行操作:
bash
默认目标(config.yaml 中的第一个)
vmware-nsx segment list
特定目标
vmware-nsx segment list --target nsx-prod
vmware-nsx health alarms --target nsx-lab
使用模式
| 场景 | 推荐 | 原因 |
|---|
| 本地/小型模型(Ollama、Qwen) | CLI | 约 2K tokens vs MCP 约 8K |
| 云模型(Claude、GPT-4o) |
两者皆可 | MCP 提供结构化 JSON I/O |
| 自动化流水线 |
MCP | 类型安全参数、结构化输出 |
MCP 工具(31 个 — 18 个读取,13 个写入)
所有 MCP 工具接受可选的 target 参数,以选择要连接的 NSX 管理器。
| 类别 | 工具 | 类型 | 描述 |
|---|
| 网段 | listsegments | 读取 | 列出所有网段,包含类型、子网、网关、传输区域 |
|
getsegment | 读取 | 获取网段详情,包括端口和子网配置 |
| | create_segment | 写入 | 创建覆盖网络或 VLAN 网段,带子网和网关 |
| | update_segment | 写入 | 更新网段属性(描述、标签、DHCP) |
| | delete_segment | 写入 | 删除网段(先检查连接的端口) |
| | list
segmentports | 读取 | 列出网段上的逻辑端口及其状态 |
| Tier-0 网关 | list
tier0gateways | 读取 | 列出 Tier-0 网关,包含 HA 模式和边缘集群 |
| | get
tier0gateway | 读取 | 获取 Tier-0 详情:接口、路由配置、BGP |
| | get
tier0bgp_neighbors | 读取 | 列出 BGP 邻居会话,