Project 5 - Wireguard with AWS

Setup Instance

Boot up learner lab

Launch new instance

Select Ubuntu 22.04

Make new keypair

Edit Security group

Start instance

Setup Wiregaurd

Now download key to xubuntu-lan

Open Terminal and connect to instance

Install wireguard:

sudo apt-get update
sudo apt-get install wireguard

Wiregaurd Server Configuration

Wiregaurd xUbuntu Configuration

Add to config

PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o ens162 -j MASQUERADE

PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o ens162 -j MASQUERADE

Then type

sysctl -w net.ipv4.ip_forward=1
sysctl -p

Activate Wiregaurd

systemctl restart wg-quick@wg0.service

Showing connectivity

Connecting to test page over arbitrary port

Connecting to webpage: