0% found this document useful (0 votes)
4 views30 pages

Test Ubuntu VPN

This document provides a detailed guide for setting up a VPN server using OpenVPN on two Ubuntu PCs and two Android devices. It includes step-by-step instructions for installation, configuration, and testing of the VPN, along with recommended tools and resources. Additionally, it offers test cases to verify data and address safety, ensuring secure connections.

Uploaded by

ueuauk4ever
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views30 pages

Test Ubuntu VPN

This document provides a detailed guide for setting up a VPN server using OpenVPN on two Ubuntu PCs and two Android devices. It includes step-by-step instructions for installation, configuration, and testing of the VPN, along with recommended tools and resources. Additionally, it offers test cases to verify data and address safety, ensuring secure connections.

Uploaded by

ueuauk4ever
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 30

I'll provide a detailed step-by-step guide for setting up a VPN server with:

 2 Ubuntu PCs (one as the server, one as a client)


 2 Android devices as clients
 Test cases for data and address safety
 Free tools and resources

Step 1: Install OpenVPN on the VPN Server (Ubuntu PC 1)

1. Update packages:
2. sudo apt update
3. sudo apt install openvpn easy-rsa
4. Copy the OpenVPN example configuration:
5. cp -r /usr/share/easy-rsa /etc/openvpn/
6. cd /etc/openvpn/easy-rsa
7. Initialize the PKI (Public Key Infrastructure):
8. ./easyrsa init-pki
9. Build the Certificate Authority (CA):
10. ./easyrsa build-ca
11. Generate the Server Certificate and Key:
12. ./easyrsa gen-req server nopass
13. ./easyrsa sign-req server server
14. Create Diffie-Hellman parameters:
15. ./easyrsa gen-dh
16. Copy keys to the OpenVPN directory:
17. cp pki/ca.crt pki/issued/server.crt pki/private/server.key
pki/dh.pem /etc/openvpn/
18. Copy the default server configuration file:
19. cp
/usr/share/doc/openvpn/examples/sample-config-files/server.conf
/etc/openvpn/
20. Edit server.conf to configure:
o Set dh /etc/openvpn/dh.pem
o Uncomment push "redirect-gateway def1 bypass-dhcp"
o Uncomment push "dhcp-option DNS 8.8.8.8"
o Uncomment user nobody and group nogroup
21. Enable IP Forwarding:
22. sudo nano /etc/sysctl.conf

Add the following line:

net.ipv4.ip_forward = 1

Run:

sudo sysctl -p

23. Start and enable the VPN server:

sudo systemctl start openvpn@server


sudo systemctl enable openvpn@server
Step 2: Configure the VPN Client (Ubuntu PC 2)

1. Install OpenVPN:
2. sudo apt install openvpn
3. Copy the client configuration template:
4. cp /usr/share/doc/openvpn/examples/sample-config-files/client.conf
~/client.conf
5. Edit client.conf to point to the server's IP:
6. remote <VPN_SERVER_IP> 1194
7. Copy the required certificates and keys to /etc/openvpn:
8. sudo cp /path/to/ca.crt /etc/openvpn/
9. sudo cp /path/to/client.crt /etc/openvpn/
10. sudo cp /path/to/client.key /etc/openvpn/
11. Start the VPN client:
12. sudo systemctl start openvpn@client
13. sudo systemctl enable openvpn@client

Step 3: Configure Android Devices

1. Install OpenVPN Connect or OpenVPN for Android from the Play Store.
2. Export the client .ovpn file from your VPN server and transfer it to your Android
devices.
3. Import the .ovpn file in the OpenVPN app.
4. Connect and verify the VPN status.

Step 4: Test Cases for Data and Address Safety

1. IP Address Verification:
o Before connecting to the VPN, visit https://whatismyip.com to note the
original IP address.
o Connect to the VPN and revisit the website — your IP should now reflect the
VPN server’s address.
2. Packet Capture Test (Wireshark/tcpdump)
o Run tcpdump on the server:
o sudo tcpdump -i tun0
o This ensures encrypted data is flowing only through the VPN tunnel.
3. DNS Leak Test:
o Visit https://dnsleaktest.com before and after connecting to the VPN.
4. File Transfer Test:
o Transfer a file securely using scp:
o scp /path/to/file username@<VPN_SERVER_IP>:/home/username/
5. Firewall Test:
o Block non-VPN traffic using:
o sudo ufw default deny outgoing
o sudo ufw allow out on tun0

Step 5: Video References for Guidance


Here are some useful video references that guide VPN setup in Ubuntu and Android:

 OpenVPN Setup on Ubuntu - Step by Step


 OpenVPN Configuration for Android Devices

Would you like a PDF summarizing these steps?

You might also like