Accessing Proxmox via OpenVPN with Network Conflict Resolution on Arch Linux

Accessing Proxmox via OpenVPN with Network Conflict Resolution on Arch Linux

If you're trying to access your Proxmox server through OpenVPN and encountering network conflicts, particularly when both your local and remote networks use the 192.168.0.x subnet, this guide will help you resolve these issues. We'll cover everything from initial setup to certificate management.

The guide is about NetwirkManager, not system service route. I decided to go it this way to be able switch the vpn off and on.

Prerequisites

Initial Setup

1. Install Required Packages

pacman -S networkmanager-openvpn
systemctl status NetworkManager

2. Import OpenVPN Configuration

Using NetworkManager GUI:

Fixing Network Conflicts

1. Identify Current Routes

ip route
# Look for conflicting 192.168.0.0/24 routes

2. Correct Routing

# Remove conflicting route
sudo ip route del 192.168.0.0/24 via <default-gateway>
# Add specific route for Proxmox
sudo ip route add 192.168.0.0/24 via <vpn-gateway> dev tun0

Connection Verification

1. Basic Connectivity Tests

# Check VPN interface
ip a show tun0
# Test basic connectivity
ping 192.168.0.<proxmox-ip>
# Interface-specific ping
ping -I tun0 192.168.0.<proxmox-ip>

2. HTTPS Testing

# Standard HTTPS test (will fail with self-signed cert)
curl https://192.168.0.<proxmox-ip>:8006
# Bypass SSL verification (for testing)
curl -k https://192.168.0.<proxmox-ip>:8006
# With proper CA file
curl --cacert /etc/pve/pve-root-ca.pem https://192.168.0.<proxmox-ip>:8006

Certificate Management

System-Wide Certificate Trust

sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain proxmox-cert.pem

On Linux (Arch):

sudo cp proxmox-cert.pem /etc/ca-certificates/trust-source/anchors/
sudo update-ca-trust

Firefox Certificate Setup

  1. Clean existing certificates:
rm -rf ~/.mozilla/firefox/*.default-release/cert*.db
  1. Import certificate:
  1. Disable CSP temporarily if needed:

Obtaining Proxmox Certificate

# From Proxmox server
cp /etc/pve/pve-root-ca.pem proxmox-cert.pem
# Transfer to local machine

Accessing Proxmox

After completing the setup, access your Proxmox interface:

https://192.168.0.<proxmox-ip>:8006

Troubleshooting

Common Issues and Solutions

  1. Connection Drops
  1. Certificate Errors
  1. Network Connectivity
# Check routes
ip route | grep "192.168.0"
# Test connectivity
ping -c 3 192.168.0.<proxmox-ip>

Important Notes

Security Considerations

To persist routing between reboots:

  1. create the dispatcher script:

sudo nano /etc/NetworkManager/dispatcher.d/02-vpn-routes

  1. Add this content:

#!/bin/bash IF=$1 STATUS=$2 if [ "$IF" = "tun0" ] && [ "$STATUS" = "up" ]; then # Wait a few seconds for the interface to be fully up sleep 2 # Delete the conflicting route /usr/bin/ip route del 192.168.0.0/24 dev wlp2s0 # Add the route through VPN /usr/bin/ip route add 192.168.0.0/24 via 10.0.8.1 dev tun0 # Log the change logger "VPN routes updated for tun0" fi

  1. Make it executable:

sudo chmod +x /etc/NetworkManager/dispatcher.d/02-vpn-routes

This should be enough to handle the routing automatically whenever the VPN connects. No service needed!

This guide should help you successfully set up and access your Proxmox server through OpenVPN, even when dealing with conflicting network configurations. Remember to adjust IP addresses and paths according to your specific setup.

Final thoughts.

I spent two days trying to open the connection to proxmox server via openvpn. I’d say it’s very sad that my beloved arch linux has so weak integration with openvpn, which is quite popular.

It might be my lack of knowledge though.

It’s easier to set it up at system service level, but I didn’t test it. Just ask any chat :)

Complex structure