English
简体中文繁體中文EnglishРусскийفارسی

Home › Guides › Phone by QR

Phone by QR

Turn a WireGuard client config into a QR code and scan it: qrencode in the terminal, ready codes in OpenWrt and wg-easy, and how to stay safe.

The phone imports it with a single QR scan
The phone imports it with a single QR scan Shwangtianyuan, CC BY-SA 4.0

A config for the phone

Make a new key pair on the server and add the phone as another peer with an unused address such as 10.8.0.3/32. Every device gets its own key, do not share.

phone.conf
[Interface]
PrivateKey = PHONE_PRIVATE_KEY
Address = 10.8.0.3/32
DNS = 1.1.1.1

[Peer]
PublicKey = SERVER_PUBLIC_KEY
Endpoint = SERVER_IP:51820
AllowedIPs = 0.0.0.0/0, ::/0
PersistentKeepalive = 25

Into a QR code

Shown right in the terminal
sudo apt install qrencode
qrencode -t ansiutf8 < phone.conf

On the phone tap +, choose Scan from QR code and name the tunnel.

On the phone (schematic)

Without a terminal

  • OpenWrt: the QR icon in the interface's Peers.
  • wg-easy: the QR button next to the device.
It will not scan.

The font is too large and the code is cut. Enlarge the window or shrink the font and show it again.

Must the server restart to know the phone?

No. sudo wg syncconf wg0 <(wg-quick strip wg0) adds the peer without dropping others.

Next letterUse your home network from outside

On the same round

Postcodes: WireGuard QR code, qrencode WireGuard, WireGuard phone setup