WireGuard

Modern VPN tunnel with a small attack surface

About

WireGuard builds an encrypted tunnel between peers using public keys. Its code base is deliberately small and auditable. The Termux tools let you generate keys and manage tunnels.

Install it

pkg install wireguard-tools

Run this inside Termux. If the package is already present, pkg will say so and do nothing.

Commands worth knowing

6 of the invocations you will actually reach for. Tap the copy button to put one on your clipboard.

wg genkey Create a fresh private key for a new peer.
wg pubkey Derive the matching public key from a private one. Share it with peers.
wg show List the active tunnels and their interfaces.
wg show wg0 Print the peers, endpoints and latest handshake for one tunnel.
wg set wg0 peer aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789= allowed-ips 10.0.0.2/32 Add a peer to a running tunnel and give it a set of addresses.
wg show wg0 transfer Show how many bytes have moved through the tunnel since it came up.

Worked example

Run wg show wg0 and this is what you should see.

termux
$ wg show wg0
interface: wg0
  public key: aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789=
  listening port: 51820
peer: eFgHiJkLmNoPqRsTuVwXyZ0123456789aBc=
  endpoint: 203.0.113.5:51820
  latest handshake: 12 seconds ago

Developed by

Jason A. Donenfeld · released under GPL-2.0.