install & setting

dnf install -y wireguard-tools
# store secretkey
cd /etc/wireguard/
# set permission for root only
umask 077

create private key and public key

wg genkey | tee client.key | wg pubkey > client.pub

setting file

[Interface]
Address = ServerのVPN IP/24
ListenPort = 任意のポート
PrivateKey = Serverの秘密鍵
# 起動時にFW設定
PostUp   = firewall-cmd --add-port=任意のポート/udp
PostDown = firewall-cmd --remove-port=任意のポート/udp
[Peer]
PublicKey = Clientの公開鍵
AllowedIPs = ClientのVPN IP/32

client setting

Mac

アプリ立ち上げて、設定ファイルを読み込む

Ubuntu

/etc/wireguard/wg0.conf
#ansibleでserver側に.sshに生成してあるのでそれを上記にコピー
wg-quick up wg0

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS