• Find something interesting and Exam it

Creat an VPN with Oracle Cloud

  1. Sign in the Oracle cloud throuth follow link
    Oracle | Integrated Cloud Applications and Platform Services

2.Create a instance

3. Select Ubuntu 20.04

and click Select Emage , Just like bellow.

3. Save the Private Key and Public Key before creating a instance.

4.Click Create

Like bellow

Information of Instance shows like bellow.

5. Connect your Oracle Cloud with a SSH soft (I use Tera Term)
User name is  ubuntu
Check Use RSA/DSA/ECDSA/ED25519 key to log in
Update the Private key file

6. Update and Upgrade Ubuntu system by runing the following command
sudo apt update
sudo apt upgrade

7.Install WireGuard by runing following command
sudo curl -L https://install.pivpn.io | bash

8. Following picture will appares. just press Enter key.

Press Enter key

Select ubuntu in following step

In my case it is need to use PgDn key and space key to select

Use PgDn key and space key select PiVon-is -local-DNS.

Restart sever as requested by the wizard.
Clect Yes and press Enter key.

9. Seting Attached VNICs and Ingress Rules.
Return to the Oracle Cloud interface and select
Compute => Instances => Instance Details
Scroll down, select Attached VNICs in the left panel (Resources)

Select Edit VNIC

Check “Skip source/destination check” and click Save Changes

 Scroll back up and click on the Subnet in the Primary VNIC section

Click Default Security List

Click Add Ingress Rules and fill in following information and click Add Ingress Rules
Source CIDR: 0.0.0.0/0 | IP Protocol: UDP | Destination Port: 51820|

10. Modify the configuration file of PiVPN wg0.conf
Switch back to terminal and input following conmmand.
sudo nano /etc/wireguard/wg0.conf

# Example File Structure:

[Interface]
Address = 10.6.0.1/24
PrivateKey = ……………………………………………..=
ListenPort = 51820
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -A FORWARD -o %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -D FORWARD -o %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

#[Peer]
# # NAME OF CLIENT
#PublicKey = <CLIENT’S PUBLIC KEY>
#AllowedIPs = XXX.XXX.XXX.XXX/32

####################

Save the config file by pressing Control+X and then Y then [ENTER]
Now restart WireGuard by following command:

sudo wg-quick down wg0
sudo wg-quick up wg0

30. Make Sure WireGuard Starts on Boot:

$ sudo systemctl enable wg-quick@wg0.service
$ sudo systemctl restart wg-quick@wg0.service

11. Add a Client
Adding a Client Configuration for my phone: $ pivpn add

ubuntu@instance-20210812-0810:~$ pivpn add
Enter a Name for the Client: sun
::: Client Keys generated
::: Client config generated
::: Updated server config

::: WireGuard reloaded

::: Done! sun.conf successfully created!
::: sun.conf was copied to /home/ubuntu/configs for easy transfer.
::: Please use this profile only on one device and create additional
::: profiles for other devices. You can also use pivpn -qr

::: to generate a QR Code you can scan with the mobile app.

コメントを残す