[Day 5] 3. OpenVPN Setup
For this lab: we require two machines: Windows and Debian Keep the both machines in NAT
Steps to Configure VPN:
On Debian (Linux) Machine:
-
Install OpenVPN: Open a terminal and install OpenVPN:
bashsudo apt-get install openvpn -
Create the
Configuration File:server.conf-
Create a file named
in your home directory (e.g.,server.conf)./home/user/ -
Add the following content to the file:
plaintextproto udp port 1194 dev tun auth none cipher none ifconfig 10.8.0.1 10.8.0.2 verb 3 -
Explanation of settings:
- : Sets the protocol to UDP.
proto udp - : OpenVPN default port.
port 1194 - : TUN device (used for routing packets).
dev tun - : No authentication.
auth none - : No encryption.
cipher none - : Assigns IP addresses.
ifconfig 10.8.0.1 10.8.0.2 - : Sets the verbosity level to 3 (detailed logging).
verb 3
-
-
Start the OpenVPN Server: Start OpenVPN using the
file:server.confbashsudo openvpn --config server.conf
On Windows Machine (VM):
-
Install OpenVPN:
- Install OpenVPN on your Windows VM.
-
Ensure Three Network Adapters:
- Make sure you have two adapters (one Ethernet and one Bluetooth). Bluetooth might not be there.
- When OpenVPN is installed, a new virtual network adapter should automatically be created.
- Press and type
Windows + R. You can check your adapters here.ncpa.cpl
-
Create the
Configuration File:client.conf-
On the Windows machine, create a file (e.g.,
).client.conf -
Add the following content:
plaintextremote <vpn_ip> # Replace <vpn_ip> with the actual IP of your VPN server (Debian machine). proto udp port 1194 dev tun auth none cipher none ifconfig 10.8.0.2 10.8.0.1 verb 3 -
Save the file as
in a location likeclient.conf.C:\Myfiles\client.conf
-
-
Start OpenVPN Client:
-
Go to the OpenVPN directory on the Windows machine:
C:\Program Files (x86)\OpenVPN Technologies\OpenVPN Client\core -
Run the following command in the terminal:
bashopenvpn --config c:\Myfiles\client.conf -
Make sure to provide the correct path where you saved
.client.conf
-
Testing the VPN Connection:
-
Ping the VPN IPs:
- Now, try pinging both IPs:
- The actual IP (e.g., ).
192.168.80.128 - The VPN IP (and
10.8.0.1).10.8.0.2
- The actual IP (e.g.,
You should be able to successfully ping both IPs, indicating that the VPN is set up and working properly.
- Now, try pinging both IPs:
Important Note:
- Do not close the terminals (both the server and client sessions) while testing the connection.
Read Next
[Day 5] 4. Working of VPN
### 1. **What a VPN Does:** Think of a VPN as a private, secure tunnel between your device and the internet. Instead of connecting directly to a we...
[Day 5] 5. Sharing Internet Access Between VMs Using Clear OS
### **Setup Overview** We require two Virtual Machines for this lab: - **VM1 (One Adapter)**: - **Adapter**: Host-only (cannot direct...