Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#!/bin/bash # VPN Setup #Script for VM w Auto Detection # ============================= # EDIT THIS SECTION for your VM subnet and Proxmox host IP HOST_IP="192.168.1.76" # Proxmox host vmbr0 IP VM_SUBNET="192.168.1.0/24" # VM network/subnet WG_CONF="/etc/wireguard/wg0.conf" # Path to your existing WireGuard config on host # ============================= echo "(1) Installing Packages..." apt update apt install -y wireguard-tools resolvconf iptables iproute2 curl sudo echo "(2) IP Forwarding..." sysctl -w net.ipv4.ip_forward=1 echo "net.ipv4.ip_forward=1" > /etc/sysctl.d/99-ipforward.conf sysctl --system echo "(3) Wireguard NAT Setup..." iptables -t nat -A POSTROUTING -s $VM_SUBNET -o wg0 -j MASQUERADE apt install -y iptables-persistent netfilter-persistent save wg-quick up $WG_CONF echo "(4) Configuring Gateway & DNS..." VM_IF=$(ip -o link show | awk -F': ' '{print $2}' | grep -v lo | head -n1) ip route replace default via $HOST_IP dev $VM_IF # Set DNS to host VPN DNS (adjust if needed) echo "nameserver 10.2.0.1" > /etc/resolv.conf echo "Setup Complete!"
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)