LoginSignup
3
0

More than 1 year has passed since last update.

Raspberry Pi を WireGuard のクライアントとして構成する (Raspberry Pi OS)

Last updated at Posted at 2022-10-20

結論

$ sudo apt install wireguard-tools
$ cat << _EOT_ | sudo tee /etc/wireguard/wg0.conf
[Interface]
PrivateKey = <Get from WireGuard VPN Server>
Address = <Get from WireGuard VPN Server>

[Peer]
PublicKey = <Get from WireGuard VPN Server>
AllowedIPs = <Get from WireGuard VPN Server>
Endpoint = <Get from WireGuard VPN Server>
_EOT_
$ sudo systemctl enable --now wg-quick@wg0

解説

WireGuard は UDP ベースのモダンな VPN 実装です。Raspberry Pi でも使えます。

Raspberry Pi OS には wireguard-dkmswireguard-tools という2つのパッケージがあります。Raspberry Pi を WireGuard クライアントとして使うなら wireguard-tools (ユーザーランド実装) で十分です。

設定を /etc/wireguard/wg0.conf として作ったら、後は systemd にて起動します。再起動時の自動起動も行ってくれます。

ちなみに systemctl enable 時の @wg0/etc/wireguard/wg0.conf のファイル名と対応しています。 @wg1 なら wg1.conf です。複数セッションも管理できそうです(未確認)。

あとがき

"Raspberry Pi WireGuard" でググると、Raspberry Pi を WireGuard サーバーにする話ばかりで、クライアントとして構成する話が意外にも無かったので。

EoT

3
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
3
0