Skip to content

Commit e2e607f

Browse files
committed
refactor(vmm): remove built-in port forwarding
Signed-off-by: Kevin Wang <wy721@qq.com>
1 parent 3a59763 commit e2e607f

19 files changed

Lines changed: 8 additions & 939 deletions

File tree

docs/bridge-networking.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,6 @@ sudo sysctl -p /etc/sysctl.d/99-dstack-bridge.conf
9090
sudo apt install -y dnsmasq
9191
```
9292

93-
Install the DHCP notification script (notifies VMM when a VM gets an IP so port forwarding can be established):
94-
95-
```bash
96-
sudo cp dstack/scripts/dhcp-notify.sh /usr/local/bin/dhcp-notify.sh
97-
sudo chmod +x /usr/local/bin/dhcp-notify.sh
98-
```
99-
10093
Create dnsmasq config:
10194

10295
```ini
@@ -106,11 +99,8 @@ bind-interfaces
10699
dhcp-range=10.0.100.10,10.0.100.254,255.255.255.0,12h
107100
dhcp-option=option:router,10.0.100.1
108101
dhcp-option=option:dns-server,8.8.8.8,1.1.1.1
109-
dhcp-script=/usr/local/bin/dhcp-notify.sh
110102
```
111103

112-
The `dhcp-script` option tells dnsmasq to call the notification script on every lease event. The script sends the MAC and IP to VMM's `ReportDhcpLease` RPC, which triggers automatic port forwarding for the VM.
113-
114104
```bash
115105
sudo systemctl restart dnsmasq
116106
```
@@ -172,8 +162,7 @@ sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper
172162
- VMM passes `-netdev bridge,id=net0,br=<bridge>` to QEMU
173163
- QEMU's bridge helper (setuid) creates a TAP device and attaches it to the bridge
174164
- Guest MAC address is derived from SHA256 of the VM ID, with an optional configurable prefix (stable across restarts for DHCP IP consistency)
175-
- The host DHCP server (dnsmasq) assigns an IP and calls `dhcp-notify.sh`, which notifies VMM via the `ReportDhcpLease` RPC
176-
- VMM matches the MAC address to identify the VM and establishes port forwarding rules
165+
- The host DHCP server (dnsmasq) assigns an IP to the VM
177166
- When QEMU exits, the TAP device is automatically destroyed
178167
- VMM does not need root or `CAP_NET_ADMIN`
179168

dstack/Cargo.lock

Lines changed: 0 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dstack/Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ members = [
6161
"dstack-mr/cli",
6262
"verifier",
6363
"size-parser",
64-
"port-forward",
6564
"crates/dstack-cli-core",
6665
"crates/dstack-cli",
6766
"crates/dstackup",
@@ -78,7 +77,6 @@ dstack-kms-rpc = { path = "kms/rpc" }
7877
dstack-guest-agent-rpc = { path = "guest-agent/rpc" }
7978
dstack-vmm-rpc = { path = "vmm/rpc" }
8079
dstack-cli-core = { path = "crates/dstack-cli-core" }
81-
dstack-port-forward = { path = "port-forward" }
8280
cc-eventlog = { path = "cc-eventlog" }
8381
supervisor = { path = "supervisor" }
8482
supervisor-client = { path = "supervisor/client" }

dstack/crates/dstack-cli-core/src/config.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,6 @@ mode = "user"
352352
net = "10.0.2.0/24"
353353
dhcp_start = "10.0.2.10"
354354
restrict = false
355-
forward_service_enabled = false
356355
357356
[cvm.port_mapping]
358357
enabled = true

dstack/port-forward/Cargo.toml

Lines changed: 0 additions & 18 deletions
This file was deleted.

dstack/port-forward/src/lib.rs

Lines changed: 0 additions & 137 deletions
This file was deleted.

0 commit comments

Comments
 (0)