---
title: "WireGuard at Modal: Static IPs for serverless containers"
description: "Modal built vprox, a high-availability Go VPN proxy on WireGuard, to give multi-tenant serverless containers static outbound IPv4 addresses for things like database IP allowlists."
url: "https://swe.quest/articles/wireguard-at-modal-static-ips-for-serverless-containers-f9b6b3f9bd58963d"
canonical: "https://modal.com/blog/vprox"
source: "Modal"
published: "2024-12-02"
difficulty: "hard"
kind: "Case study"
reading_minutes: 14
tags: ["networking","linux","serverless","go","multi-tenancy"]
---

# WireGuard at Modal: Static IPs for serverless containers

A post on [Modal](https://swe.quest/sources/modal.md), published 2024-12-02, 14 min read, Case study. Original: [https://modal.com/blog/vprox](https://modal.com/blog/vprox)

## Summary

Modal built vprox, a high-availability Go VPN proxy on WireGuard, to give multi-tenant serverless containers static outbound IPv4 addresses for things like database IP allowlists. An earlier SOCKS5 approach broke with libraries that don't use the standard socket module, so Modal moved to Layer 3: clients get WireGuard keys and IPs over an HTTPS connect endpoint, idle peers are reaped by last-handshake time, and clients re-register when ping probes fail. Per-container traffic is steered through Linux policy-based routing with a dedicated routing table per container, because an eBPF xdp\_redirect approach bypassed netfilter and broke SNAT. Each proxy node hosts many IPs (up to 240 on an AWS c7gn.8xlarge, under $0.01/hr per IP). A reconciliation loop watches cloud instance metadata so IPs can be moved between nodes for failover within seconds.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)
- [Linux](https://swe.quest/tags/linux.md) (Infrastructure)
- [Serverless](https://swe.quest/tags/serverless.md) (Backend & APIs)
- [Go](https://swe.quest/tags/go.md) (Languages)
- [Multi-tenancy](https://swe.quest/tags/multi-tenancy.md) (Architecture & design)

## Prerequisites

- Linux networking and routing tables ([easy posts on Linux](https://swe.quest/tags/linux.md?difficulty=easy))
- NAT/SNAT
- VPN basics
- container network namespaces

## Keywords

WireGuard, vprox, Modal, SOCKS5, policy-based routing, gVisor, wgctrl, eBPF

## Related posts

- [Modal's serverless Servers](https://swe.quest/articles/modal-s-serverless-servers-c4c4d9aad435b2d6.md): Modal · 2026-06-25 · Medium · 10 min read · Load balancing, Serverless, Inference & serving, Rust, Performance engineering
  Modal Servers are a low-latency HTTP/WebSocket/gRPC serving primitive that cut p50 request latency from 39ms to 6ms versus Modal Web Functions by dropping platform-managed queueing and keeping network calls off the hot path.
- [Modal becomes a gVisor maintainer](https://swe.quest/articles/modal-becomes-a-gvisor-maintainer-053bd8f08ca6c19d.md): Modal · 2026-11-11 · Medium · 9 min read · Sandboxing & isolation, Containers, Multi-tenancy, Hardware, Open source
  Google is donating gVisor to the CNCF under maintainer-led governance, and Modal, which launches over 40 million gVisor containers a day for GPU inference, training, and AI sandboxes, is joining as a maintainer. gVisor's Go-based Sentry application kernel implements the Linux syscall interface and is itself confined by namespaces, cgroups and seccomp, giving tenant isolation without hardware virtualization: about 25 ms boot and 12 MB overhead.
- [Hello, World: We’re Railway](https://swe.quest/articles/hello-world-we-re-railway-63540b1cb9b8fafa.md): Railway · 2023-09-25 · Medium · 17 min read · Networking, CDN & edge, Load balancing, Infrastructure as code, Storage systems
  Railway launches US-East, EU-West and Southeast Asia regions alongside its original US-West GCP zone, with one-click region moves that need no URL or DNS changes.
- [Lambda on hard mode: Inside Modal's web infrastructure](https://swe.quest/articles/lambda-on-hard-mode-inside-modal-s-web-infrastructure-9e5302ebea41d109.md): Modal · 2024-03-14 · Medium · 17 min read · Serverless, Networking, Rust, System design, Real-time systems
  Modal's modal-http service, written in Rust on hyper and Tokio, serves HTTP and WebSocket traffic for serverless functions by translating each request into a function call instead of reverse-proxying to containers.
- [Traffic 101: Packets Mostly Flow](https://swe.quest/articles/traffic-101-packets-mostly-flow-e9828aceea724731.md): Slack Engineering · 2023-08-28 · Medium · 9 min read · Networking, Load balancing, DNS, Resilience, CDN & edge
  A Slack request reaches its main region in AWS us-east-1 through a chain of hops.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
