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

Home › Blog › Basics

One key, two people

The same WireGuard config on a phone and a PC makes them take turns. It is roaming: how to spot it, give each device a key, and when sharing is fine.

Compiled on

One hook each, and everyone knows whose it is
One hook each, and everyone knows whose it is Nan Palmero from San Antonio, TX, USA, CC BY 2.0

It works, only not at the same time. With both on, they cut each other off.

One profile from a provider and three people in the family, or one file imported on both phone and tablet. At first it seems fine, because they are rarely on together. When they are, pages come and go and video stops every half minute.

Why

The server knows you by public key and keeps one address per key. A packet from the phone sets it to the phone, one from the PC sets it to the PC. Replies go to whoever spoke last.

  1. Phone sendsNoted: this key is at the phone
  2. PC sendsChanged: this key is at the PC
  3. Reply for the phoneDelivered to the PC
  4. Phone sends againChanged back
As the server sees it
Two keys: one key pair per device, never shared
Two keys: one key pair per device, never shared Unknown, CC0

How to spot it

Watch on the server
watch -n1 'sudo wg show wg0 endpoints'

If the address behind one key jumps back and forth, two devices use it.

One key each

  1. Make a pair for every device.
  2. Give each a [Peer] on the server with its own /32.
  3. Delete the shared one.

The generator writes them all when you enter the number of devices.

A phone: two phones on one config keep pushing each other off
A phone: two phones on one config keep pushing each other off Blakegripling ph, CC0

Configs from a provider

Most providers let you create as many configs as devices you may use at once. With only one, turn on one device at a time.

Why it sometimes looks fine

WireGuard remembers the address of the last valid packet. If one device is silent nothing goes wrong. The phone's screen lights up, apps synchronise, and the tablet misses a beat. Even behind the same public IP the ports differ, so they still compete.

Is it a security problem

  • You cannot cancel one device. If it is lost, the key goes for all of them.
  • The internal address is the same, so records and firewall rules cannot tell them apart.

Separating them

The phone keeps its profile, the tablet gets a new one.

On the server
wg genkey | tee tablet.key | wg pubkey > tablet.pub
sudo wg set wg0 peer "$(cat tablet.pub)" allowed-ips 10.8.0.6/32

Copy the old profile, change PrivateKey and Address = 10.8.0.6/32, import it on the tablet, then save:

Save
sudo wg-quick save wg0

If the interface has SaveConfig = true, hand edits to the file are overwritten when it goes down; check first.

The provider gives only one

Look in the dashboard: most plans sold per device can make several, each using one place. If there is really only one, put it on the router; everything behind counts as one client.

When sharing is fine

CaseOK
Two systems on one computerYes, never both at once
Old phone to new phoneYes, delete the old
A spare, normally offBarely
Two people's phonesNo
Phone and televisionNo, the TV is always on
Two systems on one PC?

They never run together, so one config is fine.

The same one for my family?

No. Besides the drops, one lost phone means new keys for everybody.

Different preshared keys?

No. Only the public key identifies a device.

Can a provider ban me?

Read the terms. More often it just breaks now and then and is taken for a bad line.

Family members should install it themselves?

One profile each, as a QR code sent to that person. It contains the private key, so delete the picture after scanning.

Next letter

On the same round

Postcodes: WireGuard multiple devices, WireGuard keeps disconnecting, same WireGuard config two devices