From 97534898361ab3877c1d767c66d331b353415b89 Mon Sep 17 00:00:00 2001 From: Administrator Date: Sat, 7 Dec 2019 11:03:37 +0000 Subject: [PATCH] docs: update cloud --- cloud.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/cloud.md b/cloud.md index f9a131fc..cb677459 100644 --- a/cloud.md +++ b/cloud.md @@ -2,7 +2,7 @@ title: Cloud description: published: true -date: 2019-12-07T10:18:00.378Z +date: 2019-12-07T11:03:33.870Z tags: --- @@ -28,3 +28,48 @@ Networking > Virtual Cloud Networks >Virtual Cloud Network Details > Security Li ### Wireguard Server + +#### Install +``` +sudo add-apt-repository ppa:wireguard/wireguard +sudo apt-get install wireguard +# Activate kernel module +sudo modprobe wireguard +``` + +#### Enable NAT +``` +cat << EOF >> /etc/sysctl.conf +net.ipv4.ip_forward=1 +EOF +sudo sysctl -p +``` + + +#### Generate Keys +``` +cd /etc/wireguard +umask 077 +wg genkey | sudo tee privatekey | wg pubkey | sudo tee publickey + +sudo vim /etc/wireguard/wg0.conf +``` +Content: +``` +[Interface] +PrivateKey = +Address = 10.50.0.1/24 +SaveConfig = false +PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o ens3 -j MASQUERADE; +PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o ens3 -j MASQUERADE; +ListenPort = 54541 +``` + +#### Start Server +``` +# Start Server Fast +sudo wg-quick up wg0 +# Enable Server +sudo systemctl enable wg-quick@wg0 +``` +