Introduction
Proxmox is an open-source server virtualization management solution that provides a platform for managing virtual machines, containers, and storage. It's widely used for building private clouds, hosting websites, and running various applications. In this article, we will discuss how to configure a site-to-site VPN connection between two Proxmox servers using OpenVPN. This setup will allow both networks to act as if they were part of the same local network, enabling seamless communication between hosts on each network.
Prerequisites
Before we begin, make sure you have the following:
- Two Proxmox servers with a minimum of 1 Gbps internet connection
- A TP-Link router for each Proxmox server
- Both routers configured with OpenVPN servers
Configuring Proxmox House #1
First, we will configure Proxmox House #1.
Installing OpenVPN
Install OpenVPN on Proxmox House #1:
sudo apt update
sudo apt install openvpn
Creating Certificates
Generate the necessary certificates for Proxmox House #1:
cd /etc/openvpn/easyrsa
./easyrsa init pki
./easyrsa build-ca
./easyrsa gen-dh
./easyrsa gen pkcs8 key.pem
./easyrsa gen pem key.pem
Creating Server Config
Create a server configuration file:
sudo nano /etc/openvpn/server.conf
Add the following content to the file:
port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
server 10.0.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
auth SHA256
comp-lzo
Starting OpenVPN Server
Start the OpenVPN server:
sudo systemctl start openvpn@server
sudo systemctl enable openvpn@server
Configuring Proxmox House #2
Now, we will configure Proxmox House #2.
Installing OpenVPN
Install OpenVPN on Proxmox House #2:
sudo apt update
sudo apt install openvpn
Creating Certificates
Generate the necessary certificates for Proxmox House #2:
cd /etc/openvpn/easyrsa
./easyrsa init pki
./easyrsa build-ca
./easyrsa gen-dh
./easyrsa gen pkcs8 key.pem
./easyrsa gen pem key.pem
Creating Client Config
Create a client configuration file:
sudo nano /etc/openvpn/client.conf
Add the following content to the file:
client
dev tun
remote 1194
ca ca.crt
cert client.crt
key client.key
dh dh2048.pem
cipher AES-256-CBC
auth SHA256
comp-lzo
Starting OpenVPN Client
Start the OpenVPN client:
sudo systemctl start openvpn@client
sudo systemctl enable openvpn@client
Testing the Connection
Test the connection by pinging hosts between the two networks:
ping
Summary
In this article, we learned how to configure a site-to-site VPN connection between two Proxmox servers using OpenVPN. By following the steps outlined above, you can create a secure and reliable connection between two networks, allowing seamless communication between hosts on each network.