0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

contabo VPSのWireGuardにPeerを追加してみた

Last updated at Posted at 2022-12-04

参照サイト
https://wiki.debian.org/WireGuard?action=show&redirect=Wireguard#Alternative_C_-_Import_by_reading_a_QR_code_.28most_secure_method.29
http://ubuntuyome.blogspot.com/2011/03/omg-ubuntu-ubuntu-qr.html

クライアント用秘密鍵・公開鍵を生成する

03フォルダにそれぞれ秘密鍵・公開鍵が生成される

mkdir ~/wireguard/03
cd ~/wireguard/03
wg genkey | sudo tee client.key
sudo cat client.key | wg pubkey | sudo tee client.pub

クライアント用設定ファイルを生成する

client.conf
[Interface]
PrivateKey = (clientPrivateKey3)
Address = 10.0.0.4/32
DNS = 8.8.4.4

[Peer]
PublicKey = (serverPublicKey)
AllowedIPs = 0.0.0.0/0
Endpoint = x.x.x.x:51820

クライアント用設定ファイルのQRコードを生成する

qrencode -o client.png < client.conf

クライアント用QRコードをWireGuardクライアントに読み込む

サーバー設定をする

Peerを追加する場合は、下記コマンドでWireGuardを停止した状態で追加しないと
設定が消されてしまうようです。

sudo wg-quick down wg0
/etc/wireguard/wg0.conf(追記)
[Peer]
PublicKey = (clientPublicKey3)
AllowedIPs = 10.0.0.4/32
sudo wg-quick up wg0
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?