+0
Daily
5,825
stars
467
forks
109
watchers
30
prs
78
issues
6
releases
README
!DSVPN
!CodeQL scan
DSVPN is a Dead Simple VPN, designed to address the most common use case for using a VPN:
text
[client device] ---- (untrusted/restricted network) ---- [vpn server] ---- [the Internet]
Features:
Runs on TCP. Works pretty much everywhere, including on public WiFi where only TCP/443 is open or reliable.
Uses only modern cryptography, with formally verified implementations.
Small and constant memory footprint. Doesn't perform any heap memory allocations.
Small (~25 KB), with an equally small and readable code base. No external dependencies.
Works out of the box. No lousy documentation to read. No configuration file. No post-configuration. Run a single-line command on the server, a similar one on the client and you're done. No firewall and routing rules to manually mess with.
Works on Linux (kernel = 3.17), macOS and OpenBSD, as well as DragonFly BSD, FreeBSD and NetBSD in client and point-to-point modes. Adding support for other operating systems is trivial.
Doesn't leak between reconnects if the network doesn't change. Blocks IPv6 on the client to prevent IPv6 leaks.
Installation
sh
make
On Raspberry Pi 3 and 4, use the following command instead to enable NEON optimizations:
sh
env OPTFLAGS=-mfpu=neon make
Alternatively, if you have zig installed, it can be used to compile DSVPN:
sh
zig build -Drelease
On macOS, DSVPN can be installed using Homebrew: brew install dsvpn.
Secret key
DSVPN uses a shared secret. Create it with the following command:
sh
dd if=/dev/urandom of=vpn.key count=1 bs=32
And copy it on the server and the client.
If required, keys can be exported and imported in printable form:
sh
base64 vpn.key
Example usage on the server
sh
sudo ./dsvpn server vpn.key auto 1959
Here, I use port 1959. Everything else is set to the default values. If you want to use the default port (443), it doesn't even have to be specified, so the parameters can just be server vpn.key
Example usage on the client
sh
sudo ./dsvpn client vpn.key 34.216.127.34 1959
This is a macOS client, connecting to the VPN server 34.216.127.34 on port 1959. The port number is optional here as well. And the IP can be replaced by a host name.
That's it
You are connected. Just hit Ctrl-C to disconnect.
Evaggelos Balaskas wrote a great blog post walking through the whole procedure: A Dead Simple VPN.
He also maintains systemd service files for DSVPN. Thank you Evaggelos!
A note on DNS
If you were previously using a DNS resolver only accessible from the local network, it won't be accessible through the VPN. That might be the only thing you may have to change. Use a public resolver, a local resolver, or DNSCrypt.
Or send a pull request implementing the required commands to change and revert the DNS settings, or redirect DNS queries to another resolver, for all supported operating systems.
Advanced configuration
text
dsvpn "server"
|"auto"
|"auto"
|"auto"
|"auto"
Top issues
Latest release
0.1.5 0.1.5 2025-12-19- Now available in Homebrew - install with brew install dsvpn - Install target now automatically creates the sbin directory if needed - Added Zig build support - Replaced deprecated -Ofast with standard optimization flags - Improved documentation No major changes, since dsvpn remains secure and rock solid.