I get a virtual Cloud Server which is Ubuntu 22.04 LTS. I followed this tutorial.
I don't know why my IP is 192.168.0.22 rather than showing my public IP address in terminal.
Also this is the Code I used:
I don't know why my IP is 192.168.0.22 rather than showing my public IP address in terminal.
Also this is the Code I used:
Code:
sudo apt update
nano /etc/sysctl.d/99-sysctl.conf
# to Enable ip4 forward = 1
sudo ufw allow 51820/udp
sudo ufw allow 53/udp
sudo ufw allow 80/udp
sudo ufw allow 443/udp
sudo ufw allow 53/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow OpenSSH
sudo ufw disable
sudo ufw enable
systemctl reboot
sudo apt install wireguard
wg genkey | sudo tee /etc/wireguard/srvrpri.key
sudo chmod go= /etc/wireguard/srvrpri.key
sudo cat /etc/wireguard/srvrpri.key | wg pubkey | sudo tee /etc/wireguard/srvrpub.key
sudo nano /etc/wireguard/wg0.conf
[Interface]
PrivateKey = srvrpri.key
Address = 172.16.0.1/24
ListenPort = 51820
SaveConfig = true
PostUp = ufw route allow in on wg0 out on enp3s0
PostUp = iptables -t nat -I POSTROUTING -o enp3s0 -j MASQUERADE
PreDown = ufw route delete allow in on wg0 out on enp3s0
PreDown = iptables -t nat -D POSTROUTING -o enp3s0 -j MASQUERADE
[Peer]
PublicKey = cleint0pubkey.key
AllowedIPs = 172.16.0.2/32
sudo systemctl enable wg-quick@wg0.service
sudo systemctl start wg-quick@wg0.service
sudo systemctl status wg-quick@wg0.service