docs: update cloud

This commit is contained in:
Administrator 2019-12-07 11:03:37 +00:00 committed by matze
parent fddb3cc9d5
commit 9753489836

View File

@ -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 = <your server private key here>
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
```