Introduction: This guide will walk you through setting up WireGuard VPN Server on your Virtual Private Server (VPS) using TurnKey Linux. We'll cover accessing your VPS via SSH, completing the initial TurnKey Linux configuration, setting up the WireGuard server, and configuring clients to connect to your VPN.

Step 1: Access Your VPS via SSH

  1. Obtain Your VPS Details:

    • IP Address: Provided in your welcome email.
    • Root Password: Provided in your welcome email.
    • SSH Port: Default is 22 unless specified otherwise.

  2. Install an SSH Client:

    • Windows: Download PuTTY.
    • macOS/Linux: Use the built-in Terminal application.

  3. Connect to Your VPS:

    • Open your SSH client.
    • For Windows (PuTTY):
      • Enter your VPS IP in the "Host Name" field.
      • Ensure the port is set to 22.
      • Click "Open."
    • For macOS/Linux Terminal:
      bash
      ssh root@<Your-VPS-IP>
      Replace <Your-VPS-IP> with your server's IP address.

  4. Authenticate:

    • When prompted, enter the root password.
    • Upon successful login, you'll have terminal access to your VPS.

Step 2: Complete TurnKey Linux First Boot Configuration

Upon first login, TurnKey Linux will guide you through initial setup, you can reach this console anytime using command: confconsole

  1.  Set Root Password:

    • You'll be prompted to set a new password for the root user.
  2. Configure WireGuard:

    • Set the WireGuard VPN server name and private/public keys (these will be generated automatically).
  3. Configure Domain and SSL (Optional):

    • If you want to access your VPN management interface via a domain, set your domain and configure a Let's Encrypt SSL certificate.

Step 3: Configure WireGuard VPN

  1. Access Configuration Files:

    • Configuration files are located in /etc/wireguard/.
    • Edit wg0.conf to customize your VPN settings.
  2. Enable IP Forwarding:

    • Run the following command to enable IP forwarding:
      bash
      echo 1 > /proc/sys/net/ipv4/ip_forward
    • Make it permanent by editing /etc/sysctl.conf and setting net.ipv4.ip_forward=1.
  3. Start WireGuard:

    • Run the following command:
      bash
      systemctl start wg-quick@wg0
    • Enable it to start on boot:
      bash
      systemctl enable wg-quick@wg0

Step 4: Configure WireGuard Clients

  1. Generate Client Configuration Files:

    • Create configuration files for each client in /etc/wireguard/clients/.
    • Include the server's public key, allowed IPs, and client-specific settings.
  2. Install WireGuard Client:

    • Install WireGuard on your device:
      • Windows: Download from WireGuard Website.
      • Linux: Use your package manager: sudo apt install wireguard.
      • Mobile: Install the WireGuard app from your device's app store.
  3. Import Configuration:

    • Use the client app to import the generated configuration file and connect.

Step 5: Point Your Domain to Your VPS (Optional)

If you wish to use a domain for WireGuard management, configure it directly via our control panel or your registrar.

Option A: Domain Registered with Us

  1. Access Domain Management:

    • Log in to your account on our platform.
    • Navigate to the "Domain Management" or "DNS Settings" section.
  2. Create an A Record:

    • Host: @ (represents the root domain)
    • Points to: Your VPS IP address
    • TTL: Default or 3600 seconds

  3. Save Changes:

    • Apply the new DNS settings.
    • Note: DNS changes may take up to 24 hours to propagate.

Option B: Domain Registered Elsewhere

  1. Log in to Your Domain Registrar:

    • Access the DNS management area.
  2. Add an A Record:

    • Host: @
    • Points to: Your VPS IP address
    • TTL: Default or 3600 seconds
  3. Save Changes:

    • Apply the updated DNS settings.
    • Allow time for DNS propagation.

Step 6: Management Tools

 

Additional Resources:

Note:

  • Ensure your VPS firewall allows UDP traffic on WireGuard's port (default 51820).
  • DNS changes can take time to propagate globally.

Tips and Troubleshooting

  • Connection Issues: Ensure the server and client configurations match.
  • Firewall Rules: Verify that UDP traffic on port 51820 is allowed.
  • Logs: Check /var/log/syslog for WireGuard-related errors.
Was this answer helpful? 0 Users Found This Useful (0 Votes)