@usex/mikrotik-mcp 5.19.0 → 5.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +172 -8
- package/dist/cli.js +2751 -679
- package/dist/index.js +148 -27
- package/dist/shared/{library-7wcv2ckk.js → library-73y8qdjr.js} +2231 -540
- package/dist/shared/{library-tqrvrykj.js → library-76naf20r.js} +1 -1
- package/dist/shared/{library-ppnv0f07.js → library-81amv3az.js} +1 -1
- package/dist/shared/{library-z7qsdq88.js → library-krajvnj9.js} +1 -1
- package/dist/shared/{library-f3be6g03.js → library-y9tt30y1.js} +1 -1
- package/dist/ui/aaa.html +8 -8
- package/dist/ui/connected-devices.html +8 -8
- package/dist/ui/dashboard.html +16 -16
- package/dist/ui/fabric.html +11 -11
- package/dist/ui/firewall-audit.html +8 -8
- package/dist/ui/firewall.html +9 -9
- package/dist/ui/interfaces.html +8 -8
- package/dist/ui/investigations.html +11 -11
- package/dist/ui/observability.html +63 -61
- package/dist/ui/operations.html +11 -11
- package/dist/ui/records.html +12 -12
- package/dist/ui/reports.html +11 -11
- package/dist/ui/round-trip.html +11 -11
- package/dist/ui/service-health.html +11 -11
- package/package.json +22 -22
- package/prompts/audit-routeros-containers.md +27 -0
- package/prompts/audit-vlan-segmentation.md +31 -0
- package/prompts/setup-guest-wifi.md +23 -24
- package/prompts/setup-routeros-container.md +36 -0
- package/prompts/setup-v2ray-container-proxy.md +68 -194
- package/prompts/setup-vlan-network.md +27 -33
- package/schemas/README.md +1 -1
- package/schemas/devtools-manifest.json +287 -16
- package/schemas/tool-catalog.json +785 -109
- package/schemas/tools/add_container.json +42 -30
- package/schemas/tools/add_container_env.json +3 -4
- package/schemas/tools/add_container_mount.json +10 -4
- package/schemas/tools/apply_service_routing.json +23 -0
- package/schemas/tools/arm_service_routing.json +23 -0
- package/schemas/tools/configure_flight_recorder.json +30 -0
- package/schemas/tools/create_service_routing.json +78 -0
- package/schemas/tools/design_network_segment.json +22 -6
- package/schemas/tools/destroy_recovery_lab.json +18 -0
- package/schemas/tools/export_network_incident.json +14 -0
- package/schemas/tools/freeze_network_incident.json +14 -0
- package/schemas/tools/get_container.json +11 -4
- package/schemas/tools/get_flight_recorder.json +7 -0
- package/schemas/tools/get_recovery_lab.json +7 -0
- package/schemas/tools/get_routeros_container_guide.json +22 -0
- package/schemas/tools/get_vlan_segmentation_guide.json +14 -0
- package/schemas/tools/list_container_envs.json +1 -1
- package/schemas/tools/list_container_mounts.json +7 -2
- package/schemas/tools/list_containers.json +2 -4
- package/schemas/tools/list_service_routing.json +7 -0
- package/schemas/tools/poll_recovery_lab.json +14 -0
- package/schemas/tools/prepare_recovery_lab.json +23 -0
- package/schemas/tools/preview_service_routing.json +23 -0
- package/schemas/tools/probe_service_routing.json +14 -0
- package/schemas/tools/recovery_lab_inventory.json +7 -0
- package/schemas/tools/remove_container.json +11 -4
- package/schemas/tools/remove_container_env.json +7 -3
- package/schemas/tools/remove_container_mount.json +18 -2
- package/schemas/tools/service_routing_inventory.json +7 -0
- package/schemas/tools/set_container_config.json +4 -6
- package/schemas/tools/start_container.json +11 -4
- package/schemas/tools/start_recovery_lab.json +18 -0
- package/schemas/tools/stop_container.json +11 -4
- package/schemas/tools/update_container.json +46 -6
- /package/dist/shared/{cli-j07tbrke.js → cli-426pkqe9.js} +0 -0
- /package/dist/shared/{cli-y00nwzxx.js → cli-6wdstvdq.js} +0 -0
- /package/dist/shared/{cli-s0rxncz4.js → cli-cvt06346.js} +0 -0
- /package/dist/shared/{cli-gtq5bw8q.js → cli-z1kavk0z.js} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@usex/mikrotik-mcp",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.20.0",
|
|
4
4
|
"description": "MCP server for MikroTik RouterOS — 780+ tools over SSH for firewall, NAT, routing, DHCP, DNS, WireGuard, wireless, QoS and more.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -90,12 +90,12 @@
|
|
|
90
90
|
"prepare": "vp config"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@modelcontextprotocol/client": "^2.
|
|
94
|
-
"@modelcontextprotocol/core": "^2.
|
|
95
|
-
"@modelcontextprotocol/ext-apps": "^2.0.
|
|
96
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
97
|
-
"@tikoci/centrs": "^0.1.
|
|
98
|
-
"figlet": "^1.
|
|
93
|
+
"@modelcontextprotocol/client": "^2.3.0",
|
|
94
|
+
"@modelcontextprotocol/core": "^2.3.0",
|
|
95
|
+
"@modelcontextprotocol/ext-apps": "^2.0.3",
|
|
96
|
+
"@modelcontextprotocol/sdk": "^1.32.0",
|
|
97
|
+
"@tikoci/centrs": "^0.1.7",
|
|
98
|
+
"figlet": "^1.12.0",
|
|
99
99
|
"gradient-string": "^3.0.0",
|
|
100
100
|
"ipaddr.js": "^2.5.0",
|
|
101
101
|
"ssh2": "^1.17.0",
|
|
@@ -103,38 +103,38 @@
|
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@anthropic-ai/mcpb": "^2.1.2",
|
|
106
|
-
"@devframes/hub": "1.
|
|
107
|
-
"@devframes/hub-ui": "1.
|
|
108
|
-
"@devframes/plugin-a11y": "1.
|
|
109
|
-
"@devframes/plugin-a11y--assets": "1.
|
|
110
|
-
"@devframes/plugin-data-inspector": "1.
|
|
111
|
-
"@devframes/plugin-data-inspector--assets": "1.
|
|
112
|
-
"@devframes/plugin-inspect": "1.
|
|
113
|
-
"@devframes/plugin-inspect--assets": "1.
|
|
114
|
-
"@devframes/vite": "1.
|
|
106
|
+
"@devframes/hub": "1.2.0",
|
|
107
|
+
"@devframes/hub-ui": "1.2.0",
|
|
108
|
+
"@devframes/plugin-a11y": "1.2.0",
|
|
109
|
+
"@devframes/plugin-a11y--assets": "1.2.0",
|
|
110
|
+
"@devframes/plugin-data-inspector": "1.2.0",
|
|
111
|
+
"@devframes/plugin-data-inspector--assets": "1.2.0",
|
|
112
|
+
"@devframes/plugin-inspect": "1.2.0",
|
|
113
|
+
"@devframes/plugin-inspect--assets": "1.2.0",
|
|
114
|
+
"@devframes/vite": "1.2.0",
|
|
115
115
|
"@paper-design/shaders-react": "^0.0.81",
|
|
116
116
|
"@resvg/resvg-js": "^2.6.2",
|
|
117
117
|
"@tailwindcss/vite": "^4.3.3",
|
|
118
118
|
"@tanstack/react-virtual": "^3.14.13",
|
|
119
119
|
"@types/bun": "1.4.2",
|
|
120
120
|
"@types/figlet": "^1.7.0",
|
|
121
|
-
"@types/node": "^26.6.
|
|
121
|
+
"@types/node": "^26.6.4",
|
|
122
122
|
"@types/react": "^19.3.0",
|
|
123
123
|
"@types/react-dom": "^19.3.0",
|
|
124
124
|
"@types/ssh2": "^1.15.6",
|
|
125
125
|
"@types/update-notifier": "^6.0.8",
|
|
126
126
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
127
|
-
"@vitest/coverage-v8": "5.0.
|
|
128
|
-
"@vitest/ui": "5.0.
|
|
127
|
+
"@vitest/coverage-v8": "5.0.3",
|
|
128
|
+
"@vitest/ui": "5.0.3",
|
|
129
129
|
"bunup": "^0.16.32",
|
|
130
130
|
"class-variance-authority": "^0.7.1",
|
|
131
131
|
"clsx": "^2.1.1",
|
|
132
|
-
"devframe": "1.
|
|
132
|
+
"devframe": "1.2.0",
|
|
133
133
|
"gsap": "^3.15.0",
|
|
134
134
|
"happy-dom": "^20.14.5",
|
|
135
135
|
"lenis": "^1.3.26",
|
|
136
136
|
"license-checker": "^25.0.1",
|
|
137
|
-
"lucide-react": "^1.
|
|
137
|
+
"lucide-react": "^1.51.0",
|
|
138
138
|
"motion": "^13.4.4",
|
|
139
139
|
"qrcode-generator": "^2.0.4",
|
|
140
140
|
"radix-ui": "^1.6.7",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
"react-dom": "^19.3.0",
|
|
143
143
|
"recharts": "^3.10.1",
|
|
144
144
|
"release-it": "^21.1.0",
|
|
145
|
-
"shiki": "^4.
|
|
145
|
+
"shiki": "^4.5.0",
|
|
146
146
|
"sonner": "^2.0.8",
|
|
147
147
|
"tailwind-merge": "^3.7.0",
|
|
148
148
|
"tailwindcss": "^4.3.3",
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audit-routeros-containers
|
|
3
|
+
title: Audit RouterOS container readiness and isolation
|
|
4
|
+
description: Read-only container architecture, storage, lifecycle, network policy and security audit with an evidence-based cleanup plan.
|
|
5
|
+
arguments:
|
|
6
|
+
- name: device
|
|
7
|
+
description: Exact configured router; omit to discover and ask.
|
|
8
|
+
required: false
|
|
9
|
+
- name: requirements
|
|
10
|
+
description: Intended workloads, trusted clients and restrictions.
|
|
11
|
+
required: false
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
Audit {{device}} against the shared container guide below. Requirements: {{requirements}}.
|
|
15
|
+
This is READ-ONLY: no package installation, device-mode updates, container restart,
|
|
16
|
+
network changes, disk formatting or file deletion. Any implementation needs separate approval.
|
|
17
|
+
|
|
18
|
+
Resolve the device exactly. Inventory architecture/version/package/device-mode,
|
|
19
|
+
resource headroom, disks, container metadata/status, VETHs, bridge/VLAN membership,
|
|
20
|
+
IPv4/IPv6 routes, firewall and NAT. Inspect env KEY metadata, never values.
|
|
21
|
+
Use bounded filtered reads. Separate unsupported menus, failed transport and unknown state.
|
|
22
|
+
|
|
23
|
+
Produce a prioritized table: finding, observed evidence, affected workload, risk,
|
|
24
|
+
recommended change, backup/recovery requirements and verification. Distinguish
|
|
25
|
+
readiness, process running and application health. Flag shared lists/volumes,
|
|
26
|
+
management-path dependencies and physical/reboot steps. Do not claim benchmarks
|
|
27
|
+
or successful client tests without measurements. Offer a staged plan, not automatic cleanup.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: audit-vlan-segmentation
|
|
3
|
+
title: Audit VLAN isolation and migration readiness
|
|
4
|
+
description: Read-only topology, IPv4/IPv6 isolation and management-path review with a prioritized cleanup plan; never applies changes.
|
|
5
|
+
arguments:
|
|
6
|
+
- name: requirements
|
|
7
|
+
description: Desired zones, allowed services, remote sites and constraints. If omitted, discover facts and ask about policy rather than inventing it.
|
|
8
|
+
required: false
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
Audit VLAN segmentation on the explicitly selected device. Requirements: {{requirements}}
|
|
12
|
+
This workflow is READ-ONLY. Do not create backups on routers, start/verify transactions,
|
|
13
|
+
change configuration, enable filtering, write memory, or run disruptive load tests.
|
|
14
|
+
|
|
15
|
+
Use bounded dedicated read tools discovered with `find_tools`. If another managed
|
|
16
|
+
router is in scope, resolve and inspect it separately; otherwise report its
|
|
17
|
+
dependencies as unknown. Never substitute the default router for an unknown name.
|
|
18
|
+
|
|
19
|
+
Produce:
|
|
20
|
+
|
|
21
|
+
1. Observed topology: port roles, VLAN/PVID/CPU map, SSIDs, subnets, IPv6 and tunnels.
|
|
22
|
+
2. Intended vs observed IPv4/IPv6 INPUT/FORWARD policy, including shadowed rules,
|
|
23
|
+
management exposure, guest peers and remote return routing. Mark unsupported,
|
|
24
|
+
incomplete or timed-out evidence unknown; static policy analysis is not a live test.
|
|
25
|
+
3. Prioritized findings with evidence, risk, affected devices, proposed correction,
|
|
26
|
+
dependency/lockout impact, rollback requirements and a concrete acceptance test.
|
|
27
|
+
4. A staged migration and cleanup proposal, separating necessary fixes, optional
|
|
28
|
+
improvements and choices that need the operator. Never assume disabled means unused.
|
|
29
|
+
5. Known limits: what could not be verified from actual wired/wireless clients.
|
|
30
|
+
|
|
31
|
+
Stop with the report. Any future implementation needs separate approval.
|
|
@@ -14,32 +14,31 @@ arguments:
|
|
|
14
14
|
required: true
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
Plan an **isolated guest network** on the explicitly selected MikroTik device.
|
|
18
|
+
Guests may use approved internet/services, but not local devices or administration.
|
|
19
|
+
Start read-only, show the complete plan and request approval before any writes.
|
|
20
20
|
|
|
21
21
|
Guest subnet: {{subnet}}
|
|
22
22
|
Guest VLAN ID: {{vlan_id}}
|
|
23
23
|
WAN interface: {{wan_interface}}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
4.
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
executing anything.
|
|
25
|
+
1. Discover port roles, AP VLAN support and Wi-Fi package, bridge membership,
|
|
26
|
+
existing addressing, policy routing and IPv4/IPv6 firewall order with `find_tools`.
|
|
27
|
+
2. Plan the SSID-to-VLAN mapping on AP and uplink, access PVID/admission, trunk
|
|
28
|
+
membership and bridge/CPU gateway access. Without VLANs, require a genuinely
|
|
29
|
+
separate L2 interface/bridge; a second subnet on the same LAN is not isolation.
|
|
30
|
+
3. Check subnet overlap and assign a valid gateway/pool excluding reserved hosts.
|
|
31
|
+
Identify working DNS and egress. Reuse existing NAT where appropriate; never
|
|
32
|
+
add unscoped masquerade. NAT does not allow traffic through a forward firewall.
|
|
33
|
+
4. Plan INPUT management protection and FORWARD isolation in BOTH IPv4 and IPv6.
|
|
34
|
+
RFC1918-only drops miss local public addresses, remote/VPN subnets and IPv6.
|
|
35
|
+
Scope essential DHCP/DNS/ICMPv6 allowances; put approved service exceptions
|
|
36
|
+
before denies and denies before conflicting broad accepts. Do not blindly append.
|
|
37
|
+
5. Treat guest-to-guest isolation as an additional AP/switch requirement. Prove
|
|
38
|
+
it separately; routed rules cannot prevent all same-VLAN communication.
|
|
39
|
+
6. Show exact changes, an independent recovery path and backup/rollback plan.
|
|
40
|
+
After approval only, stage under the suitable safe execution workflow, enable
|
|
41
|
+
VLAN filtering LAST and canary one client before migrating everyone.
|
|
42
|
+
7. Test DHCP, DNS, allowed internet, denied local/management access and guest peer
|
|
43
|
+
isolation from actual clients over both families. Read-back alone is insufficient.
|
|
44
|
+
Commit only if verification succeeds and the approval covers this exact change.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-routeros-container
|
|
3
|
+
title: Plan and safely deploy a RouterOS container
|
|
4
|
+
description: Version-aware image, storage, isolated VETH network and lifecycle workflow with explicit approval and application verification.
|
|
5
|
+
arguments:
|
|
6
|
+
- name: device
|
|
7
|
+
description: Exact configured router; omit to discover and ask.
|
|
8
|
+
required: false
|
|
9
|
+
- name: image
|
|
10
|
+
description: Reviewed image and pinned version/digest, or uploaded image archive.
|
|
11
|
+
required: false
|
|
12
|
+
- name: requirements
|
|
13
|
+
description: Application, client access, ports, persistent data and downtime constraints.
|
|
14
|
+
required: false
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
Target {{device}}; image {{image}}; requirements {{requirements}}.
|
|
18
|
+
Start with READ-ONLY discovery following the shared container guide. Ask for
|
|
19
|
+
missing workload/access requirements. Verify architecture, package/device-mode,
|
|
20
|
+
storage, syntax and resources before proposing any command.
|
|
21
|
+
|
|
22
|
+
Prepare an explicit plan with image trust, volume backup, dedicated VETH/bridge or
|
|
23
|
+
VLAN, dual-stack allowed-flow matrix, positive WAN egress, shared-list consumers,
|
|
24
|
+
management preservation and recovery. No changes until the operator approves it.
|
|
25
|
+
Package/reboot/physical-confirmation steps require separate approval and scheduling.
|
|
26
|
+
|
|
27
|
+
Use describe_tool for the actual schema, including list vs legacy name and
|
|
28
|
+
envlists vs envlist. Do not guess a modern inline mount expression from Docker
|
|
29
|
+
examples. Keep secrets outside reports and Memory. Back up approved router changes
|
|
30
|
+
and application volumes separately; Safe Mode is not filesystem rollback.
|
|
31
|
+
|
|
32
|
+
After an approved add, poll a bounded number of times until fully stopped, then
|
|
33
|
+
start the exact .id. If a command times out, inspect before retrying. Test the
|
|
34
|
+
service from an intended client, deny an unintended source, and check both IP
|
|
35
|
+
families. Only then enable start-on-boot if approved. Report every pending/unknown
|
|
36
|
+
check; do not perform a reboot merely to test persistence without permission.
|
|
@@ -1,207 +1,81 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: setup-v2ray-container-proxy
|
|
3
|
-
title:
|
|
4
|
-
description:
|
|
3
|
+
title: Plan a V2Ray/Xray or sing-box container gateway on RouterOS
|
|
4
|
+
description: Audit prerequisites, then plan an isolated proxy container with explicit approval, dual-stack policy, bounded lifecycle checks and end-to-end verification.
|
|
5
5
|
arguments:
|
|
6
6
|
- name: device
|
|
7
|
-
description:
|
|
7
|
+
description: Exact configured router; omit to discover and ask.
|
|
8
8
|
required: false
|
|
9
9
|
- name: protocol
|
|
10
|
-
description:
|
|
10
|
+
description: Desired protocol supported by the selected image and remote server.
|
|
11
11
|
required: false
|
|
12
12
|
- name: image
|
|
13
|
-
description:
|
|
13
|
+
description: Reviewed architecture-compatible image and pinned version/digest.
|
|
14
14
|
required: false
|
|
15
15
|
- name: scope
|
|
16
|
-
description:
|
|
16
|
+
description: Selective destinations or all traffic for explicitly selected clients.
|
|
17
17
|
required: false
|
|
18
18
|
---
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
(e.g. `gritsenko/xray-mikrotik`) bundle **xray-core + tun2socks** so the
|
|
83
|
-
container's VETH acts directly as a routable gateway — simplest. Otherwise the
|
|
84
|
-
**two-container** pattern (below) is the general form. **Read the specific image's
|
|
85
|
-
README for its exact env-var names** — they differ per image; do not assume.
|
|
86
|
-
- **RouterOS local-import caveat:** `add_container remote_image=` pulls from a
|
|
87
|
-
registry (needs `set_container_config registry-url=... tmpdir=disk1/pull` and
|
|
88
|
-
internet). A local `.tar` must be **single-layer, uncompressed, Docker-v1** — most
|
|
89
|
-
people pull from a registry.
|
|
90
|
-
|
|
91
|
-
## 2. Two deployment shapes (pick one, explain to the user)
|
|
92
|
-
|
|
93
|
-
**A — All-in-one image (recommended, simplest).** One container running xray-core +
|
|
94
|
-
tun2socks. Its VETH IP becomes the gateway you route through. Example env schema
|
|
95
|
-
(gritsenko/xray-mikrotik — verify against the image):
|
|
96
|
-
`SERVER_ADDRESS`, `SERVER_PORT`, `USER_ID`, `ENCRYPTION`, `FINGERPRINT_FP`,
|
|
97
|
-
`SERVER_NAME_SNI`, `PUBLIC_KEY_PBK`, `SHORT_ID_SID`.
|
|
98
|
-
|
|
99
|
-
**B — Two-container (general, more control).** Container 1 = xray-core exposing a
|
|
100
|
-
**SOCKS5** inbound (e.g. `172.17.0.2:1080`); Container 2 = **tun2socks /
|
|
101
|
-
hev-socks5-tunnel** turning that SOCKS5 into a routable gateway on its own VETH.
|
|
102
|
-
Typical env — xray: `REMOTE_ADDRESS,REMOTE_PORT,ID,FLOW,PUBLIC_KEY,SHORT_ID,
|
|
103
|
-
SERVER_NAME`; tun: `SOCKS5_ADDR=172.17.0.2,SOCKS5_PORT=1080,LOCAL_ROUTE` (so LAN
|
|
104
|
-
subnets return via the router, not the tunnel). _Note: original tun2socks has arm64
|
|
105
|
-
issues — use an arm64-built image._
|
|
106
|
-
|
|
107
|
-
## 3. Container networking (VETH + NAT + DNS)
|
|
108
|
-
|
|
109
|
-
There is **no dedicated VETH tool** — create it with `run_routeros_command`
|
|
110
|
-
(approve each raw command). Example for shape A on a /30:
|
|
111
|
-
|
|
112
|
-
- `/interface veth add name=veth-xray address=172.18.20.6/30 gateway=172.18.20.5`
|
|
113
|
-
- `add_ip_address` `address=172.18.20.5/30 interface=veth-xray` (router side).
|
|
114
|
-
- `create_nat_rule` `chain=srcnat action=masquerade out-interface=veth-xray` (so the
|
|
115
|
-
container reaches the internet / the remote server).
|
|
116
|
-
- Container `dns` = the router's veth IP (`172.18.20.5`) or a resolver you trust.
|
|
117
|
-
(Shape B: put both VETHs on a `containers` bridge, `172.17.0.1/24` gateway.)
|
|
118
|
-
|
|
119
|
-
## 4. Create and start the container
|
|
120
|
-
|
|
121
|
-
- If pulling from a registry: `set_container_config` `registry-url=https://registry-1.docker.io tmpdir=disk1/pull`.
|
|
122
|
-
- Env vars: either inline via `add_container` `env="SERVER_ADDRESS=...,USER_ID=..."`
|
|
123
|
-
(7.21+) or as a named list with `add_container_env` (`envlists=`). **Mask the
|
|
124
|
-
secret values in anything you print back.**
|
|
125
|
-
- `add_container` (`device=<name>`) — `remote_image={{image}}`, `interface=veth-xray`,
|
|
126
|
-
`root_dir=disk1/xray`, `dns=172.18.20.5`, `logging=yes`, `start_on_boot=yes`,
|
|
127
|
-
`hostname=xray`, and the env.
|
|
128
|
-
- `start_container`; then `get_container` / `list_containers` until it shows
|
|
129
|
-
**running**, and read startup output with the container-log (it must show a
|
|
130
|
-
successful outbound handshake to your server before routing anything through it).
|
|
131
|
-
|
|
132
|
-
## 5. Route traffic through the tunnel
|
|
133
|
-
|
|
134
|
-
**Selective (`scope=selective`, recommended)** — only chosen destinations go through
|
|
135
|
-
the proxy; everything else uses the normal WAN (fast, low-risk, defeats geo-blocks
|
|
136
|
-
for the sites that need it):
|
|
137
|
-
|
|
138
|
-
1. `add_address_list_entry` — build a list `via_proxy` of the domains/IPs to tunnel
|
|
139
|
-
(RouterOS resolves domain entries to IPs automatically).
|
|
140
|
-
2. `add_routing_table` — `name=proxy fib`.
|
|
141
|
-
3. `create_mangle_rule` — `chain=prerouting action=mark-routing
|
|
142
|
-
new-routing-mark=proxy dst-address-list=via_proxy passthrough=no`
|
|
143
|
-
(add `src-address=<LAN>` to scope to LAN clients; exclude the router's own/ the
|
|
144
|
-
container subnet to avoid loops).
|
|
145
|
-
4. `add_route` — `dst-address=0.0.0.0/0 gateway=172.18.20.6 routing-table=proxy`
|
|
146
|
-
(gateway = the container's VETH IP, shape A; the tun container's IP, shape B).
|
|
147
|
-
|
|
148
|
-
**All traffic (`scope=all`)** — default route via the tunnel. Same routing table but
|
|
149
|
-
mark all LAN traffic (or set the container gateway as the main default). **Mandatory
|
|
150
|
-
kill-switch:** add a low-priority `forward` **drop** for the LAN when the tunnel
|
|
151
|
-
interface is down, so a container crash can't silently leak traffic out the clear
|
|
152
|
-
WAN. Also pin a **higher-priority route to the remote server's IP via the real WAN**
|
|
153
|
-
so the tunnel's own packets don't recurse into itself.
|
|
154
|
-
|
|
155
|
-
## 6. DNS-leak & MTU handling
|
|
156
|
-
|
|
157
|
-
- **DNS leaks:** if clients query a public resolver directly, the destination is
|
|
158
|
-
exposed even though the payload is tunnelled. Redirect LAN DNS (dst-nat UDP/TCP 53
|
|
159
|
-
to the router or the container's resolver) so lookups for proxied domains resolve
|
|
160
|
-
through the tunnel, or run the resolver inside/behind the container.
|
|
161
|
-
- **MTU/MSS:** encapsulation shrinks usable MTU — add a `create_mangle_rule`
|
|
162
|
-
`chain=forward action=change-mss new-mss=clamp-to-pmtu tcp-flags=syn` (and/or lower
|
|
163
|
-
the veth MTU). This is the #1 "handshake works, big pages hang" cause.
|
|
164
|
-
|
|
165
|
-
## 7. Firewall — safely
|
|
166
|
-
|
|
167
|
-
Under Safe Mode (`enable_safe_mode` `device=<name>` → edits → verify →
|
|
168
|
-
`commit_safe_mode`): allow the container subnet outbound, keep the masquerade from
|
|
169
|
-
step 3, and (scope=all) install the kill-switch drop. Do not expose the container's
|
|
170
|
-
SOCKS5 port to the WAN.
|
|
171
|
-
|
|
172
|
-
## 8. Verify end to end
|
|
173
|
-
|
|
174
|
-
- `get_container` shows **running**; the container log shows a completed handshake to
|
|
175
|
-
your server (no repeated dial errors).
|
|
176
|
-
- From a **marked** LAN source, check the **egress IP** changed: fetch an "what is my
|
|
177
|
-
IP" service from a proxied client (or `run_routeros_command` a `/tool fetch` bound
|
|
178
|
-
to the proxy path) — it should show the **VPS** IP, not the local WAN IP.
|
|
179
|
-
- Confirm a **non-proxied** destination still exits the normal WAN (selective scope).
|
|
180
|
-
- `ping`/`traceroute` a proxied target; test a large HTTPS page (MTU sanity).
|
|
181
|
-
- Reboot-persistence: `start_on_boot=yes` and the routing rules survive a reboot.
|
|
182
|
-
|
|
183
|
-
## 9. Family notes, hardening & honest caveats
|
|
184
|
-
|
|
185
|
-
- **VLESS + Reality**: no cert/domain needed; set a believable `SERVER_NAME_SNI`
|
|
186
|
-
(a real, unrelated HTTPS site the censor won't block) and matching public-key/
|
|
187
|
-
short-id from the server. Strongest default against active-probing DPI.
|
|
188
|
-
- **VMess/Trojan/Shadowsocks**: pair with TLS/WebSocket/gRPC transports on 443 for
|
|
189
|
-
camouflage; plain Shadowsocks is weaker against modern DPI.
|
|
190
|
-
- **Hysteria2/TUIC** (sing-box image): QUIC/UDP — great on lossy or throttled links,
|
|
191
|
-
but blocked where UDP is throttled.
|
|
192
|
-
- **Trust**: you are running a third-party image with your keys and all your traffic.
|
|
193
|
-
Prefer images you can inspect/build; pin a digest; keep it updated.
|
|
194
|
-
- **Reality/DPI is an arms race** — never present it as a guarantee. Keep a fallback
|
|
195
|
-
(a second protocol/port, or an SSTP/OpenVPN-443 transport per
|
|
196
|
-
`setup-sstp-tunnel-between-sites`).
|
|
197
|
-
- **Resource reality**: containers are RAM/CPU/disk heavy on small routers; on very
|
|
198
|
-
low-end boards run the client on a VPS/box and point the router at it instead.
|
|
199
|
-
|
|
200
|
-
---
|
|
201
|
-
|
|
202
|
-
Report: device, architecture, image + protocol, VETH/NAT, container status, the
|
|
203
|
-
routing-table + mangle + route rules and the address-list scope, DNS/MTU/kill-switch
|
|
204
|
-
handling, and the verification results (egress-IP proof) — with **all secrets
|
|
205
|
-
masked**, and a note of every `run_routeros_command` step used (VETH, device-mode).
|
|
206
|
-
Flag the physical device-mode step and any reboot explicitly. Never apply changes the
|
|
207
|
-
user hasn't approved.
|
|
20
|
+
Plan a lawful, authorized proxy deployment on {{device}}.
|
|
21
|
+
Protocol: {{protocol}}. Image: {{image}}. Client routing scope: {{scope}}.
|
|
22
|
+
Start READ-ONLY. Use the shared container guide below as the safety baseline.
|
|
23
|
+
An audit or a request for advice is not permission to change router configuration.
|
|
24
|
+
|
|
25
|
+
## Discover and choose
|
|
26
|
+
|
|
27
|
+
Resolve the exact device. Inspect version/architecture/CPU variant, container
|
|
28
|
+
package, device-mode, storage and available resources. A command failure is not
|
|
29
|
+
proof the package is missing. Treat unknown prerequisites as blockers to writes.
|
|
30
|
+
Enabling container=yes needs operator physical confirmation; do not change the
|
|
31
|
+
whole device-mode or silently install packages, reboot, format or Netinstall.
|
|
32
|
+
Inspect existing management, LAN/VPN, IPv4/IPv6 policy and other containers first.
|
|
33
|
+
|
|
34
|
+
Ask for the remote server, protocol, intended clients and access constraints.
|
|
35
|
+
Verify the image publisher, protocol documentation, required env KEY names,
|
|
36
|
+
architecture/variant, privilege/device requirements and pinned image identity.
|
|
37
|
+
Never promise DPI evasion or speed improvement. Keep credentials out of reports.
|
|
38
|
+
|
|
39
|
+
A SOCKS5 proxy alone cannot serve as an IP gateway. An all-in-one TUN image or
|
|
40
|
+
an explicitly designed proxy plus TUN gateway can do so only if IP forwarding,
|
|
41
|
+
return routes and startup ordering are verified. Do not assume eth0 inside the
|
|
42
|
+
image. Discover available tools with find_tools/describe_tool before raw commands.
|
|
43
|
+
|
|
44
|
+
## Plan, approve and protect
|
|
45
|
+
|
|
46
|
+
Show the complete plan and obtain approval before writes. Back up approved router
|
|
47
|
+
configuration AND application data; eligible Safe Mode rollback does not restore
|
|
48
|
+
container images, files or volumes. Agree an independent recovery path.
|
|
49
|
+
|
|
50
|
+
Use a dedicated container bridge/VLAN and verified non-overlapping subnet.
|
|
51
|
+
Assign the router gateway to that bridge and a distinct address to the VETH.
|
|
52
|
+
Do not assign the same IP to both ends or add containers to trusted LAN by default.
|
|
53
|
+
Container internet source NAT, if needed, uses its source subnet and the positive
|
|
54
|
+
real WAN egress, not out-interface=veth. Restrict published ports by source,
|
|
55
|
+
destination and ingress; never expose an unauthenticated SOCKS/admin listener.
|
|
56
|
+
|
|
57
|
+
For selective routing, explicitly scope clients/destinations and exclude router
|
|
58
|
+
management, container traffic and the remote server to avoid loops. Preserve the
|
|
59
|
+
remote server route through the real WAN and the return path to LAN/VPN clients.
|
|
60
|
+
For all-traffic routing, design fail-closed behavior for both IP families, including
|
|
61
|
+
existing connections, rule ordering and FastTrack. A low-priority drop after broad
|
|
62
|
+
accepts is not a kill switch. Do not silently replace the router's main default.
|
|
63
|
+
|
|
64
|
+
## Deploy and verify, only after approval
|
|
65
|
+
|
|
66
|
+
Use the target's verified env/mount syntax; current list=/envlists/mountlists and
|
|
67
|
+
legacy name=/envlist/mounts are not interchangeable. Protect secrets in inputs.
|
|
68
|
+
Add exactly one image source and a unique name, VETH and dedicated root path.
|
|
69
|
+
After add, poll with a deadline for positive fully-stopped evidence before start.
|
|
70
|
+
Use the fresh stable .id. A timeout may have applied: inspect before retrying.
|
|
71
|
+
|
|
72
|
+
Confirm process state, sanitized application handshake and health separately.
|
|
73
|
+
Test DNS/IPv4/IPv6 egress from a representative selected LAN client, not only
|
|
74
|
+
router-originated fetch. Verify an unselected client remains on its intended path
|
|
75
|
+
and unauthorized access is denied. Test the approved failure scenario without
|
|
76
|
+
disrupting unrelated clients. Measure PMTU before MTU/MSS changes; do not assume
|
|
77
|
+
encapsulation is the only cause of a stalled download.
|
|
78
|
+
|
|
79
|
+
Enable start-on-boot only after checks and approval. Schedule a reboot test
|
|
80
|
+
separately. Report applied changes, observed results, pending/unknown tests and
|
|
81
|
+
recovery steps with secrets masked; no claim of success from running alone.
|
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: setup-vlan-network
|
|
3
|
-
title: Design
|
|
4
|
-
description:
|
|
3
|
+
title: Design a safe dual-stack VLAN migration
|
|
4
|
+
description: Audit the existing topology and plan VLAN ports, SSIDs, management access, IPv4/IPv6 policy and staged verification before any approved change.
|
|
5
5
|
arguments:
|
|
6
6
|
- name: vlans
|
|
7
7
|
description: Describe the VLANs you need — e.g. "management=10, staff=20, IoT=30, guest=40" (name=VLAN-ID).
|
|
8
8
|
required: true
|
|
9
9
|
- name: trunk_interface
|
|
10
|
-
description:
|
|
10
|
+
description: Optional proposed physical trunk. If omitted, discover and confirm the port map; never assume a bridge or WAN port is the trunk.
|
|
11
11
|
required: false
|
|
12
12
|
---
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
are previewed before applying.
|
|
14
|
+
Plan a VLAN-segmented network on the explicitly selected MikroTik device.
|
|
15
|
+
Start read-only. A design request is NOT permission to apply it.
|
|
17
16
|
|
|
18
17
|
VLANs requested: {{vlans}}
|
|
19
18
|
Trunk interface: {{trunk_interface}}
|
|
20
19
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
`list_ip_addresses` for gateway IPs, `list_dhcp_servers` for DHCP, and
|
|
44
|
-
`list_filter_rules` for the isolation firewall rules.
|
|
45
|
-
|
|
46
|
-
Report the complete VLAN map and any follow-ups (e.g. switch port VLAN
|
|
47
|
-
assignments, wireless SSID-to-VLAN mappings).
|
|
20
|
+
1. Discover the current bridge, ports, CPU membership, Wi-Fi package/SSID mapping,
|
|
21
|
+
addresses, DHCP, IPv6, both firewall families and routing dependencies using
|
|
22
|
+
`find_tools`. Resolve management/recovery access and ambiguous port roles first.
|
|
23
|
+
2. Present a per-device VLAN map: role, ID, subnet, gateway, DHCP pool, IPv6 /64,
|
|
24
|
+
SSID, access ports/PVIDs, allowed trunk VLANs and bridge/CPU membership. Do not
|
|
25
|
+
allocate conflicting subnets or assume every role needs its own VLAN.
|
|
26
|
+
3. Show an IPv4/IPv6 INPUT and FORWARD service matrix and exact rule placement.
|
|
27
|
+
Include remote-site return routes and VPN allowed-addresses only if affected.
|
|
28
|
+
Flag policy routing, NAT, FastTrack, queues and scripts tied to old interfaces.
|
|
29
|
+
4. Present ordered steps, prerequisites, backup/rollback and canary tests. Enable
|
|
30
|
+
filtering LAST; do not disable existing filtering during migration. Do not
|
|
31
|
+
silently renumber the working LAN or expose management to every trusted client.
|
|
32
|
+
5. `design_network_segment` may preview partial IPv4 scaffolding only. It is NOT
|
|
33
|
+
a full migration or isolation engine. Discover its schema and account for all
|
|
34
|
+
omitted L2/SSID/INPUT/IPv6/routing work; do not apply it once per VLAN blindly.
|
|
35
|
+
6. Stop for approval of the exact changes. For approved dependent multi-router
|
|
36
|
+
writes, use the coordinated transaction workflow if available and suitable.
|
|
37
|
+
Never run transaction verification during a read-only audit: it performs writes.
|
|
38
|
+
7. After approved changes, read back and test real wired and wireless clients for
|
|
39
|
+
intended allows AND denies over both families. List unverified tests explicitly;
|
|
40
|
+
configuration creation alone is not proof of isolation. Clean up only after
|
|
41
|
+
validation and dependency review, with separate approval for removals.
|